protected function wakeupReflection(ClassMetadata $class, ReflectionService $reflService)
 {
     $class->reflClass = $reflService->getClass($class->name);
     foreach ($class->fields as $fieldName => $mapping) {
         $class->reflFields[$fieldName] = $reflService->getAccessibleProperty($class->name, $fieldName);
     }
 }
 /**
  * Restores some state that can not be serialized/unserialized.
  *
  * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService
  * @return void
  */
 public function wakeupReflection($reflService)
 {
     // Restore ReflectionClass and properties
     $this->reflClass = $reflService->getClass($this->name);
     foreach ($this->fieldMappings as $field => $mapping) {
         $this->reflFields[$field] = isset($mapping['declared']) ? $reflService->getAccessibleProperty($mapping['declared'], $field) : $reflService->getAccessibleProperty($this->name, $field);
     }
     foreach ($this->associationMappings as $field => $mapping) {
         $this->reflFields[$field] = isset($mapping['declared']) ? $reflService->getAccessibleProperty($mapping['declared'], $field) : $reflService->getAccessibleProperty($this->name, $field);
     }
 }
Example #3
0
 /**
  * Restores some state that can not be serialized/unserialized.
  *
  * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService
  *
  * @return void
  */
 public function wakeupReflection($reflService)
 {
     // Restore ReflectionClass and properties
     $this->reflClass = $reflService->getClass($this->className);
     foreach ($this->fieldMappings as $field => $mapping) {
         $this->reflFields[$field] = $reflService->getAccessibleProperty($this->className, $field);
     }
 }
 /**
  * Restores some state that can not be serialized/unserialized.
  *
  * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService
  *
  * @return void
  */
 public function wakeupReflection($reflService)
 {
     // Restore ReflectionClass and properties
     $this->reflClass = $reflService->getClass($this->name);
     $this->instantiator = $this->instantiator ?: new Instantiator();
     $parentReflFields = array();
     foreach ($this->embeddedClasses as $property => $embeddedClass) {
         if (isset($embeddedClass['declaredField'])) {
             $parentReflFields[$property] = new ReflectionEmbeddedProperty($parentReflFields[$embeddedClass['declaredField']], $reflService->getAccessibleProperty($this->embeddedClasses[$embeddedClass['declaredField']]['class'], $embeddedClass['originalField']), $this->embeddedClasses[$embeddedClass['declaredField']]['class']);
             continue;
         }
         $parentReflFields[$property] = $reflService->getAccessibleProperty($this->name, $property);
         $this->reflFields[$property] = $reflService->getAccessibleProperty($this->name, $property);
     }
     foreach ($this->fieldMappings as $field => $mapping) {
         if (isset($mapping['declaredField']) && isset($parentReflFields[$mapping['declaredField']])) {
             $this->reflFields[$field] = new ReflectionEmbeddedProperty($parentReflFields[$mapping['declaredField']], $reflService->getAccessibleProperty($mapping['originalClass'], $mapping['originalField']), $mapping['originalClass']);
             continue;
         }
         $this->reflFields[$field] = isset($mapping['declared']) ? $reflService->getAccessibleProperty($mapping['declared'], $field) : $reflService->getAccessibleProperty($this->name, $field);
     }
     foreach ($this->associationMappings as $field => $mapping) {
         $this->reflFields[$field] = isset($mapping['declared']) ? $reflService->getAccessibleProperty($mapping['declared'], $field) : $reflService->getAccessibleProperty($this->name, $field);
     }
 }
Example #5
0
 /**
  * Restores some state that can not be serialized/unserialized.
  *
  * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService
  *
  * @return void
  */
 public function wakeupReflection($reflService)
 {
     // Restore ReflectionClass and properties
     $this->reflClass = $reflService->getClass($this->name);
     foreach ($this->fieldMappings as $field => $mapping) {
         if (isset($mapping['declaredField'])) {
             $declaringClass = isset($this->embeddedClasses[$mapping['declaredField']]['declared']) ? $this->embeddedClasses[$mapping['declaredField']]['declared'] : $this->name;
             $this->reflFields[$field] = new ReflectionEmbeddedProperty($reflService->getAccessibleProperty($declaringClass, $mapping['declaredField']), $reflService->getAccessibleProperty($this->embeddedClasses[$mapping['declaredField']]['class'], $mapping['originalField']), $this->embeddedClasses[$mapping['declaredField']]['class']);
             continue;
         }
         $this->reflFields[$field] = isset($mapping['declared']) ? $reflService->getAccessibleProperty($mapping['declared'], $field) : $reflService->getAccessibleProperty($this->name, $field);
     }
     foreach ($this->associationMappings as $field => $mapping) {
         $this->reflFields[$field] = isset($mapping['declared']) ? $reflService->getAccessibleProperty($mapping['declared'], $field) : $reflService->getAccessibleProperty($this->name, $field);
     }
 }
 /**
  * @param ReflectionProperty $property
  *
  * @return null|ReflectionProperty
  */
 private function getAccessibleProperty(ReflectionProperty $property)
 {
     return $this->reflectionService->getAccessibleProperty($property->getDeclaringClass()->getName(), $property->getName());
 }
 protected function resurrect(\ReflectionProperty $property, ReflectionService $reflectionService)
 {
     return $reflectionService->getAccessibleProperty($property->class, $property->name);
 }
 /**
  * Restores some state that can not be serialized/unserialized.
  *
  * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService
  */
 public function wakeupReflection($reflService)
 {
     foreach ($this->fieldMappings as $field => $mapping) {
         $this->reflFields[$field] = isset($mapping['declared']) ? $reflService->getAccessibleProperty($mapping['declared'], $field) : $reflService->getAccessibleProperty($this->name, $field);
     }
 }
 /** {@inheritdoc} */
 public function wakeupReflection(ReflectionService $reflService)
 {
     // Restore ReflectionClass and properties
     $this->reflClass = $reflService->getClass($this->name);
     $this->instantiator = $this->instantiator ?: new Instantiator();
     foreach ($this->fields as $field => $mapping) {
         $class = array_key_exists('declared', $mapping) ? $mapping['declared'] : $this->name;
         $this->reflFields[$field] = $reflService->getAccessibleProperty($class, $field);
     }
     foreach ($this->associations as $field => $mapping) {
         $class = array_key_exists('declared', $mapping) ? $mapping['declared'] : $this->name;
         $this->reflFields[$field] = $reflService->getAccessibleProperty($class, $field);
     }
 }