예제 #1
0
 /**
  * @param array $scheduledEntity
  */
 protected function applyValueObject(array $scheduledEntity)
 {
     foreach ($scheduledEntity as $entity) {
         $className = get_class($entity);
         $classMetadata = $this->metadataFactory->getMetadataForClass($className);
         $this->applyEmbeddedValueToEntity($classMetadata->getEmbeddedClasses(), $entity);
     }
 }
예제 #2
0
 /**
  * @param LoadClassMetadataEventArgs $event
  */
 public function loadClassMetadata(LoadClassMetadataEventArgs $event)
 {
     $className = $event->getClassMetadata()->getName();
     $classMetadata = $this->metadataFactory->getMetadataForClass($className);
     /** @var \Sergiors\Taxonomy\Configuration\Metadata\EmbeddedMetadataInterface $embeddedMetadata */
     foreach ($classMetadata->getEmbeddedClasses() as $embeddedMetadata) {
         if ($embeddedMetadata->getColumnAttribute()) {
             $event->getClassMetadata()->mapField(['fieldName' => $embeddedMetadata->getPropertyName(), 'columnName' => $embeddedMetadata->getColumnAttribute()->name, 'type' => $embeddedMetadata->getColumnAttribute()->type]);
         }
     }
 }
예제 #3
0
 /**
  * @param LifecycleEventArgs $event
  */
 public function postLoad(LifecycleEventArgs $event)
 {
     $entity = $event->getObject();
     $classMetadata = $this->metadataFactory->getMetadataForClass(get_class($entity));
     foreach ($classMetadata->getEmbeddedClasses() as $propertyName => $embeddedMetadata) {
         if (!is_array($embeddedValue = $embeddedMetadata->getValue($entity))) {
             continue;
         }
         $embeddedObject = $this->getEmbeddedObject($embeddedMetadata, $embeddedValue);
         $embeddedMetadata->setValue($entity, $embeddedObject);
     }
 }