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()); }
/** * @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]; }