本文整理汇总了PHP中Doctrine\ORM\Mapping\ClassMetadataFactory::method方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassMetadataFactory::method方法的具体用法?PHP ClassMetadataFactory::method怎么用?PHP ClassMetadataFactory::method使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Mapping\ClassMetadataFactory
的用法示例。
在下文中一共展示了ClassMetadataFactory::method方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->metadataFactory = $this->getMock(ClassMetadataFactory::class);
$this->metadataFactory->method('hasMetadataFor')->will($this->returnValueMap([[DummyEntity::class, true], [DummyEmbeddable::class, true]]));
$this->metadataFactory->method('getMetadataFor')->will($this->returnValueMap([[DummyEntity::class, DummyEntity::getMetadata()], [DummyEmbeddable::class, DummyEmbeddable::getMetadata()]]));
$em = $this->getMock(EntityManagerInterface::class);
$em->method('getMetadataFactory')->willReturn($this->metadataFactory);
$this->entity = new DummyEntity();
$this->entity->setId(1);
$this->entity->setA('1a');
$this->entity->setB('1b');
$this->entity->setC('1c');
$d = new DummyEmbeddable();
$d->setX(1);
$d->setY(2);
$d->setZ(3);
$this->entity->setD($d);
$child = new DummyEntity();
$child->setId(2);
$child->setA('2a');
$child->setB('2b');
$child->setC('2c');
$d = new DummyEmbeddable();
$d->setX(21);
$d->setY(22);
$d->setZ(23);
$child->setD($d);
$this->entity->addChild($child);
$child = new DummyEntity();
$child->setId(3);
$child->setA('3a');
$child->setB('3b');
$child->setC('3c');
$d = new DummyEmbeddable();
$d->setX(31);
$d->setY(32);
$d->setZ(33);
$child->setD($d);
$this->entity->addChild($child);
$subchild = new DummyEntity();
$subchild->setId(4);
$subchild->setA('4a');
$subchild->setB('4b');
$subchild->setC('4c');
$d = new DummyEmbeddable();
$d->setX(41);
$d->setY(42);
$d->setZ(43);
$subchild->setD($d);
$child->addChild($subchild);
$this->normalizer = new DoctrineNormalizer(null, null, null, $em);
$propertyNormalizer = new PropertyNormalizer();
$serializer = new Serializer([$this->normalizer, $propertyNormalizer]);
$this->normalizer->setSerializer($serializer);
}