/**
  * Initializes a new ClassMetadata instance that will hold the object-relational mapping
  * metadata of the class with the given name.
  *
  * @param ReflectionService $reflService The reflection service.
  */
 public function initializeReflection($reflService)
 {
     $this->reflClass = $reflService->getClass($this->name);
     $this->namespace = $reflService->getClassNamespace($this->name);
     if ($this->reflClass) {
         $this->name = $this->rootEntityName = $this->reflClass->getName();
     }
     $this->table['name'] = $this->namingStrategy->classToTableName($this->name);
 }
 /**
  * Restores some state that can not be serialized/unserialized.
  *
  * @param 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);
     }
 }