create() публичный Метод

public create ( string $className ) : NodeEntityMetadata | RelationshipEntityMetadata
$className string
Результат GraphAware\Neo4j\OGM\Metadata\NodeEntityMetadata | GraphAware\Neo4j\OGM\Metadata\RelationshipEntityMetadata
 public function testValueCanBeSetOnInstantiatedObject()
 {
     $entityMetadata = $this->entityMetadataFactory->create(Person::class);
     /** @var Person $o */
     $o = $entityMetadata->newInstance();
     $entityMetadata->getPropertyMetadata('name')->setValue($o, 'John');
     $this->assertEquals('John', $o->getName());
 }
Пример #2
0
 /**
  * @param string $class
  *
  * @throws \Exception
  *
  * @return RelationshipEntityMetadata
  */
 public function getRelationshipEntityMetadata($class)
 {
     if (!array_key_exists($class, $this->loadedMetadata)) {
         $metadata = $this->metadataFactory->create($class);
         if (!$metadata instanceof RelationshipEntityMetadata) {
             // $class is not an relationship entity
             throw new MappingException(sprintf('The class "%s" was configured to be an RelationshipEntity but no @OGM\\RelationshipEntity class annotation was found', $class));
         }
         $this->loadedMetadata[$class] = $metadata;
     }
     return $this->loadedMetadata[$class];
 }