Skip to content

Commit 0b46e11

Browse files
authored
ENGCOM-8016: Refactor Category Link: Replace deprecated interface, clean the code #29564
2 parents fe19a9d + 9d0e0af commit 0b46e11

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

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

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,41 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Catalog\Model;
89

10+
use Magento\Catalog\Api\Data\CategoryLinkExtensionInterface;
11+
use Magento\Catalog\Api\Data\CategoryLinkInterface;
12+
use Magento\Framework\Model\AbstractExtensibleModel;
13+
914
/**
1015
* @codeCoverageIgnore
1116
*/
12-
class CategoryLink extends \Magento\Framework\Api\AbstractExtensibleObject implements
13-
\Magento\Catalog\Api\Data\CategoryLinkInterface
17+
class CategoryLink extends AbstractExtensibleModel implements CategoryLinkInterface
1418
{
15-
/**#@+
16-
* Constants
17-
*/
18-
const KEY_POSITION = 'position';
19-
const KEY_CATEGORY_ID = 'category_id';
20-
/**#@-*/
19+
public const KEY_POSITION = 'position';
20+
public const KEY_CATEGORY_ID = 'category_id';
2121

2222
/**
23-
* {@inheritdoc}
23+
* @inheritdoc
2424
*/
2525
public function getPosition()
2626
{
27-
return $this->_get(self::KEY_POSITION);
27+
return $this->getData(self::KEY_POSITION);
2828
}
2929

3030
/**
31-
* {@inheritdoc}
31+
* @inheritdoc
3232
*/
3333
public function getCategoryId()
3434
{
35-
return $this->_get(self::KEY_CATEGORY_ID);
35+
return $this->getData(self::KEY_CATEGORY_ID);
3636
}
3737

3838
/**
39+
* @inheritDoc
40+
*
3941
* @param int $position
4042
* @return $this
4143
*/
@@ -56,7 +58,7 @@ public function setCategoryId($categoryId)
5658
}
5759

5860
/**
59-
* {@inheritdoc}
61+
* @inheritdoc
6062
*
6163
* @return \Magento\Catalog\Api\Data\CategoryLinkExtensionInterface|null
6264
*/
@@ -66,14 +68,13 @@ public function getExtensionAttributes()
6668
}
6769

6870
/**
69-
* {@inheritdoc}
71+
* @inheritdoc
7072
*
7173
* @param \Magento\Catalog\Api\Data\CategoryLinkExtensionInterface $extensionAttributes
7274
* @return $this
7375
*/
74-
public function setExtensionAttributes(
75-
\Magento\Catalog\Api\Data\CategoryLinkExtensionInterface $extensionAttributes
76-
) {
76+
public function setExtensionAttributes(CategoryLinkExtensionInterface $extensionAttributes)
77+
{
7778
return $this->_setExtensionAttributes($extensionAttributes);
7879
}
7980
}

0 commit comments

Comments
 (0)