11
11
use Magento \Eav \Model \Entity \Attribute \Frontend \AbstractFrontend ;
12
12
use Magento \Eav \Model \Entity \Attribute \Source \AbstractSource ;
13
13
use Magento \Eav \Model \Entity \Attribute \UniqueValidationInterface ;
14
+ use Magento \Eav \Model \ResourceModel \Attribute \DefaultEntityAttributes \ProviderInterface as DefaultAttributesProvider ;
14
15
use Magento \Framework \App \Config \Element ;
16
+ use Magento \Framework \App \ObjectManager ;
15
17
use Magento \Framework \DataObject ;
16
18
use Magento \Framework \DB \Adapter \DuplicateException ;
17
19
use Magento \Framework \Exception \AlreadyExistsException ;
18
20
use Magento \Framework \Exception \LocalizedException ;
19
21
use Magento \Framework \Model \AbstractModel ;
22
+ use Magento \Framework \Model \ResourceModel \AbstractResource ;
20
23
use Magento \Framework \Model \ResourceModel \Db \ObjectRelationProcessor ;
21
24
use Magento \Framework \Model \ResourceModel \Db \TransactionManagerInterface ;
22
- use Magento \Eav \Model \ResourceModel \Attribute \DefaultEntityAttributes \ProviderInterface as DefaultAttributesProvider ;
23
- use Magento \Framework \Model \ResourceModel \AbstractResource ;
24
- use Magento \Framework \App \ObjectManager ;
25
25
26
26
/**
27
27
* Entity/Attribute/Model - entity abstract
28
28
*
29
+ * phpcs:disable Magento2.Classes.AbstractApi
29
30
* @api
30
31
* @author Magento Core Team <core@magentocommerce.com>
31
32
* @SuppressWarnings(PHPMD.TooManyFields)
@@ -266,6 +267,8 @@ public function setConnection($connection)
266
267
/**
267
268
* Resource initialization
268
269
*
270
+ * phpcs:disable Magento2.CodeAnalysis.EmptyBlock
271
+ *
269
272
* @return void
270
273
*/
271
274
protected function _construct ()
@@ -687,6 +690,7 @@ public function walkAttributes($partMethod, array $args = [], $collectExceptionM
687
690
}
688
691
689
692
try {
693
+ // phpcs:disable Magento2.Functions.DiscouragedFunction
690
694
$ results [$ attrCode ] = call_user_func_array ([$ instance , $ method ], $ args );
691
695
} catch (\Magento \Eav \Model \Entity \Attribute \Exception $ e ) {
692
696
if ($ collectExceptionMessages ) {
@@ -826,9 +830,9 @@ public function getValueTablePrefix()
826
830
$ prefix = (string ) $ this ->getEntityType ()->getValueTablePrefix ();
827
831
if (!empty ($ prefix )) {
828
832
$ this ->_valueTablePrefix = $ prefix ;
829
- /**
830
- * entity type prefix include DB table name prefix
831
- */
833
+ /**
834
+ * entity type prefix include DB table name prefix
835
+ */
832
836
//$this->_resource->getTableName($prefix);
833
837
} else {
834
838
$ this ->_valueTablePrefix = $ this ->getEntityTable ();
@@ -991,9 +995,9 @@ public function getDefaultAttributeSourceModel()
991
995
/**
992
996
* Load entity's attributes into the object
993
997
*
994
- * @param AbstractModel $object
995
- * @param int $entityId
996
- * @param array|null $attributes
998
+ * @param AbstractModel $object
999
+ * @param int $entityId
1000
+ * @param array|null $attributes
997
1001
* @return $this
998
1002
*/
999
1003
public function load ($ object , $ entityId , $ attributes = [])
@@ -1131,8 +1135,8 @@ protected function _getLoadAttributesSelect($object, $table)
1131
1135
/**
1132
1136
* Initialize attribute value for object
1133
1137
*
1134
- * @param DataObject $object
1135
- * @param array $valueRow
1138
+ * @param DataObject $object
1139
+ * @param array $valueRow
1136
1140
* @return $this
1137
1141
*/
1138
1142
protected function _setAttributeValue ($ object , $ valueRow )
@@ -1237,7 +1241,7 @@ protected function _getOrigObject($object)
1237
1241
/**
1238
1242
* Aggregate Data for attributes that will be deleted
1239
1243
*
1240
- * @param array & $delete
1244
+ * @param & array $delete
1241
1245
* @param AbstractAttribute $attribute
1242
1246
* @param AbstractEntity $object
1243
1247
* @return void
@@ -1248,6 +1252,7 @@ private function _aggregateDeleteData(&$delete, $attribute, $object)
1248
1252
if (!isset ($ delete [$ tableName ])) {
1249
1253
$ delete [$ tableName ] = [];
1250
1254
}
1255
+ // phpcs:ignore Magento2.Performance.ForeachArrayMerge
1251
1256
$ delete [$ tableName ] = array_merge ((array )$ delete [$ tableName ], $ valuesData );
1252
1257
}
1253
1258
}
@@ -1422,7 +1427,7 @@ protected function _prepareStaticValue($key, $value)
1422
1427
/**
1423
1428
* Save object collected data
1424
1429
*
1425
- * @param array $saveData array('newObject', 'entityRow', 'insert', 'update', 'delete')
1430
+ * @param array $saveData array('newObject', 'entityRow', 'insert', 'update', 'delete')
1426
1431
* @return $this
1427
1432
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
1428
1433
* @SuppressWarnings(PHPMD.NPathComplexity)
@@ -1517,9 +1522,9 @@ protected function _processSaveData($saveData)
1517
1522
/**
1518
1523
* Insert entity attribute value
1519
1524
*
1520
- * @param DataObject $object
1521
- * @param AbstractAttribute $attribute
1522
- * @param mixed $value
1525
+ * @param DataObject $object
1526
+ * @param AbstractAttribute $attribute
1527
+ * @param mixed $value
1523
1528
* @return $this
1524
1529
*/
1525
1530
protected function _insertAttribute ($ object , $ attribute , $ value )
@@ -1530,10 +1535,10 @@ protected function _insertAttribute($object, $attribute, $value)
1530
1535
/**
1531
1536
* Update entity attribute value
1532
1537
*
1533
- * @param DataObject $object
1534
- * @param AbstractAttribute $attribute
1535
- * @param mixed $valueId
1536
- * @param mixed $value
1538
+ * @param DataObject $object
1539
+ * @param AbstractAttribute $attribute
1540
+ * @param mixed $valueId
1541
+ * @param mixed $value
1537
1542
* @return $this
1538
1543
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
1539
1544
*/
@@ -1892,10 +1897,12 @@ protected function _getDefaultAttributes()
1892
1897
*/
1893
1898
public function getDefaultAttributes ()
1894
1899
{
1895
- return array_unique (array_merge (
1896
- $ this ->_getDefaultAttributes (),
1897
- [$ this ->getEntityIdField (), $ this ->getLinkField ()]
1898
- ));
1900
+ return array_unique (
1901
+ array_merge (
1902
+ $ this ->_getDefaultAttributes (),
1903
+ [$ this ->getEntityIdField (), $ this ->getLinkField ()]
1904
+ )
1905
+ );
1899
1906
}
1900
1907
1901
1908
/**
0 commit comments