Example #1
0
 /**
  * @param EntityMetadataEvent $event
  */
 public function onCreateMetadata(EntityMetadataEvent $event)
 {
     $entityMetadata = $event->getEntityMetadata();
     foreach ($entityMetadata->getFieldsMetadata() as $fieldMetadata) {
         $this->initMergeModes($fieldMetadata);
     }
 }
 /**
  * @param EntityMetadataEvent $event
  */
 public function onCreateMetadata(EntityMetadataEvent $event)
 {
     $entityMetadata = $event->getEntityMetadata();
     $this->applyEntityMetadataConfig($entityMetadata);
     foreach ($entityMetadata->getFieldsMetadata() as $fieldMetadata) {
         $this->applyFieldMetadataConfig($fieldMetadata);
     }
 }
Example #3
0
 /**
  * @param EntityMetadataEvent $event
  */
 public function onBuildMetadata(EntityMetadataEvent $event)
 {
     $entityMetadata = $event->getEntityMetadata();
     if ($this->isApplicableNoteActivity($entityMetadata)) {
         $fieldMetadataOptions = ['display' => true, 'activity' => true, 'template' => 'OroActivityListBundle:Merge:value.html.twig', 'type' => Note::ENTITY_NAME, 'field_name' => $this->getNoteFieldName($entityMetadata), 'is_collection' => true, 'label' => $this->translator->trans($this->getNoteAlias()), 'merge_modes' => [MergeModes::NOTES_UNITE, MergeModes::NOTES_REPLACE]];
         $fieldMetadata = new FieldMetadata($fieldMetadataOptions);
         $entityMetadata->addFieldMetadata($fieldMetadata);
     }
 }
Example #4
0
 /**
  * @param EntityMetadataEvent $event
  */
 public function onBuildMetadata(EntityMetadataEvent $event)
 {
     $entityMetadata = $event->getEntityMetadata();
     $types = $this->getAvailableActivityTypes($entityMetadata);
     foreach ($types as $type) {
         $fieldMetadataOptions = ['display' => true, 'activity' => true, 'type' => $type, 'field_name' => $this->getFieldNameByActivityClassName($type), 'template' => 'OroActivityListBundle:Merge:value.html.twig', 'is_collection' => true, 'label' => $this->translator->trans($this->getAliasByActivityClass($type)), 'merge_modes' => [MergeModes::ACTIVITY_UNITE, MergeModes::ACTIVITY_REPLACE]];
         $fieldMetadata = new FieldMetadata($fieldMetadataOptions);
         $entityMetadata->addFieldMetadata($fieldMetadata);
     }
 }
Example #5
0
 /**
  * Add merge metadata for tags
  *
  * @param EntityMetadataEvent $event
  */
 public function onBuildMetadata(EntityMetadataEvent $event)
 {
     $entityMetadata = $event->getEntityMetadata();
     if (!$this->isTaggable($entityMetadata)) {
         return;
     }
     $fieldMetadataOptions = ['source_class_name' => 'Oro\\Bundle\\TagBundle\\Entity\\Tag', 'display' => true, 'field_name' => self::FIELD_NAME, 'is_collection' => true, 'label' => 'oro.tag.entity_plural_label', 'merge_modes' => [MergeModes::REPLACE, MergeModes::UNITE]];
     $fieldMetadata = new FieldMetadata($fieldMetadataOptions);
     $entityMetadata->addFieldMetadata($fieldMetadata);
 }
 /**
  * @param EntityMetadataEvent $event
  */
 public function onCreateMetadata(EntityMetadataEvent $event)
 {
     $entityMetadata = $event->getEntityMetadata();
     $className = $entityMetadata->getClassName();
     $entityConfig = $this->entityConfigHelper->getConfig(self::CONFIG_ENTITY_SCOPE, $className, null);
     if ($entityConfig && !$entityMetadata->has('label')) {
         $entityMetadata->set('label', $entityConfig->get('plural_label'));
     }
     foreach ($entityMetadata->getFieldsMetadata() as $fieldMetadata) {
         $this->initFieldMetadataDefaultLabel($fieldMetadata);
     }
 }
 public function testGetEntityData()
 {
     $this->assertEquals($this->entityMetadata, $this->event->getEntityMetadata());
 }