Skip to content

Commit 2d32de4

Browse files
ENGCOM-1522: [Backport] Add concrete type hints for product and category resources #15138
- Merge Pull Request #15138 from rogyar/magento2:2.1-catalog-type-hints - Merged commits: 1. a1f1a0f
2 parents 96c3e42 + a1f1a0f commit 2d32de4

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
@@ -114,6 +114,11 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
114114
*/
115115
protected $_url;
116116

117+
/**
118+
* @var ResourceModel\Category
119+
*/
120+
protected $_resource;
121+
117122
/**
118123
* URL rewrite model
119124
*
@@ -327,6 +332,16 @@ protected function getCustomAttributesCodes()
327332
return $this->customAttributesCodes;
328333
}
329334

335+
/**
336+
* @throws \Magento\Framework\Exception\LocalizedException
337+
* @return \Magento\Catalog\Model\ResourceModel\Category
338+
* @deprecated because resource models should be used directly
339+
*/
340+
protected function _getResource()
341+
{
342+
return parent::_getResource();
343+
}
344+
330345
/**
331346
* Get flat resource model flag
332347
*

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

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

120+
/**
121+
* @var ResourceModel\Product
122+
*/
123+
protected $_resource;
124+
120125
/**
121126
* @var string
122127
*/
@@ -469,6 +474,18 @@ protected function _construct()
469474
$this->_init('Magento\Catalog\Model\ResourceModel\Product');
470475
}
471476

477+
/**
478+
* Get resource instance
479+
*
480+
* @throws \Magento\Framework\Exception\LocalizedException
481+
* @return \Magento\Catalog\Model\ResourceModel\Product
482+
* @deprecated because resource models should be used directly
483+
*/
484+
protected function _getResource()
485+
{
486+
return parent::_getResource();
487+
}
488+
472489
/**
473490
* {@inheritdoc}
474491
*/

0 commit comments

Comments
 (0)