Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit af9e6cf

Browse files
author
Oleksii Korshenko
authored
ENGCOM-808: Add concrete type hints for product and category resources #14005
2 parents b050660 + 8158a11 commit af9e6cf

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
@@ -97,6 +97,11 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
9797
*/
9898
protected $_url;
9999

100+
/**
101+
* @var ResourceModel\Category
102+
*/
103+
protected $_resource;
104+
100105
/**
101106
* URL rewrite model
102107
*
@@ -313,6 +318,16 @@ protected function getCustomAttributesCodes()
313318
return $this->getCustomAttributeCodes->execute($this->metadataService);
314319
}
315320

321+
/**
322+
* @throws \Magento\Framework\Exception\LocalizedException
323+
* @return \Magento\Catalog\Model\ResourceModel\Category
324+
* @deprecated because resource models should be used directly
325+
*/
326+
protected function _getResource()
327+
{
328+
return parent::_getResource();
329+
}
330+
316331
/**
317332
* Get flat resource model flag
318333
*

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

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

123+
/**
124+
* @var ResourceModel\Product
125+
*/
126+
protected $_resource;
127+
123128
/**
124129
* @var string
125130
*/
@@ -475,6 +480,18 @@ protected function _construct()
475480
$this->_init(\Magento\Catalog\Model\ResourceModel\Product::class);
476481
}
477482

483+
/**
484+
* Get resource instance
485+
*
486+
* @throws \Magento\Framework\Exception\LocalizedException
487+
* @return \Magento\Catalog\Model\ResourceModel\Product
488+
* @deprecated because resource models should be used directly
489+
*/
490+
protected function _getResource()
491+
{
492+
return parent::_getResource();
493+
}
494+
478495
/**
479496
* {@inheritdoc}
480497
*/

0 commit comments

Comments
 (0)