31 $this->_codeModel =
$code;
45 if ($entity instanceof \
Magento\Cms\Model\Page) {
48 $this->_codeModel->loadByEntityIdAndType(
$entity->getId(), $this->
_getEntityType(), $entity->getStoreId());
65 throw new \InvalidArgumentException(
'The model class is not valid');
79 if ($this->_entity instanceof \
Magento\Catalog\Model\Category) {
83 if ($this->_entity instanceof \
Magento\Catalog\Model\Product) {
87 if ($this->_entity instanceof \
Magento\Cms\Model\Page) {
101 if (!$this->_entity->getId()) {
102 throw new \InvalidArgumentException(
'The model is empty');
const ENTITY_TYPE_PRODUCT
getCodeObjectByEntity(\Magento\Framework\Model\AbstractModel $entity)
__construct(\Magento\GoogleOptimizer\Model\Code $code)
const ENTITY_TYPE_CATEGORY