/** * Constructor * * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Catalog\Model\Resource\UrlFactory $catalogResourceUrlFactory * @param \Magento\Catalog\Model\Url $catalogUrl * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Catalog\Model\Resource\UrlFactory $catalogResourceUrlFactory, \Magento\Catalog\Model\Url $catalogUrl, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array()) { $this->_catalogResourceUrl = $catalogResourceUrlFactory->create(); $this->_catalogUrl = $catalogUrl; parent::__construct($context, $registry, $resource, $resourceCollection, $data); }
/** * Retrieve resource model * * @return \Magento\Catalog\Model\Resource\Url */ public function getResource() { if (is_null($this->_resourceModel)) { $this->_resourceModel = $this->_urlFactory->create(); } return $this->_resourceModel; }