September 2018
Beginner to intermediate
218 pages
4h 27m
English
Unlike EAV models, creating simple models is pretty straightforward. Let's go ahead and create a model, resource model, and a collection for a Log entity.
We will start off by creating the <MAGELICIOUS_DIR>/Core/Model/Log.php file with the following content:
class Log extends \Magento\Framework\Model\AbstractModel { protected $_eventPrefix = 'magelicious_core_log'; protected $_eventObject = 'log'; protected function _construct() { $this->_init(\Magelicious\Core\Model\ResourceModel\Log::class); }}
The use of $_eventPrefix and $_eventObject is not mandatory, but it is highly recommended. These values are used by the Magento\Framework\Model\AbstractModel event dispatcher and add to the future extensibility of our module. ...
Read now
Unlock full access