Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractAttribute.php
Go to the documentation of this file.
1 <?php
8 
12 
25 {
26  const TYPE_STATIC = 'static';
27 
31  const EMPTY_STRING = '';
32 
38  protected $_name;
39 
45  protected $_entity;
46 
52  protected $_backend;
53 
59  protected $_frontend;
60 
66  protected $_source;
67 
73  protected $_attributeIdCache = [];
74 
80  protected $_dataTable = null;
81 
85  protected $_eavConfig;
86 
90  protected $_eavTypeFactory;
91 
95  protected $_storeManager;
96 
100  protected $_resourceHelper;
101 
106 
111 
116 
120  protected $dataObjectHelper;
121 
125  private $frontendLabelFactory;
126 
133  protected $serializer;
134 
140  private $emptyStringTypes = [
141  'int',
142  'decimal',
143  'datetime',
144  'varchar',
145  'text',
146  'static',
147  ];
148 
152  private $eavExtensionFactory;
153 
175  public function __construct(
176  \Magento\Framework\Model\Context $context,
177  \Magento\Framework\Registry $registry,
178  \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
180  \Magento\Eav\Model\Config $eavConfig,
181  \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory,
182  \Magento\Store\Model\StoreManagerInterface $storeManager,
183  \Magento\Eav\Model\ResourceModel\Helper $resourceHelper,
184  \Magento\Framework\Validator\UniversalFactory $universalFactory,
185  \Magento\Eav\Api\Data\AttributeOptionInterfaceFactory $optionDataFactory,
186  \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor,
187  \Magento\Framework\Api\DataObjectHelper $dataObjectHelper,
188  \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
189  \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
190  array $data = [],
191  \Magento\Eav\Api\Data\AttributeExtensionFactory $eavExtensionFactory = null,
192  FrontendLabelFactory $frontendLabelFactory = null
193  ) {
194  parent::__construct(
195  $context,
196  $registry,
197  $extensionFactory,
199  $resource,
200  $resourceCollection,
201  $data
202  );
203  $this->_eavConfig = $eavConfig;
204  $this->_eavTypeFactory = $eavTypeFactory;
205  $this->_storeManager = $storeManager;
206  $this->_resourceHelper = $resourceHelper;
207  $this->_universalFactory = $universalFactory;
208  $this->optionDataFactory = $optionDataFactory;
209  $this->dataObjectProcessor = $dataObjectProcessor;
210  $this->dataObjectHelper = $dataObjectHelper;
211  $this->eavExtensionFactory = $eavExtensionFactory ?: \Magento\Framework\App\ObjectManager::getInstance()
212  ->get(\Magento\Eav\Api\Data\AttributeExtensionFactory::class);
213  $this->frontendLabelFactory = $frontendLabelFactory
214  ?: \Magento\Framework\App\ObjectManager::getInstance()->get(FrontendLabelFactory::class);
215  }
216 
224  protected function getSerializer()
225  {
226  if ($this->serializer === null) {
227  $this->serializer = \Magento\Framework\App\ObjectManager::getInstance()->create(Json::class);
228  }
229 
230  return $this->serializer;
231  }
232 
239  protected function _construct()
240  {
241  $this->_init(\Magento\Eav\Model\ResourceModel\Entity\Attribute::class);
242  }
243 
252  public function loadByCode($entityType, $code)
253  {
254  \Magento\Framework\Profiler::start('load_by_code');
255  if (is_numeric($entityType)) {
257  } elseif (is_string($entityType)) {
258  $entityType = $this->_eavTypeFactory->create()->loadByCode($entityType);
259  }
260  if ($entityType instanceof \Magento\Eav\Model\Entity\Type) {
261  $entityTypeId = $entityType->getId();
262  }
263  if (empty($entityTypeId)) {
264  throw new LocalizedException(__('The entity supplied is invalid. Verify the entity and try again.'));
265  }
266  $this->_getResource()->loadByCode($this, $entityTypeId, $code);
267  $this->_afterLoad();
268  \Magento\Framework\Profiler::stop('load_by_code');
269 
270  return $this;
271  }
272 
279  public function getName()
280  {
281  return $this->_getData('attribute_code');
282  }
283 
291  public function setAttributeId($data)
292  {
293  $this->_data['attribute_id'] = $data;
294 
295  return $this;
296  }
297 
302  public function getAttributeId()
303  {
304  return $this->_getData('attribute_id');
305  }
306 
312  public function setAttributeCode($data)
313  {
314  return $this->setData('attribute_code', $data);
315  }
316 
321  public function getAttributeCode()
322  {
323  return $this->_getData('attribute_code');
324  }
325 
331  public function setAttributeModel($data)
332  {
333  return $this->setData('attribute_model', $data);
334  }
335 
340  public function getAttributeModel()
341  {
342  return $this->_getData('attribute_model');
343  }
344 
350  public function setBackendType($data)
351  {
352  return $this->setData('backend_type', $data);
353  }
354 
359  public function getBackendType()
360  {
361  return $this->_getData('backend_type');
362  }
363 
369  public function setBackendModel($data)
370  {
371  return $this->setData('backend_model', $data);
372  }
373 
378  public function getBackendModel()
379  {
380  return $this->_getData('backend_model');
381  }
382 
388  public function setBackendTable($data)
389  {
390  return $this->setData('backend_table', $data);
391  }
392 
398  public function getIsVisibleOnFront()
399  {
400  return $this->_getData('is_visible_on_front');
401  }
402 
407  public function getDefaultValue()
408  {
409  return $this->_getData('default_value');
410  }
411 
419  public function setDefaultValue($defaultValue)
420  {
421  return $this->setData('default_value', $defaultValue);
422  }
423 
428  public function getAttributeSetId()
429  {
430  return $this->_getData('attribute_set_id');
431  }
432 
438  public function setAttributeSetId($id)
439  {
440  $this->_data['attribute_set_id'] = $id;
441 
442  return $this;
443  }
444 
449  public function getEntityTypeId()
450  {
451  return $this->_getData('entity_type_id');
452  }
453 
459  public function setEntityTypeId($id)
460  {
461  $this->_data['entity_type_id'] = $id;
462 
463  return $this;
464  }
465 
471  public function setEntityType($type)
472  {
473  $this->setData('entity_type', $type);
474 
475  return $this;
476  }
477 
484  public function getAlias($entity = null)
485  {
486  $alias = '';
487  if ($entity === null || $entity->getType() !== $this->getEntity()->getType()) {
488  $alias .= $this->getEntity()->getType() . '/';
489  }
490  $alias .= $this->getAttributeCode();
491 
492  return $alias;
493  }
494 
502  public function setName($name)
503  {
504  return $this->setData('attribute_code', $name);
505  }
506 
513  public function getEntityType()
514  {
515  return $this->_eavConfig->getEntityType($this->getEntityTypeId());
516  }
517 
525  public function setEntity($entity)
526  {
527  $this->_entity = $entity;
528 
529  return $this;
530  }
531 
537  public function getEntity()
538  {
539  if (!$this->_entity) {
540  $this->_entity = $this->getEntityType()->getEntity();
541  }
542 
543  return $this->_entity;
544  }
545 
552  public function getEntityIdField()
553  {
554  return $this->getEntity()->getValueEntityIdField();
555  }
556 
563  public function getBackend()
564  {
565  if (empty($this->_backend)) {
566  if (!$this->getBackendModel()) {
567  $this->setBackendModel($this->_getDefaultBackendModel());
568  }
569  $backend = $this->_universalFactory->create($this->getBackendModel());
570  if (!$backend) {
571  throw new LocalizedException(
572  __(
573  'The "%1" backend model is invalid. Verify the backend model and try again.',
574  $this->getBackendModel()
575  )
576  );
577  }
578  $this->_backend = $backend->setAttribute($this);
579  }
580 
581  return $this->_backend;
582  }
583 
589  public function getFrontend()
590  {
591  if (empty($this->_frontend)) {
592  if (!$this->getFrontendModel()) {
593  $this->setFrontendModel($this->_getDefaultFrontendModel());
594  }
595  $this->_frontend = $this->_universalFactory->create($this->getFrontendModel())->setAttribute($this);
596  }
597 
598  return $this->_frontend;
599  }
600 
607  public function getSource()
608  {
609  if (empty($this->_source)) {
610  if (!$this->getSourceModel()) {
611  $this->setSourceModel($this->_getDefaultSourceModel());
612  }
613  $source = $this->_universalFactory->create($this->getSourceModel());
614  if (!$source) {
615  throw new LocalizedException(
616  __(
617  'Source model "%1" not found for attribute "%2"',
618  $this->getSourceModel(),
619  $this->getAttributeCode()
620  )
621  );
622  }
623  $this->_source = $source->setAttribute($this);
624  }
625 
626  return $this->_source;
627  }
628 
634  public function usesSource()
635  {
636  $input = $this->getFrontendInput();
637 
638  return $input === 'select' || $input === 'multiselect' || $this->_getData('source_model') != '';
639  }
640 
645  protected function _getDefaultBackendModel()
646  {
647  return \Magento\Eav\Model\Entity::DEFAULT_BACKEND_MODEL;
648  }
649 
654  protected function _getDefaultFrontendModel()
655  {
656  return \Magento\Eav\Model\Entity::DEFAULT_FRONTEND_MODEL;
657  }
658 
663  protected function _getDefaultSourceModel()
664  {
665  return $this->getEntityType()->getEntity()->getDefaultAttributeSourceModel();
666  }
667 
674  public function isValueEmpty($value)
675  {
676  return (is_array($value) && count($value) == 0)
677  || $value === null
678  || ($value === false && $this->getBackend()->getType() != 'int')
679  || ($value === self::EMPTY_STRING && $this->isInEmptyStringTypes());
680  }
681 
690  {
691  return $this->isInEmptyStringTypes() && $value === self::EMPTY_STRING;
692  }
693 
699  private function isInEmptyStringTypes()
700  {
701  return in_array($this->getBackend()->getType(), $this->emptyStringTypes);
702  }
703 
710  public function isInSet($setId)
711  {
712  if (!$this->hasAttributeSetInfo()) {
713  return true;
714  }
715 
716  if (is_array($setId) && count(array_intersect($setId, array_keys($this->getAttributeSetInfo())))) {
717  return true;
718  }
719 
720  if (!is_array($setId) && array_key_exists($setId, $this->getAttributeSetInfo())) {
721  return true;
722  }
723 
724  return false;
725  }
726 
734  public function isInGroup($setId, $groupId)
735  {
736  $dataPath = sprintf('attribute_set_info/%s/group_id', $setId);
737  if ($this->isInSet($setId) && $this->getData($dataPath) == $groupId) {
738  return true;
739  }
740 
741  return false;
742  }
743 
751  public function getIdByCode($entityType, $code)
752  {
753  $cacheKey = "{$entityType}|{$code}";
754  if (!isset($this->_attributeIdCache[$cacheKey])) {
755  $this->_attributeIdCache[$cacheKey] = $this->getResource()->getIdByCode($entityType, $code);
756  }
757 
758  return $this->_attributeIdCache[$cacheKey];
759  }
760 
766  public function isStatic()
767  {
768  return $this->getBackendType() == self::TYPE_STATIC || $this->getBackendType() == '';
769  }
770 
776  public function getBackendTable()
777  {
778  if ($this->_dataTable === null) {
779  if ($this->isStatic()) {
780  $this->_dataTable = $this->getEntityType()->getValueTablePrefix();
781  } else {
782  $backendTable = trim($this->_getData('backend_table'));
783  if (empty($backendTable)) {
784  $entityTable = [$this->getEntityType()->getEntityTablePrefix(), $this->getBackendType()];
785  $backendTable = $this->getResource()->getTable($entityTable);
786  }
787  $this->_dataTable = $backendTable;
788  }
789  }
790 
791  return $this->_dataTable;
792  }
793 
799  public function getFlatColumns()
800  {
801  // If source model exists - get definition from it
802  if ($this->usesSource() && $this->getBackendType() != self::TYPE_STATIC) {
803  return $this->getSource()->getFlatColumns();
804  }
805 
806  return $this->_getFlatColumnsDdlDefinition();
807  }
808 
816  {
817  $columns = [];
818  switch ($this->getBackendType()) {
819  case 'static':
820  $describe = $this->_getResource()->describeTable($this->getBackend()->getTable());
821  if (!isset($describe[$this->getAttributeCode()])) {
822  break;
823  }
824  $prop = $describe[$this->getAttributeCode()];
825  $type = $prop['DATA_TYPE'];
826  $size = $prop['LENGTH'] ? $prop['LENGTH'] : null;
827 
828  $columns[$this->getAttributeCode()] = [
829  'type' => $this->_resourceHelper->getDdlTypeByColumnType($type),
830  'length' => $size,
831  'unsigned' => $prop['UNSIGNED'] ? true : false,
832  'nullable' => $prop['NULLABLE'],
833  'default' => $prop['DEFAULT'],
834  'extra' => null,
835  ];
836  break;
837  case 'datetime':
838  $columns[$this->getAttributeCode()] = [
840  'unsigned' => false,
841  'nullable' => true,
842  'default' => null,
843  'extra' => null,
844  ];
845  break;
846  case 'decimal':
847  $columns[$this->getAttributeCode()] = [
849  'length' => '12,4',
850  'unsigned' => false,
851  'nullable' => true,
852  'default' => null,
853  'extra' => null,
854  ];
855  break;
856  case 'int':
857  $columns[$this->getAttributeCode()] = [
859  'unsigned' => false,
860  'nullable' => true,
861  'default' => null,
862  'extra' => null,
863  ];
864  break;
865  case 'text':
866  $columns[$this->getAttributeCode()] = [
868  'unsigned' => false,
869  'nullable' => true,
870  'default' => null,
871  'extra' => null,
873  ];
874  break;
875  case 'varchar':
876  $columns[$this->getAttributeCode()] = [
878  'length' => '255',
879  'unsigned' => false,
880  'nullable' => true,
881  'default' => null,
882  'extra' => null,
883  ];
884  break;
885  default:
886  break;
887  }
888 
889  return $columns;
890  }
891 
900  protected function _getFlatColumnsOldDefinition()
901  {
902  $columns = [];
903  switch ($this->getBackendType()) {
904  case 'static':
905  $describe = $this->_getResource()->describeTable($this->getBackend()->getTable());
906  if (!isset($describe[$this->getAttributeCode()])) {
907  break;
908  }
909  $prop = $describe[$this->getAttributeCode()];
910  $columns[$this->getAttributeCode()] = [
911  'type' => $prop['DATA_TYPE'] . ($prop['LENGTH'] ? "({$prop['LENGTH']})" : ""),
912  'unsigned' => $prop['UNSIGNED'] ? true : false,
913  'is_null' => $prop['NULLABLE'],
914  'default' => $prop['DEFAULT'],
915  'extra' => null,
916  ];
917  break;
918  case 'datetime':
919  $columns[$this->getAttributeCode()] = [
920  'type' => 'datetime',
921  'unsigned' => false,
922  'is_null' => true,
923  'default' => null,
924  'extra' => null,
925  ];
926  break;
927  case 'decimal':
928  $columns[$this->getAttributeCode()] = [
929  'type' => 'decimal(12,4)',
930  'unsigned' => false,
931  'is_null' => true,
932  'default' => null,
933  'extra' => null,
934  ];
935  break;
936  case 'int':
937  $columns[$this->getAttributeCode()] = [
938  'type' => 'int',
939  'unsigned' => false,
940  'is_null' => true,
941  'default' => null,
942  'extra' => null,
943  ];
944  break;
945  case 'text':
946  $columns[$this->getAttributeCode()] = [
947  'type' => 'text',
948  'unsigned' => false,
949  'is_null' => true,
950  'default' => null,
951  'extra' => null,
952  ];
953  break;
954  case 'varchar':
955  $columns[$this->getAttributeCode()] = [
956  'type' => 'varchar(255)',
957  'unsigned' => false,
958  'is_null' => true,
959  'default' => null,
960  'extra' => null,
961  ];
962  break;
963  default:
964  break;
965  }
966 
967  return $columns;
968  }
969 
976  public function getFlatIndexes()
977  {
978  $condition = $this->getUsedForSortBy();
979  if ($this->getFlatAddFilterableAttributes()) {
980  $condition = $condition || $this->getIsFilterable();
981  }
982 
983  if ($condition) {
984  if ($this->usesSource() && $this->getBackendType() != self::TYPE_STATIC) {
985  return $this->getSource()->getFlatIndexes();
986  }
987  $indexes = [];
988 
989  switch ($this->getBackendType()) {
990  case 'static':
991  $describe = $this->_getResource()->describeTable($this->getBackend()->getTable());
992  if (!isset($describe[$this->getAttributeCode()])) {
993  break;
994  }
995  $indexDataTypes = [
996  'varchar',
997  'varbinary',
998  'char',
999  'date',
1000  'datetime',
1001  'timestamp',
1002  'time',
1003  'year',
1004  'enum',
1005  'set',
1006  'bit',
1007  'bool',
1008  'tinyint',
1009  'smallint',
1010  'mediumint',
1011  'int',
1012  'bigint',
1013  'float',
1014  'double',
1015  'decimal',
1016  ];
1017  $prop = $describe[$this->getAttributeCode()];
1018  if (in_array($prop['DATA_TYPE'], $indexDataTypes)) {
1019  $indexName = 'IDX_' . strtoupper($this->getAttributeCode());
1020  $indexes[$indexName] = ['type' => 'index', 'fields' => [$this->getAttributeCode()]];
1021  }
1022 
1023  break;
1024  case 'datetime':
1025  case 'decimal':
1026  case 'int':
1027  case 'varchar':
1028  $indexName = 'IDX_' . strtoupper($this->getAttributeCode());
1029  $indexes[$indexName] = ['type' => 'index', 'fields' => [$this->getAttributeCode()]];
1030  break;
1031  default:
1032  break;
1033  }
1034 
1035  return $indexes;
1036  }
1037 
1038  return [];
1039  }
1040 
1047  public function getFlatUpdateSelect($store = null)
1048  {
1049  if ($store === null) {
1050  foreach ($this->_storeManager->getStores() as $store) {
1051  $this->getFlatUpdateSelect($store->getId());
1052  }
1053 
1054  return $this;
1055  }
1056 
1057  if ($this->getBackendType() == self::TYPE_STATIC) {
1058  return null;
1059  }
1060 
1061  if ($this->usesSource()) {
1062  return $this->getSource()->getFlatUpdateSelect($store);
1063  }
1064 
1065  return $this->_getResource()->getFlatUpdateSelect($this, $store);
1066  }
1067 
1072  public function getIsUnique()
1073  {
1074  return $this->_getData(self::IS_UNIQUE);
1075  }
1076 
1083  public function setIsUnique($isUnique)
1084  {
1085  return $this->setData(self::IS_UNIQUE, $isUnique);
1086  }
1087 
1091  public function getFrontendClass()
1092  {
1093  return $this->_getData(self::FRONTEND_CLASS);
1094  }
1095 
1102  public function setFrontendClass($frontendClass)
1103  {
1104  return $this->setData(self::FRONTEND_CLASS, $frontendClass);
1105  }
1106 
1110  public function getFrontendInput()
1111  {
1112  return $this->_getData(self::FRONTEND_INPUT);
1113  }
1114 
1118  public function setFrontendInput($frontendInput)
1119  {
1120  return $this->setData(self::FRONTEND_INPUT, $frontendInput);
1121  }
1122 
1126  public function getIsRequired()
1127  {
1128  return $this->_getData(self::IS_REQUIRED);
1129  }
1130 
1134  public function setIsRequired($isRequired)
1135  {
1136  return $this->setData(self::IS_REQUIRED, $isRequired);
1137  }
1138 
1139  //@codeCoverageIgnoreEnd
1140 
1144  public function getOptions()
1145  {
1146  $options = $this->_getData(self::OPTIONS);
1147  if (!$options) {
1148  $options = $this->usesSource() ? $this->getSource()->getAllOptions() : [];
1149  }
1150 
1151  return $this->convertToObjects($options);
1152  }
1153 
1160  public function setOptions(array $options = null)
1161  {
1162  if ($options !== null) {
1163  $optionDataArray = [];
1164  foreach ($options as $option) {
1165  $optionData = $this->dataObjectProcessor->buildOutputDataArray(
1166  $option,
1167  \Magento\Eav\Api\Data\AttributeOptionInterface::class
1168  );
1169  $optionDataArray[] = $optionData;
1170  }
1171  $this->setData(self::OPTIONS, $optionDataArray);
1172  } else {
1173  $this->setData(self::OPTIONS, $options);
1174  }
1175 
1176  return $this;
1177  }
1178 
1185  protected function convertToObjects(array $options)
1186  {
1187  $dataObjects = [];
1188  foreach ($options as $option) {
1190  $optionDataObject = $this->optionDataFactory->create();
1191  $this->dataObjectHelper->populateWithArray(
1192  $optionDataObject,
1193  $option,
1194  \Magento\Eav\Api\Data\AttributeOptionInterface::class
1195  );
1196  $dataObjects[] = $optionDataObject;
1197  }
1198 
1199  return $dataObjects;
1200  }
1201 
1206  public function getIsUserDefined()
1207  {
1208  return $this->getData(self::IS_USER_DEFINED);
1209  }
1210 
1217  public function setIsUserDefined($isUserDefined)
1218  {
1219  return $this->setData(self::IS_USER_DEFINED, $isUserDefined);
1220  }
1221 
1225  public function getDefaultFrontendLabel()
1226  {
1227  return $this->_getData(self::FRONTEND_LABEL);
1228  }
1229 
1236  public function setDefaultFrontendLabel($defaultFrontendLabel)
1237  {
1238  return $this->setData(self::FRONTEND_LABEL, $defaultFrontendLabel);
1239  }
1240 
1244  public function getFrontendLabels()
1245  {
1246  if ($this->getData(self::FRONTEND_LABELS) == null) {
1247  $attributeId = $this->getAttributeId();
1248  $storeLabels = $this->_getResource()->getStoreLabelsByAttributeId($attributeId);
1249 
1250  $resultFrontedLabels = [];
1251  foreach ($storeLabels as $i => $label) {
1252  $frontendLabel = $this->frontendLabelFactory->create();
1253  $frontendLabel->setStoreId($i);
1254  $frontendLabel->setLabel($label);
1255  $resultFrontedLabels[] = $frontendLabel;
1256  }
1257  $this->setData(self::FRONTEND_LABELS, $resultFrontedLabels);
1258  }
1259  return $this->_getData(self::FRONTEND_LABELS);
1260  }
1261 
1268  public function setFrontendLabels(array $frontendLabels = null)
1269  {
1270  return $this->setData(self::FRONTEND_LABELS, $frontendLabels);
1271  }
1272 
1276  public function getNote()
1277  {
1278  return $this->_getData(self::NOTE);
1279  }
1280 
1287  public function setNote($note)
1288  {
1289  return $this->setData(self::NOTE, $note);
1290  }
1291 
1295  public function getSourceModel()
1296  {
1297  return $this->_getData(self::SOURCE_MODEL);
1298  }
1299 
1306  public function setSourceModel($sourceModel)
1307  {
1308  return $this->setData(self::SOURCE_MODEL, $sourceModel);
1309  }
1310 
1311  //@codeCoverageIgnoreEnd
1312 
1316  public function getValidationRules()
1317  {
1318  $rules = $this->_getData(self::VALIDATE_RULES);
1319  if (is_array($rules)) {
1320  return $rules;
1321  } elseif (!empty($rules)) {
1322  return $this->getSerializer()->unserialize($rules);
1323  }
1324 
1325  return [];
1326  }
1327 
1335  public function setValidationRules(array $validationRules = null)
1336  {
1337  return $this->setData(self::VALIDATE_RULES, $validationRules);
1338  }
1339 
1346  public function getExtensionAttributes()
1347  {
1349  if (!($extensionAttributes instanceof \Magento\Eav\Api\Data\AttributeExtensionInterface)) {
1351  $extensionAttributes = $this->eavExtensionFactory->create();
1353  }
1354  return $extensionAttributes;
1355  }
1356 
1364  public function setExtensionAttributes(\Magento\Eav\Api\Data\AttributeExtensionInterface $extensionAttributes)
1365  {
1366  return $this->_setExtensionAttributes($extensionAttributes);
1367  }
1368 
1373  public function __sleep()
1374  {
1375  return array_diff(
1376  parent::__sleep(),
1377  [
1378  '_eavConfig',
1379  '_eavTypeFactory',
1380  '_storeManager',
1381  '_resourceHelper',
1382  '_universalFactory',
1383  'optionDataFactory',
1384  'dataObjectProcessor',
1385  'dataObjectHelper',
1386  '_entity',
1387  '_backend',
1388  '_source',
1389  '_frontend',
1390  ]
1391  );
1392  }
1393 
1398  public function __wakeup()
1399  {
1400  parent::__wakeup();
1402  $this->_eavConfig = $objectManager->get(\Magento\Eav\Model\Config::class);
1403  $this->_eavTypeFactory = $objectManager->get(\Magento\Eav\Model\Entity\TypeFactory::class);
1404  $this->_storeManager = $objectManager->get(\Magento\Store\Model\StoreManagerInterface::class);
1405  $this->_resourceHelper = $objectManager->get(\Magento\Eav\Model\ResourceModel\Helper::class);
1406  $this->_universalFactory = $objectManager->get(\Magento\Framework\Validator\UniversalFactory ::class);
1407  $this->optionDataFactory = $objectManager->get(\Magento\Eav\Api\Data\AttributeOptionInterfaceFactory::class);
1408  $this->dataObjectProcessor = $objectManager->get(\Magento\Framework\Reflection\DataObjectProcessor::class);
1409  $this->dataObjectHelper = $objectManager->get(\Magento\Framework\Api\DataObjectHelper::class);
1410  }
1411 }
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\ResourceModel\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, \Magento\Eav\Api\Data\AttributeOptionInterfaceFactory $optionDataFactory, \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[], \Magento\Eav\Api\Data\AttributeExtensionFactory $eavExtensionFactory=null, FrontendLabelFactory $frontendLabelFactory=null)
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$objectManager
Definition: bootstrap.php:17
$optionData
$id
Definition: fieldset.phtml:14
$source
Definition: source.php:23
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
$storeManager
__()
Definition: __.php:13
$resource
Definition: bulk.php:12
$columns
Definition: default.phtml:15
$type
Definition: item.phtml:13
$label
Definition: details.phtml:21
$value
Definition: gender.phtml:16
setExtensionAttributes(\Magento\Eav\Api\Data\AttributeExtensionInterface $extensionAttributes)
$entity
Definition: element.phtml:22
if(!trim($html)) $alias
Definition: details.phtml:20
$entityTable
Definition: tablerates.php:11
$note
Definition: element.phtml:13
$i
Definition: gallery.phtml:31
$code
Definition: info.phtml:12
if(!isset($_GET['name'])) $name
Definition: log.php:14