本文整理匯總了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;
}