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


PHP MongoCollection::createDBRef方法代码示例

本文整理汇总了PHP中MongoCollection::createDBRef方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoCollection::createDBRef方法的具体用法?PHP MongoCollection::createDBRef怎么用?PHP MongoCollection::createDBRef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MongoCollection的用法示例。


在下文中一共展示了MongoCollection::createDBRef方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepareWriteData

 /**
  * Do any data prep tasks, such as converting Links to DBRefs.
  *
  * @param array $data
  *   The array of data.
  */
 protected function prepareWriteData(array &$data)
 {
     foreach ($data as $key => $value) {
         if (is_object($value) && $value instanceof Link) {
             $data[$key] = $this->collection->createDBRef($value->getTarget());
         }
     }
 }
开发者ID:xtfer,项目名称:vultan,代码行数:14,代码来源:Collection.php

示例2: testCreateDBRef

 public function testCreateDBRef()
 {
     $ref = $this->object->createDBRef(array('foo' => 'bar'));
     $this->assertEquals($ref, null);
     $arr = array('_id' => new MongoId());
     $ref = $this->object->createDBRef($arr);
     $this->assertNotNull($ref);
     $this->assertTrue(is_array($ref));
     $arr = array('_id' => 1);
     $ref = $this->object->createDBRef($arr);
     $this->assertNotNull($ref);
     $this->assertTrue(is_array($ref));
     $ref = $this->object->createDBRef(new MongoId());
     $this->assertNotNull($ref);
     $this->assertTrue(is_array($ref));
 }
开发者ID:salathe,项目名称:mongo-php-driver,代码行数:16,代码来源:MongoCollectionTest.php

示例3: createThreadMetadata

 /**
  * Sets the metadata array on the thread.
  *
  * By default, Mongo will not include "$db" when creating the participant
  * reference. We'll add that manually to be consistent with Doctrine.
  *
  * @param array &$thread
  */
 private function createThreadMetadata(array &$thread)
 {
     $metadata = array();
     $participantIds = array_keys($thread['datesOfLastMessageWrittenByOtherParticipant'] + $thread['datesOfLastMessageWrittenByParticipant'] + $thread['isDeletedByParticipant']);
     foreach ($participantIds as $participantId) {
         $meta = array('isDeleted' => false, 'participant' => $this->participantCollection->createDBRef(array('_id' => new \MongoId($participantId))) + array('$db' => (string) $this->participantCollection->db));
         if (isset($thread['isDeletedByParticipant'][$participantId])) {
             $meta['isDeleted'] = $thread['isDeletedByParticipant'][$participantId];
         }
         if (isset($thread['datesOfLastMessageWrittenByOtherParticipant'][$participantId])) {
             $meta['lastMessageDate'] = new \MongoDate($thread['datesOfLastMessageWrittenByOtherParticipant'][$participantId]);
         }
         if (isset($thread['datesOfLastMessageWrittenByParticipant'][$participantId])) {
             $meta['lastParticipantMessageDate'] = new \MongoDate($thread['datesOfLastMessageWrittenByParticipant'][$participantId]);
         }
         $metadata[] = $meta;
     }
     $thread['metadata'] = $metadata;
 }
开发者ID:gpuck,项目名称:FOSMessageBundle,代码行数:27,代码来源:MongoDBMigrateMetadataCommand.php

示例4: createDBRef

 /**
  * Wrapper method for MongoCollection::createDBRef().
  *
  * @see http://php.net/manual/en/mongocollection.createdbref.php
  * @param mixed $documentOrId
  * @return array
  */
 public function createDBRef($documentOrId)
 {
     return $this->mongoCollection->createDBRef($documentOrId);
 }
开发者ID:pmnyaga,项目名称:mongodb,代码行数:11,代码来源:Collection.php

示例5: doCreateDBRef

 protected function doCreateDBRef(array $a)
 {
     return $this->mongoCollection->createDBRef($a);
 }
开发者ID:rybakit,项目名称:mongodb,代码行数:4,代码来源:Collection.php


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