Skip to content

Commit c325349

Browse files
committed
Add concrete type hints for product and category resources
1 parent 5ed3aa3 commit c325349

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

app/code/Magento/Catalog/Model/Category.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
112112
*/
113113
protected $_url;
114114

115+
/**
116+
* @var ResourceModel\Category
117+
*/
118+
protected $_resource;
119+
115120
/**
116121
* URL rewrite model
117122
*
@@ -332,6 +337,16 @@ protected function getCustomAttributesCodes()
332337
return $this->customAttributesCodes;
333338
}
334339

340+
/**
341+
* @throws \Magento\Framework\Exception\LocalizedException
342+
* @return \Magento\Catalog\Model\ResourceModel\Category
343+
* @deprecated because resource models should be used directly
344+
*/
345+
protected function _getResource()
346+
{
347+
return parent::_getResource();
348+
}
349+
335350
/**
336351
* Get flat resource model flag
337352
*

app/code/Magento/Catalog/Model/Product.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements
118118
*/
119119
protected $_urlModel = null;
120120

121+
/**
122+
* @var ResourceModel\Product
123+
*/
124+
protected $_resource;
125+
121126
/**
122127
* @var string
123128
*/
@@ -482,6 +487,18 @@ protected function _construct()
482487
$this->_init(\Magento\Catalog\Model\ResourceModel\Product::class);
483488
}
484489

490+
/**
491+
* Get resource instance
492+
*
493+
* @throws \Magento\Framework\Exception\LocalizedException
494+
* @return \Magento\Catalog\Model\ResourceModel\Product
495+
* @deprecated because resource models should be used directly
496+
*/
497+
protected function _getResource()
498+
{
499+
return parent::_getResource();
500+
}
501+
485502
/**
486503
* Get a list of custom attribute codes that belongs to product attribute set. If attribute set not specified for
487504
* product will return all attribute codes

0 commit comments

Comments
 (0)