3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+
6
7
namespace Magento \Eav \Model \ResourceModel ;
7
8
9
+ use Exception ;
8
10
use Magento \Eav \Model \Config ;
11
+ use Magento \Eav \Model \Entity \Attribute \AbstractAttribute ;
9
12
use Magento \Framework \DataObject ;
10
13
use Magento \Framework \DB \Select ;
11
14
use Magento \Framework \DB \Sql \UnionExpression ;
12
15
use Magento \Framework \EntityManager \MetadataPool ;
13
16
use Magento \Framework \EntityManager \Operation \AttributeInterface ;
17
+ use Magento \Framework \Exception \ConfigurationMismatchException ;
18
+ use Magento \Framework \Exception \LocalizedException ;
14
19
use Magento \Framework \Model \Entity \ScopeInterface ;
15
20
use Magento \Framework \Model \Entity \ScopeResolver ;
16
21
use Psr \Log \LoggerInterface ;
17
22
18
23
/**
19
24
* EAV read handler
25
+ *
26
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
20
27
*/
21
28
class ReadHandler implements AttributeInterface
22
29
{
@@ -63,7 +70,7 @@ public function __construct(
63
70
*
64
71
* @param string $entityType
65
72
* @return \Magento\Eav\Api\Data\AttributeInterface[]
66
- * @throws \ Exception if for unknown entity type
73
+ * @throws Exception if for unknown entity type
67
74
* @deprecated Not used anymore
68
75
* @see ReadHandler::getEntityAttributes
69
76
*/
@@ -80,7 +87,7 @@ protected function getAttributes($entityType)
80
87
* @param string $entityType
81
88
* @param DataObject $entity
82
89
* @return \Magento\Eav\Api\Data\AttributeInterface[]
83
- * @throws \ Exception if for unknown entity type
90
+ * @throws Exception if for unknown entity type
84
91
*/
85
92
private function getEntityAttributes (string $ entityType , DataObject $ entity ): array
86
93
{
@@ -111,9 +118,9 @@ protected function getContextVariables(ScopeInterface $scope)
111
118
* @param array $entityData
112
119
* @param array $arguments
113
120
* @return array
114
- * @throws \ Exception
115
- * @throws \Magento\Framework\Exception\ ConfigurationMismatchException
116
- * @throws \Magento\Framework\Exception\ LocalizedException
121
+ * @throws Exception
122
+ * @throws ConfigurationMismatchException
123
+ * @throws LocalizedException
117
124
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
118
125
*/
119
126
public function execute ($ entityType , $ entityData , $ arguments = [])
@@ -129,7 +136,7 @@ public function execute($entityType, $entityData, $arguments = [])
129
136
$ attributesMap = [];
130
137
$ selects = [];
131
138
132
- /** @var \Magento\Eav\Model\Entity\Attribute\ AbstractAttribute $attribute */
139
+ /** @var AbstractAttribute $attribute */
133
140
foreach ($ this ->getEntityAttributes ($ entityType , new DataObject ($ entityData )) as $ attribute ) {
134
141
if (!$ attribute ->isStatic ()) {
135
142
$ attributeTables [$ attribute ->getBackend ()->getTable ()][] = $ attribute ->getAttributeId ();
@@ -170,8 +177,11 @@ public function execute($entityType, $entityData, $arguments = [])
170
177
$ entityData [$ attributesMap [$ attributeValue ['attribute_id ' ]]] = $ attributeValue ['value ' ];
171
178
} else {
172
179
$ this ->logger ->warning (
173
- "Attempt to load value of nonexistent EAV attribute ' {$ attributeValue ['attribute_id ' ]}'
174
- for entity type ' $ entityType'. "
180
+ "Attempt to load value of nonexistent EAV attribute " ,
181
+ [
182
+ 'attribute_id ' => $ attributeValue ['attribute_id ' ],
183
+ 'entity_type ' => $ entityType
184
+ ]
175
185
);
176
186
}
177
187
}
@@ -184,8 +194,9 @@ public function execute($entityType, $entityData, $arguments = [])
184
194
*
185
195
* @param Select[] $selects
186
196
* @param array $identifiers
197
+ * @return void
187
198
*/
188
- private function applyIdentifierForSelects (array $ selects , array $ identifiers )
199
+ private function applyIdentifierForSelects (array $ selects , array $ identifiers ): void
189
200
{
190
201
foreach ($ selects as $ select ) {
191
202
foreach ($ identifiers as $ identifier ) {
0 commit comments