Пример #1
0
 /**
  * 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);
     }
 }
Пример #2
0
 /**
  * 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);
     }
 }
Пример #3
0
 /**
  * @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));
     }
 }
Пример #4
0
 public function testGetSourceClassNameByOption()
 {
     $className = 'Foo\\Entity';
     $this->fieldMetadata->set('source_class_name', $className);
     $this->assertEquals($className, $this->fieldMetadata->getSourceClassName());
 }
Пример #5
0
 /**
  * {@inheritdoc}
  */
 public function supports($entity, FieldMetadata $metadata)
 {
     return $this->taggableHelper->isTaggable($entity) && $metadata->getSourceClassName() === 'Oro\\Bundle\\TagBundle\\Entity\\Tag';
 }