当前位置: 首页>>代码示例>>PHP>>正文


PHP ClassMetadataInfo::mapManyReference方法代码示例

本文整理汇总了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;
 }
开发者ID:Wizkunde,项目名称:mongodb-odm,代码行数:18,代码来源:DocumentGeneratorTest.php

示例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']);
 }
开发者ID:roed,项目名称:mongodb-odm,代码行数:9,代码来源:ClassMetadataTest.php

示例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();
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:10,代码来源:MappingsOverrideConfiguratorSpec.php


注:本文中的Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo::mapManyReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。