本文整理匯總了PHP中Doctrine\ODM\PHPCR\DocumentManager::createPhpcrQueryBuilder方法的典型用法代碼示例。如果您正苦於以下問題:PHP DocumentManager::createPhpcrQueryBuilder方法的具體用法?PHP DocumentManager::createPhpcrQueryBuilder怎麽用?PHP DocumentManager::createPhpcrQueryBuilder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\ODM\PHPCR\DocumentManager
的用法示例。
在下文中一共展示了DocumentManager::createPhpcrQueryBuilder方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createQuery
/**
* Create a Query
*
* @param string $statement the SQL2 statement
* @param string $language (see QueryInterface for list of supported types)
* @param bool $replaceWithFieldnames if * should be replaced with field names automatically
*
* @return Query
*/
public function createQuery($statement, $language, $options = 0)
{
// TODO: refactor this to use the odm query builder
$qb = $this->dm->createPhpcrQueryBuilder()->setFromQuery($statement, $language);
if ($options & self::QUERY_REPLACE_WITH_FIELDNAMES) {
$columns = $qb->getColumns();
if (1 === count($columns)) {
$column = reset($columns);
if ('*' === $column->getColumnName() && null == $column->getPropertyName()) {
$qb->setColumns(array());
foreach ($this->class->getFieldNames() as $name) {
$qb->addSelect('a', $name);
}
}
}
}
$factory = $qb->getQOMFactory();
$comparison = $factory->comparison($factory->propertyValue('a', 'phpcr:class'), Constants::JCR_OPERATOR_EQUAL_TO, $factory->literal($this->className));
$qb->andWhere($comparison);
return new Query($qb->getQuery(), $this->getDocumentManager());
}