本文整理汇总了PHP中DocumentManager::getUnitOfWork方法的典型用法代码示例。如果您正苦于以下问题:PHP DocumentManager::getUnitOfWork方法的具体用法?PHP DocumentManager::getUnitOfWork怎么用?PHP DocumentManager::getUnitOfWork使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentManager
的用法示例。
在下文中一共展示了DocumentManager::getUnitOfWork方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Initializes a new <tt>DocumentRepository</tt>.
*
* @param DocumentManager $dm The DocumentManager to use.
* @param ClassMetadata $classMetadata The class descriptor.
*/
public function __construct($dm, Mapping\ClassMetadata $class)
{
$this->_documentName = $class->name;
$this->_dm = $dm;
$this->_unitOfWork = $this->_dm->getUnitOfWork();
$this->_hydrator = $this->_dm->getHydrator();
$this->_collection = $this->_dm->getDocumentCollection($class->name);
$this->_class = $class;
}
示例2: findOne
/**
* Find a single document with the given query and select fields.
*
* @param string $documentName The document to find.
* @param array $query The query criteria.
* @param array $select The fields to select
* @return object $document
*/
public function findOne(array $query = array(), array $select = array())
{
return $this->_dm->getUnitOfWork()->getDocumentPersister($this->_documentName)->load($query, $select);
}
示例3: findOneBy
/**
* Finds a single document by a set of criteria.
*
* @param array $criteria
* @return object
*/
public function findOneBy(array $criteria)
{
return $this->dm->getUnitOfWork()->getDocumentPersister($this->documentName)->load($criteria);
}