_getTestEntityManager(); $metadataFactory = $em->getMetadataFactory(); $evm = $em->getEventManager(); $evm->addEventListener(Events::loadClassMetadata, $this); $classMetadata = $metadataFactory->getMetadataFor('Doctrine\Tests\ORM\Mapping\LoadEventTestEntity'); $this->assertTrue($classMetadata->hasField('about')); } public function loadClassMetadata(\Doctrine\ORM\Event\LoadClassMetadataEventArgs $eventArgs) { $classMetadata = $eventArgs->getClassMetadata(); $field = array( 'fieldName' => 'about', 'type' => 'string', 'length' => 255 ); $classMetadata->mapField($field); } } /** * @Entity * @Table(name="load_event_test_entity") */ class LoadEventTestEntity { /** * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ private $id; /** * @Column(type="string", length=255) */ private $name; private $about; }