/** * @param string $className * * @return ReflectionClass[] */ private function getHierarchyClasses($className) { $classes = []; $parentClassName = $className; while ($parentClassName && ($currentClass = $this->reflectionService->getClass($parentClassName))) { $classes[] = $currentClass; $parentClassName = null; if ($parentClass = $currentClass->getParentClass()) { $parentClassName = $parentClass->getName(); } } return $classes; }
/** * @inheritdoc */ protected function wakeupReflection(ClassMetadata $class, ReflectionService $reflService) { $class->reflClass = $reflService->getClass($class->name); foreach ($class->fieldMappings as $fieldName => $mapping) { $class->reflFields[$fieldName] = $reflService->getAccessibleProperty($class->name, $fieldName); } }
protected function initializeReflection(ClassMetadata $class, ReflectionService $reflService) { $class->reflClass = $reflService->getClass($class->name); if ($class->reflClass) { foreach ($class->reflClass->getProperties() as $property) { $class->mapField(['fieldName' => $property->getName()]); } } }
/** * Restores some state that can not be serialized/unserialized. * * @param ReflectionService $reflService */ public function wakeupReflection(ReflectionService $reflService) { $this->reflClass = $reflService->getClass($this->name); $this->namespace = $reflService->getClassNamespace($this->name); $fieldNames = array_merge($this->getFieldNames(), $this->getAssociationNames()); foreach ($fieldNames as $fieldName) { $reflField = isset($this->mappings[$fieldName]['declared']) ? new ReflectionProperty($this->mappings[$fieldName]['declared'], $fieldName) : $this->reflClass->getProperty($fieldName); $reflField->setAccessible(true); $this->reflFields[$fieldName] = $reflField; } }
/** * Initializes a new ClassMetadata instance that will hold the object-relational mapping * metadata of the class with the given name. * * @param \Doctrine\Common\Persistence\Mapping\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); }
/** * Initializes a new ClassMetadata instance that will hold the object-relational mapping * metadata of the class with the given name. * * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService The reflection service. * * @return void */ public function initializeReflection($reflService) { $this->reflClass = $reflService->getClass($this->className); $this->className = $this->reflClass->getName(); // normalize classname }
/** * Initializes a new ClassMetadata instance that will hold the object-relational mapping * metadata of the class with the given name. * * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService The reflection service. * * @return void */ public function initializeReflection($reflService) { $this->reflClass = $reflService->getClass($this->name); $this->namespace = $reflService->getClassNamespace($this->name); if ($this->reflClass) { $this->name = $this->rootDocumentName = $this->reflClass->getName(); } }
/** * Initializes a new ClassMetadata instance that will hold the object-relational mapping * metadata of the class with the given name. * * @param \Doctrine\Common\Persistence\Mapping\ReflectionService $reflService The reflection service. */ public function initializeReflection($reflService) { $this->reflClass = $reflService->getClass($this->name); $this->namespace = $reflService->getClassNamespace($this->name); $this->xmlName = Inflector::xmlize($this->reflClass->getShortName()); if ($this->reflClass) { $this->name = $this->rootXmlEntityName = $this->reflClass->getName(); } }
/** * Initializes a new ClassMetadata instance that will hold the * object-relational mapping metadata of the class with the given name. * * @param ReflectionService $reflService */ public function initializeReflection(ReflectionService $reflService) { $this->reflClass = $reflService->getClass($this->name); $this->namespace = $reflService->getClassNamespace($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] = $reflService->getAccessibleProperty($this->name, $field); } }
/** * Restores some state that can not be serialized/unserialized. * * @param ReflectionService $reflService */ public function wakeupReflection(ReflectionService $reflService) { $this->reflClass = $reflService->getClass($this->name); $this->namespace = $reflService->getClassNamespace($this->name); foreach ($this->fieldMappings as $field => $mapping) { if (isset($mapping['declared'])) { $reflField = new ReflectionProperty($mapping['declared'], $field); } else { $reflField = $this->reflClass->getProperty($field); } $reflField->setAccessible(true); $this->reflFields[$field] = $reflField; } foreach ($this->fieldMappings as $field => $mapping) { if (isset($mapping['declared'])) { $reflField = new ReflectionProperty($mapping['declared'], $field); } else { $reflField = $this->reflClass->getProperty($field); } $reflField->setAccessible(true); $this->reflFields[$field] = $reflField; } }