本文整理汇总了PHP中Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo::mapManyReference方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassMetadataInfo::mapManyReference方法的具体用法?PHP ClassMetadataInfo::mapManyReference怎么用?PHP ClassMetadataInfo::mapManyReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo
的用法示例。
在下文中一共展示了ClassMetadataInfo::mapManyReference方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateBookDocumentFixture
public function generateBookDocumentFixture()
{
$metadata = new ClassMetadataInfo($this->namespace . '\\DocumentGeneratorBook');
$metadata->namespace = $this->namespace;
$metadata->customRepositoryClassName = $this->namespace . '\\DocumentGeneratorBookRepository';
$metadata->collection = 'book';
$metadata->mapField(array('fieldName' => 'name', 'type' => 'string'));
$metadata->mapField(array('fieldName' => 'status', 'type' => 'string'));
$metadata->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
$metadata->mapOneReference(array('fieldName' => 'author', 'targetDocument' => 'Doctrine\\ODM\\MongoDB\\Tests\\Tools\\DocumentGeneratorAuthor'));
$metadata->mapManyReference(array('fieldName' => 'comments', 'targetDocument' => 'Doctrine\\ODM\\MongoDB\\Tests\\Tools\\DocumentGeneratorComment'));
$metadata->mapManyReference(array('fieldName' => 'searches', 'targetDocument' => 'Doctrine\\ODM\\MongoDB\\Tests\\Tools\\DocumentGeneratorSearch'));
$metadata->addLifecycleCallback('loading', 'postLoad');
$metadata->addLifecycleCallback('willBeRemoved', 'preRemove');
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_CUSTOM);
$this->generator->writeDocumentClass($metadata, $this->tmpDir);
return $metadata;
}
示例2: testOwningSideAndInverseSide
public function testOwningSideAndInverseSide()
{
$cm = new ClassMetadataInfo('Documents\\User');
$cm->mapManyReference(array('fieldName' => 'articles', 'inversedBy' => 'user'));
$this->assertTrue($cm->fieldMappings['articles']['isOwningSide']);
$cm = new ClassMetadataInfo('Documents\\Article');
$cm->mapOneReference(array('fieldName' => 'user', 'mappedBy' => 'articles'));
$this->assertTrue($cm->fieldMappings['user']['isInverseSide']);
}
示例3: ClassMetadataInfo
function it_configures_the_mappings_of_an_original_model_that_is_override($configuration)
{
$metadataInfo = new ClassMetadataInfo('Foo\\Bar\\OriginalQux');
$metadataInfo->mapOneReference(['fieldName' => 'relation1', 'targetEntity' => 'Foo']);
$metadataInfo->mapManyReference(['fieldName' => 'relation2', 'targetEntity' => 'Foo']);
$metadataInfo->mapOneEmbedded(['fieldName' => 'relation3', 'targetEntity' => 'Foo', 'mappedBy' => 'baz']);
$metadataInfo->mapManyEmbedded(['fieldName' => 'relation4', 'targetEntity' => 'Foo']);
$overrides = [['original' => 'Foo\\Bar\\OriginalQux', 'override' => 'Acme\\Bar\\OverrideQux'], ['original' => 'Foo\\Baz\\OriginalQux', 'override' => 'Acme\\Baz\\OverrideQux']];
$this->configure($metadataInfo, $overrides, $configuration)->shouldBeAnOverrideModel();
}