本文整理匯總了PHP中DocumentManager::createQuery方法的典型用法代碼示例。如果您正苦於以下問題:PHP DocumentManager::createQuery方法的具體用法?PHP DocumentManager::createQuery怎麽用?PHP DocumentManager::createQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DocumentManager
的用法示例。
在下文中一共展示了DocumentManager::createQuery方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testQueryLimit
public function testQueryLimit()
{
$query = $this->dm->createQuery('SELECT * FROM [nt:unstructured] WHERE ISCHILDNODE("/functional") ORDER BY username', \PHPCR\Query\QueryInterface::JCR_SQL2);
$this->assertInstanceOf('PHPCR\\Query\\QueryInterface', $query);
$query->setLimit(2);
$result = $this->dm->getDocumentsByQuery($query, $this->type);
$this->assertCount(2, $result);
$ids = array();
$vals = array();
$nums = array();
foreach ($result as $obj) {
$this->assertInstanceOf('Doctrine\\Tests\\ODM\\PHPCR\\Functional\\QuerySql2TestObj', $obj);
$ids[] = $obj->id;
$vals[] = $obj->username;
$this->assertInstanceOf('Doctrine\\Common\\Collections\\Collection', $obj->numbers);
$nums[] = $obj->numbers->toArray();
}
$this->assertEquals(array('/functional/node5', '/functional/node1'), $ids);
$this->assertEquals(array(null, 'dbu'), $vals);
$this->assertEquals(array(array(3, 1, 2), array(3, 1, 2)), $nums);
}
示例2: createQuery
/**
* Create a new QueryBuilder instance that is prepopulated for this document name
*
* @return QueryBuilder $qb
*/
public function createQuery()
{
return $this->_dm->createQuery()->from($this->_documentName);
}
示例3: createQuery
/**
* Create a new Query instance that is prepopulated for this document name
*
* @return Query $qb
*/
public function createQuery()
{
return $this->dm->createQuery()->find($this->documentName);
}