本文整理汇总了PHP中Doctrine\ORM\Mapping\ClassMetadata::wakeupReflection方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassMetadata::wakeupReflection方法的具体用法?PHP ClassMetadata::wakeupReflection怎么用?PHP ClassMetadata::wakeupReflection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Mapping\ClassMetadata
的用法示例。
在下文中一共展示了ClassMetadata::wakeupReflection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMetadata
/**
* @return ClassMetadata
*/
public static function getMetadata()
{
$metadata = new ClassMetadata(static::class);
$metadata->mapField(['fieldName' => 'x']);
$metadata->mapField(['fieldName' => 'y']);
$metadata->mapField(['fieldName' => 'z']);
$metadata->wakeupReflection(new RuntimeReflectionService());
return $metadata;
}
示例2: getMetadata
/**
* @return ClassMetadata
*/
public static function getMetadata()
{
$metadata = new ClassMetadata(static::class);
$metadata->setIdentifier(['id']);
$metadata->mapField(['fieldName' => 'id']);
$metadata->mapField(['fieldName' => 'a']);
$metadata->mapField(['fieldName' => 'b']);
$metadata->mapField(['fieldName' => 'c']);
$metadata->mapEmbedded(['fieldName' => 'd', 'class' => DummyEmbeddable::class, 'columnPrefix' => 'd']);
$metadata->mapManyToOne(['fieldName' => 'parent', 'targetEntity' => self::class, 'inversedBy' => 'children']);
$metadata->mapOneToMany(['fieldName' => 'children', 'targetEntity' => self::class, 'mappedBy' => 'parent']);
$metadata->wakeupReflection(new RuntimeReflectionService());
return $metadata;
}
示例3: setAssociationMappings
/**
* @param ClassMetadataInfo $metadata
* @param $configuration
*/
private function setAssociationMappings(ClassMetadataInfo $metadata, $configuration)
{
foreach (class_parents($metadata->getName()) as $parent) {
if (false === in_array($parent, $configuration->getMetadataDriverImpl()->getAllClassNames())) {
continue;
}
$parentMetadata = new ClassMetadata($parent, $configuration->getNamingStrategy());
// Wakeup Reflection
$parentMetadata->wakeupReflection($this->getReflectionService());
// Load Metadata
$configuration->getMetadataDriverImpl()->loadMetadataForClass($parent, $parentMetadata);
if (false === $this->isResource($parentMetadata)) {
continue;
}
if ($parentMetadata->isMappedSuperclass) {
foreach ($parentMetadata->getAssociationMappings() as $key => $value) {
if ($this->hasRelation($value['type'])) {
$metadata->associationMappings[$key] = $value;
}
}
}
}
}
示例4: wakeupReflection
/**
* Restores some state that can not be serialized/unserialized.
*
* @param DoctrineReflectionService $reflService
* @return void
*/
public function wakeupReflection($reflService)
{
parent::wakeupReflection($reflService);
$this->reflClass = new ClassReflection($this->name);
}
示例5: testWakeupReflectionWithEmbeddableAndStaticReflectionService
public function testWakeupReflectionWithEmbeddableAndStaticReflectionService()
{
$classMetadata = new ClassMetadata('Doctrine\\Tests\\ORM\\Mapping\\TestEntity1');
$classMetadata->mapEmbedded(array('fieldName' => 'test', 'class' => 'Doctrine\\Tests\\ORM\\Mapping\\TestEntity1', 'columnPrefix' => false));
$field = array('fieldName' => 'test.embeddedProperty', 'type' => 'string', 'originalClass' => 'Doctrine\\Tests\\ORM\\Mapping\\TestEntity1', 'declaredField' => 'test', 'originalField' => 'embeddedProperty');
$classMetadata->mapField($field);
$classMetadata->wakeupReflection(new StaticReflectionService());
$this->assertEquals(array('test' => null, 'test.embeddedProperty' => null), $classMetadata->getReflectionProperties());
}