Example #1
0
 /**
  * {@inheritdoc}
  */
 public function getCustomAttributesMetadata($dataObjectClassName = self::DATA_OBJECT_CLASS_NAME)
 {
     $customAttributes = [];
     foreach ($this->getCategoryAttributesMetadata(MetadataServiceInterface::DEFAULT_ATTRIBUTE_SET_ID) as $attributeMetadata) {
         $customAttributes[] = $attributeMetadata;
     }
     return array_merge($customAttributes, $this->metadataConfig->getCustomAttributesMetadata($dataObjectClassName));
 }
 /**
  * {@inheritdoc}
  */
 public function getCustomAttributesMetadata($dataObjectClassName = self::DATA_OBJECT_CLASS_NAME)
 {
     $customAttributes = [];
     if (!$this->addressDataObjectMethods) {
         $this->addressDataObjectMethods = array_flip(get_class_methods($dataObjectClassName));
     }
     foreach ($this->getAllAttributesMetadata() as $attributeMetadata) {
         $attributeCode = $attributeMetadata->getAttributeCode();
         $camelCaseKey = \Magento\Framework\Service\SimpleDataObjectConverter::snakeCaseToCamelCase($attributeCode);
         $isDataObjectMethod = isset($this->addressDataObjectMethods['get' . $camelCaseKey]) || isset($this->addressDataObjectMethods['is' . $camelCaseKey]);
         if (!$isDataObjectMethod && !$attributeMetadata->isSystem()) {
             $customAttributes[] = $attributeMetadata;
         }
     }
     return array_merge($customAttributes, $this->metadataConfig->getCustomAttributesMetadata($dataObjectClassName));
 }
 /**
  * {@inheritdoc}
  */
 public function getCustomAttributesMetadata($dataObjectClassName = self::DATA_OBJECT_CLASS_NAME)
 {
     $customAttributes = [];
     if (!$this->customerDataObjectMethods) {
         $this->customerDataObjectMethods = array_flip(get_class_methods($dataObjectClassName));
     }
     foreach ($this->getAllAttributesMetadata() as $attributeMetadata) {
         $attributeCode = $attributeMetadata->getAttributeCode();
         $camelCaseKey = \Magento\Framework\Service\SimpleDataObjectConverter::snakeCaseToCamelCase($attributeCode);
         $isDataObjectMethod = isset($this->customerDataObjectMethods['get' . $camelCaseKey]) || isset($this->customerDataObjectMethods['is' . $camelCaseKey]);
         /** Even though disable_auto_group_change is system attribute, it should be available to the clients */
         if (!$isDataObjectMethod && (!$attributeMetadata->isSystem() || $attributeCode == 'disable_auto_group_change')) {
             $customAttributes[] = $attributeMetadata;
         }
     }
     return array_merge($customAttributes, $this->metadataConfig->getCustomAttributesMetadata($dataObjectClassName));
 }