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 ;
@@ -63,7 +68,7 @@ public function __construct(
63
68
*
64
69
* @param string $entityType
65
70
* @return \Magento\Eav\Api\Data\AttributeInterface[]
66
- * @throws \ Exception if for unknown entity type
71
+ * @throws Exception if for unknown entity type
67
72
* @deprecated Not used anymore
68
73
* @see ReadHandler::getEntityAttributes
69
74
*/
@@ -80,7 +85,7 @@ protected function getAttributes($entityType)
80
85
* @param string $entityType
81
86
* @param DataObject $entity
82
87
* @return \Magento\Eav\Api\Data\AttributeInterface[]
83
- * @throws \ Exception if for unknown entity type
88
+ * @throws Exception if for unknown entity type
84
89
*/
85
90
private function getEntityAttributes (string $ entityType , DataObject $ entity ): array
86
91
{
@@ -111,9 +116,9 @@ protected function getContextVariables(ScopeInterface $scope)
111
116
* @param array $entityData
112
117
* @param array $arguments
113
118
* @return array
114
- * @throws \ Exception
115
- * @throws \Magento\Framework\Exception\ ConfigurationMismatchException
116
- * @throws \Magento\Framework\Exception\ LocalizedException
119
+ * @throws Exception
120
+ * @throws ConfigurationMismatchException
121
+ * @throws LocalizedException
117
122
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
118
123
*/
119
124
public function execute ($ entityType , $ entityData , $ arguments = [])
@@ -129,7 +134,7 @@ public function execute($entityType, $entityData, $arguments = [])
129
134
$ attributesMap = [];
130
135
$ selects = [];
131
136
132
- /** @var \Magento\Eav\Model\Entity\Attribute\ AbstractAttribute $attribute */
137
+ /** @var AbstractAttribute $attribute */
133
138
foreach ($ this ->getEntityAttributes ($ entityType , new DataObject ($ entityData )) as $ attribute ) {
134
139
if (!$ attribute ->isStatic ()) {
135
140
$ attributeTables [$ attribute ->getBackend ()->getTable ()][] = $ attribute ->getAttributeId ();
@@ -170,8 +175,11 @@ public function execute($entityType, $entityData, $arguments = [])
170
175
$ entityData [$ attributesMap [$ attributeValue ['attribute_id ' ]]] = $ attributeValue ['value ' ];
171
176
} else {
172
177
$ this ->logger ->warning (
173
- "Attempt to load value of nonexistent EAV attribute ' {$ attributeValue ['attribute_id ' ]}'
174
- for entity type ' $ entityType'. "
178
+ "Attempt to load value of nonexistent EAV attribute " ,
179
+ [
180
+ 'attribute_id ' => $ attributeValue ['attribute_id ' ],
181
+ 'entity_type ' => $ entityType
182
+ ]
175
183
);
176
184
}
177
185
}
@@ -184,8 +192,9 @@ public function execute($entityType, $entityData, $arguments = [])
184
192
*
185
193
* @param Select[] $selects
186
194
* @param array $identifiers
195
+ * @return void
187
196
*/
188
- private function applyIdentifierForSelects (array $ selects , array $ identifiers )
197
+ private function applyIdentifierForSelects (array $ selects , array $ identifiers ): void
189
198
{
190
199
foreach ($ selects as $ select ) {
191
200
foreach ($ identifiers as $ identifier ) {
0 commit comments