本文整理汇总了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);
}