5
5
*/
6
6
namespace Magento\Authorization\Model;
7
7
8
+ use Magento\Authorization\Model\ResourceModel\Role\Collection;
9
+ use Magento\Framework\App\ObjectManager;
10
+ use Magento\Framework\Model\AbstractModel;
11
+
8
12
/**
9
13
* Admin Role Model
10
14
*
11
15
* @api
12
16
* @method int getParentId()
13
- * @method \Magento\Authorization\Model\ Role setParentId(int $value)
17
+ * @method Role setParentId(int $value)
14
18
* @method int getTreeLevel()
15
- * @method \Magento\Authorization\Model\ Role setTreeLevel(int $value)
19
+ * @method Role setTreeLevel(int $value)
16
20
* @method int getSortOrder()
17
- * @method \Magento\Authorization\Model\ Role setSortOrder(int $value)
21
+ * @method Role setSortOrder(int $value)
18
22
* @method string getRoleType()
19
- * @method \Magento\Authorization\Model\ Role setRoleType(string $value)
23
+ * @method Role setRoleType(string $value)
20
24
* @method int getUserId()
21
- * @method \Magento\Authorization\Model\ Role setUserId(int $value)
25
+ * @method Role setUserId(int $value)
22
26
* @method string getUserType()
23
- * @method \Magento\Authorization\Model\ Role setUserType(string $value)
27
+ * @method Role setUserType(string $value)
24
28
* @method string getRoleName()
25
- * @method \Magento\Authorization\Model\ Role setRoleName(string $value)
29
+ * @method Role setRoleName(string $value)
26
30
* @api
27
31
* @since 100.0.2
28
32
*/
29
- class Role extends \Magento\Framework\Model\ AbstractModel
33
+ class Role extends AbstractModel
30
34
{
31
35
/**
32
36
* @var string
@@ -38,23 +42,6 @@ class Role extends \Magento\Framework\Model\AbstractModel
38
42
*/
39
43
protected $_cacheTag = 'user_assigned_role';
40
44
41
- /**
42
- * @param \Magento\Framework\Model\Context $context
43
- * @param \Magento\Framework\Registry $registry
44
- * @param \Magento\Authorization\Model\ResourceModel\Role $resource
45
- * @param \Magento\Authorization\Model\ResourceModel\Role\Collection $resourceCollection
46
- * @param array $data
47
- */
48
- public function __construct( //phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod
49
- \Magento\Framework\Model\Context $context,
50
- \Magento\Framework\Registry $registry,
51
- \Magento\Authorization\Model\ResourceModel\Role $resource,
52
- \Magento\Authorization\Model\ResourceModel\Role\Collection $resourceCollection,
53
- array $data = []
54
- ) {
55
- parent::__construct($context, $registry, $resource, $resourceCollection, $data);
56
- }
57
-
58
45
/**
59
46
* @inheritDoc
60
47
*/
@@ -70,31 +57,30 @@ public function __sleep()
70
57
public function __wakeup()
71
58
{
72
59
parent::__wakeup();
73
- $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
74
- $this->_resource = $objectManager->get(\Magento\Authorization\Model\ResourceModel\Role::class);
75
- $this->_resourceCollection = $objectManager->get(
76
- \Magento\Authorization\Model\ResourceModel\Role\Collection::class
77
- );
60
+ $objectManager = ObjectManager::getInstance();
61
+ $this->_resource = $objectManager->get(ResourceModel\Role::class);
62
+ $this->_resourceCollection = $objectManager->get(Collection::class);
78
63
}
79
64
80
65
/**
81
- * Class constructor
82
- *
83
- * @return void
66
+ * @inheritdoc
84
67
*/
85
68
protected function _construct()
86
69
{
87
- $this->_init(\Magento\Authorization\Model\ ResourceModel\Role::class);
70
+ $this->_init(ResourceModel\Role::class);
88
71
}
89
72
90
73
/**
91
- * Update object into database
74
+ * Obsolete method of update
92
75
*
93
76
* @return $this
77
+ * @deprecated Method was never implemented and used.
94
78
*/
95
79
public function update()
96
80
{
97
- $this->getResource()->update($this);
81
+ // phpcs:disable Magento2.Functions.DiscouragedFunction
82
+ trigger_error('Method was never implemented and used.', E_USER_DEPRECATED);
83
+
98
84
return $this;
99
85
}
100
86
0 commit comments