initializeReflection() public method

Initializes a new ClassMetadata instance that will hold the object-relational mapping metadata of the class with the given name.
public initializeReflection ( Doctrine\Common\Persistence\Mapping\ReflectionService $reflService ) : void
$reflService Doctrine\Common\Persistence\Mapping\ReflectionService The reflection service.
return void
示例#1
0
 public function getClassMetadata($class)
 {
     $metadata = new \Doctrine\ODM\CouchDB\Mapping\ClassMetadata($class);
     $metadata->initializeReflection(new RuntimeReflectionService());
     $metadata->wakeupReflection(new RuntimeReflectionService());
     return $metadata;
 }
示例#2
0
 public function setUp()
 {
     $this->type = 'Doctrine\\Tests\\ODM\\CouchDB\\UoWUser';
     $this->dm = \Doctrine\ODM\CouchDB\DocumentManager::create(array('dbname' => 'test'));
     $this->uow = new UnitOfWork($this->dm);
     $metadata = new \Doctrine\ODM\CouchDB\Mapping\ClassMetadata($this->type);
     $metadata->mapField(array('fieldName' => 'id', 'id' => true));
     $metadata->mapField(array('fieldName' => 'username', 'type' => 'string'));
     $metadata->idGenerator = \Doctrine\ODM\CouchDB\Mapping\ClassMetadata::IDGENERATOR_ASSIGNED;
     $metadata->initializeReflection(new RuntimeReflectionService());
     $metadata->wakeupReflection(new RuntimeReflectionService());
     $cmf = $this->dm->getClassMetadataFactory();
     $cmf->setMetadataFor($this->type, $metadata);
 }
 /**
  * @depends testClassName
  */
 public function testSerializeUnserializeSerializableObject()
 {
     $cm = new ClassMetadata("Doctrine\\Tests\\ODM\\CouchDB\\Mapping\\SerializableObject");
     $cm->initializeReflection(new RuntimeReflectionService());
     $cm->mapField(array('fieldName' => 'property', 'type' => 'integer'));
     // @TODO This is the only way the $reflFields property is initialized
     // as far as I understand the ClassMetadata code. This seems wrong to
     // call here, but otherwise the comparison fails. The $reflFields are
     // accesssed all over the code though – I guess there are some bugs
     // hidden here.
     $cm->wakeupReflection(new RuntimeReflectionService());
     // property based comparison
     $unserialized = unserialize(serialize($cm));
     $unserialized->wakeupReflection(new RuntimeReflectionService());
     $this->assertEquals($cm, $unserialized);
 }