/**
  * @param LoadClassMetadataEventArgs $event
  * @param $valueObjectPropertyMetadata
  */
 private function addValueObjectFields(DoctrineOrmClassMetadata $classMetadata, PropertyMetadata $valueObjectPropertyMetadata)
 {
     $valueObjectClass = $valueObjectPropertyMetadata->getValueObjectClass();
     $fieldPrefix = $valueObjectPropertyMetadata->getFieldPrefix();
     $extraFields = $this->getValueObjectFieldMappings($valueObjectClass, $fieldPrefix);
     foreach ($extraFields as $fieldMapping) {
         $classMetadata->mapField($fieldMapping);
     }
 }
 private function synchronizeProperty($entity, PropertyMetadata $propertyMetadata, \ReflectionClass $entityReflectionClass)
 {
     $valueObjectClass = $propertyMetadata->getValueObjectClass();
     $valueObjectClassReflection = new \ReflectionClass($valueObjectClass);
     $valueObject = $this->createValueObject($valueObjectClass);
     foreach ($valueObjectClassReflection->getProperties() as $valueObjectProperty) {
         $valueObjectProperty->setAccessible(true);
         $entityPropertyName = $propertyMetadata->getFieldPrefix() . $valueObjectProperty->getName();
         $entityProperty = $entityReflectionClass->getProperty($entityPropertyName);
         $entityProperty->setAccessible(true);
         $entityPropertyValue = $entityProperty->getValue($entity);
         $valueObjectProperty->setValue($valueObject, $entityPropertyValue);
     }
     $propertyMetadata->setValue($entity, $valueObject);
 }