我有以下节点:
/
/applications
/applications/1
/applications/1/pages [contains Page documents]
我想选择Page
节点内的所有文档/applications/1
。我使用以下方法来做到这一点(这似乎是正确的),但它会引发错误:
$qb = $this->dm->createQueryBuilder();
$qb->from()->document('Mango\CoreDomainBundle\Document\Page', 'page');
// I want to select the pages which are a child of /applications/1
$qb->where()->child('/applications/1', 'application');
$qb->getQuery()->execute();
当我执行此操作时,它会引发以下错误:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'n1.id' in 'field list'
这是发送回数据库的 SQL 查询:
SELECT
n0.id AS n0_id,
n0.path AS n0_path,
n0.parent AS n0_parent,
n0.local_name AS n0_local_name,
n0.namespace AS n0_namespace,
n0.workspace_name AS n0_workspace_name,
n0.identifier AS n0_identifier,
n0.type AS n0_type,
n0.props AS n0_props,
n0.depth AS n0_depth,
n0.sort_order AS n0_sort_order,
n1.id AS n1_id,
n1.path AS n1_path,
n1.parent AS n1_parent,
n1.local_name AS n1_local_name,
n1.namespace AS n1_namespace,
n1.workspace_name AS n1_workspace_name,
n1.identifier AS n1_identifier,
n1.type AS n1_type,
n1.props AS n1_props,
n1.depth AS n1_depth,
n1.sort_order AS n1_sort_order
FROM
phpcr_nodes n0
WHERE
n0.workspace_name = 'mango'
AND n0.type IN ('nt:unstructured' , 'rep:root')
AND (n1.parent = 'applications/1'
AND (EXTRACTVALUE(n0.props,
'count(//sv:property[@sv:name="phpcr:class"]/sv:value[text()="Mango\CoreDomainBundle\Document\Page"]) > 0')
OR EXTRACTVALUE(n0.props,
'count(//sv:property[@sv:name="phpcr:classparents"]/sv:value[text()="Mango\CoreDomainBundle\Document\Page"]) > 0')))
我希望有人可以帮助我!谢谢!