/** * Prepare metadata field. * * @param FieldMetadata $fieldMetadata */ public function prepareFieldMetadataPropertyPath(FieldMetadata $fieldMetadata) { $className = $fieldMetadata->getSourceClassName(); $fieldName = $fieldMetadata->getSourceFieldName(); if ($this->isExtendField($className, $fieldName)) { $fieldMetadata->set('property_path', $fieldName); } }
/** * Prepare metadata field. * * @param FieldMetadata $fieldMetadata */ public function prepareFieldMetadataPropertyPath(FieldMetadata $fieldMetadata) { $className = $fieldMetadata->getSourceClassName(); $fieldName = $fieldMetadata->getSourceFieldName(); $extendConfig = $this->getFieldExtendConfig($className, $fieldName); if ($extendConfig && $extendConfig->is('is_extend')) { $fieldMetadata->set('property_path', $fieldName); $fieldMetadata->set('display', true); } }
/** * @param FieldMetadata $fieldMetadata * @return array */ protected function initFieldMetadataDefaultLabel(FieldMetadata $fieldMetadata) { if ($fieldMetadata->has('label')) { return; } $labelCode = 'label'; $className = $fieldMetadata->getSourceClassName(); $fieldName = $fieldMetadata->getSourceFieldName(); if (!$fieldMetadata->isDefinedBySourceEntity()) { $fieldName = null; if ($fieldMetadata->isCollection()) { $labelCode = 'plural_label'; } } $entityConfig = $this->entityConfigHelper->getConfig(self::CONFIG_ENTITY_SCOPE, $className, $fieldName); if ($entityConfig) { $fieldMetadata->set('label', $entityConfig->get($labelCode)); } }
public function testGetSourceClassNameByOption() { $className = 'Foo\\Entity'; $this->fieldMetadata->set('source_class_name', $className); $this->assertEquals($className, $this->fieldMetadata->getSourceClassName()); }
/** * {@inheritdoc} */ public function supports($entity, FieldMetadata $metadata) { return $this->taggableHelper->isTaggable($entity) && $metadata->getSourceClassName() === 'Oro\\Bundle\\TagBundle\\Entity\\Tag'; }