Doctrine\ODM\PHPCR\Mapping\ClassMetadata::getReflectionProperties PHP 메소드

getReflectionProperties() 공개 메소드

Gets the ReflectionProperties of the mapped class.
public getReflectionProperties ( ) : array
리턴 array An array of \ReflectionProperty instances.
    public function getReflectionProperties()
    {
        return $this->reflFields;
    }

Usage Example

예제 #1
0
 public function testClassMetadataInstanceSerialization()
 {
     $cm = new ClassMetadata('Doctrine\\Tests\\Models\\CMS\\CmsUser');
     $cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService());
     // Test initial state
     $this->assertTrue(count($cm->getReflectionProperties()) == 0);
     $this->assertInstanceOf('ReflectionClass', $cm->reflClass);
     $this->assertEquals('Doctrine\\Tests\\Models\\CMS\\CmsUser', $cm->name);
     $this->assertEquals(array(), $cm->parentClasses);
     $this->assertEquals(0, count($cm->referenceMappings));
     // Customize state
     $cm->setParentClasses(array("UserParent"));
     $cm->setCustomRepositoryClassName("CmsUserRepository");
     $cm->setNodeType('foo:bar');
     $cm->mapManyToOne(array('fieldName' => 'address', 'targetDocument' => 'CmsAddress', 'mappedBy' => 'foo'));
     $this->assertEquals(1, count($cm->referenceMappings));
     $serialized = serialize($cm);
     /** @var ClassMetadata $cm */
     $cm = unserialize($serialized);
     $cm->wakeupReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService());
     // Check state
     $this->assertTrue(count($cm->getReflectionProperties()) > 0);
     $this->assertEquals('Doctrine\\Tests\\Models\\CMS', $cm->namespace);
     $this->assertInstanceOf('ReflectionClass', $cm->reflClass);
     $this->assertEquals('Doctrine\\Tests\\Models\\CMS\\CmsUser', $cm->name);
     $this->assertEquals(array('UserParent'), $cm->parentClasses);
     $this->assertEquals('Doctrine\\Tests\\Models\\CMS\\CmsUserRepository', $cm->customRepositoryClassName);
     $this->assertEquals('foo:bar', $cm->getNodeType());
     $this->assertEquals(ClassMetadata::MANY_TO_ONE, $cm->getTypeOfField('address'));
     $this->assertEquals(1, count($cm->referenceMappings));
     $this->assertTrue($cm->hasAssociation('address'));
     $this->assertEquals('Doctrine\\Tests\\Models\\CMS\\CmsAddress', $cm->getAssociationTargetClass('address'));
 }
ClassMetadata