GraphAware\Neo4j\OGM\Util\ClassUtils::getFullClassName PHP Метод

getFullClassName() публичный статический Метод

public static getFullClassName ( string $class, string $pointOfView ) : string
$class string
$pointOfView string
Результат string
    public static function getFullClassName($class, $pointOfView)
    {
        $expl = explode('\\', $class);
        if (1 === count($expl)) {
            $expl2 = explode('\\', $pointOfView);
            if (1 !== count($expl2)) {
                unset($expl2[count($expl2) - 1]);
                $class = sprintf('%s\\%s', implode('\\', $expl2), $class);
            }
        }
        if (!class_exists($class)) {
            throw new \RuntimeException(sprintf('The class "%s" could not be found', $class));
        }
        $reflClass = new \ReflectionClass($class);
        return $class;
    }

Usage Example

 public function create($class)
 {
     $reflectionClass = new \ReflectionClass($class);
     $annotation = $this->reader->getClassAnnotation($reflectionClass, RelationshipEntity::class);
     $entityIdMetadata = null;
     $startNodeMetadata = null;
     $endNodeMetadata = null;
     $propertiesMetadata = [];
     $startNodeKey = null;
     $endNodeKey = null;
     foreach ($reflectionClass->getProperties() as $reflectionProperty) {
         if (null === $entityIdMetadata && null !== ($idAnnotation = $this->reader->getPropertyAnnotation($reflectionProperty, GraphId::class))) {
             $entityIdMetadata = new EntityIdMetadata($reflectionProperty->getName(), $reflectionProperty, new IdAnnotationMetadata());
             continue;
         }
         if (null === $startNodeMetadata && null !== ($startAnnotation = $this->reader->getPropertyAnnotation($reflectionProperty, StartNode::class))) {
             $startNodeClass = ClassUtils::getFullClassName($startAnnotation->targetEntity, $class);
             $startNodeMetadata = $startNodeClass;
             $startNodeKey = $reflectionProperty->getName();
             continue;
         }
         if (null === $endNodeMetadata && null !== ($endAnnotation = $this->reader->getPropertyAnnotation($reflectionProperty, EndNode::class))) {
             $endNodeClass = ClassUtils::getFullClassName($endAnnotation->targetEntity, $class);
             $endNodeMetadata = $endNodeClass;
             $endNodeKey = $reflectionProperty->getName();
             continue;
         }
         if (null !== ($propertyAnnotation = $this->reader->getPropertyAnnotation($reflectionProperty, Property::class))) {
             $propertiesMetadata[] = new EntityPropertyMetadata($reflectionProperty->getName(), $reflectionProperty, $this->propertyAnnotationMetadataFactory->create($class, $reflectionProperty->getName()));
         }
     }
     return new RelationshipEntityMetadata($class, $reflectionClass, $annotation, $entityIdMetadata, $startNodeMetadata, $startNodeKey, $endNodeMetadata, $endNodeKey, $propertiesMetadata);
 }
All Usage Examples Of GraphAware\Neo4j\OGM\Util\ClassUtils::getFullClassName