Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FieldEntityAttributesPool.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
14 {
18  private $attributesInstances = [];
19 
23  public function __construct(
24  array $attributesInstances = []
25  ) {
26  $this->attributesInstances = $attributesInstances;
27  }
28 
36  public function getEntityAttributesForEntityFromField(string $fieldName) : array
37  {
38  if (isset($this->attributesInstances[$fieldName])) {
39  return $this->attributesInstances[$fieldName]->getEntityAttributes();
40  } else {
41  throw new \LogicException(sprintf('There is no attrribute class assigned to field %1', $fieldName));
42  }
43  }
44 }