本文整理汇总了PHP中Doctrine\ODM\MongoDB\Mapping\ClassMetadata::getCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassMetadata::getCollection方法的具体用法?PHP ClassMetadata::getCollection怎么用?PHP ClassMetadata::getCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ODM\MongoDB\Mapping\ClassMetadata
的用法示例。
在下文中一共展示了ClassMetadata::getCollection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fromDocument
/**
* @param ClassMetadata $classMetadata
* @return $this
*
* @throws MappingException
*/
private function fromDocument(ClassMetadata $classMetadata)
{
if ($classMetadata->isSharded()) {
throw MappingException::cannotUseShardedCollectionInOutStage($classMetadata->name);
}
return parent::out($classMetadata->getCollection());
}
示例2: testDocumentCollectionNameAndInheritance
/**
* @depends testLoadMapping
* @param ClassMetadata $class
*/
public function testDocumentCollectionNameAndInheritance($class)
{
$this->assertEquals('cms_users', $class->getCollection());
$this->assertEquals(ClassMetadata::INHERITANCE_TYPE_NONE, $class->inheritanceType);
return $class;
}
示例3: _prepareDocReference
/**
* Returns the reference representation to be stored in mongodb or null if not applicable.
*
* @param ClassMetadata $class
* @param Document $doc
* @return array|null
*/
private function _prepareDocReference(ClassMetadata $class, $doc)
{
if (!is_object($doc)) {
return $doc;
}
$id = $this->_uow->getDocumentIdentifier($doc);
if (null !== $id) {
$id = $class->getPHPIdentifierValue($id);
}
$ref = array($this->_cmd . 'ref' => $class->getCollection(), $this->_cmd . 'id' => $id, $this->_cmd . 'db' => $class->getDB());
return $ref;
}
示例4: _prepareDocReference
/**
* Returns the reference representation to be stored in mongodb or null if not applicable.
*
* @param ClassMetadata $class
* @param Document $doc
* @return array|null
*/
private function _prepareDocReference(ClassMetadata $class, $doc)
{
if (!is_object($doc)) {
return $doc;
}
$id = $this->_uow->getDocumentIdentifier($doc);
$ref = array('$ref' => $class->getCollection(), '$id' => $id, '$db' => $class->getDB());
return $ref;
}
示例5: _prepareDocReference
/**
* returns the reference representation to be stored in mongodb
* or null if not applicable
* @param ClassMetadata $class
* @param Document $doc
* @return array|null
*/
private function _prepareDocReference($class, $doc)
{
$docOid = spl_object_hash($doc);
if (isset($this->_documentIdentifiers[$docOid])) {
$id = $this->_documentIdentifiers[$docOid];
$ref = array('$ref' => $class->getCollection(), '$id' => $id, '$db' => $class->getDB());
return $ref;
}
return null;
}