rsm = new ResultSetMapping;
$rsm->addEntityResult('AccountClientBundle:SearchQuestionConnect', 'c');
$rsm->addFieldResult('c', 'c_id', 'id');
$rsm->addFieldResult('c', 'c_distance', 'distance');
$rsm->addJoinedEntityResult('AccountClientBundle:SearchQuestionConnectPriceComment', 'sq', 'c', 'search_question_connect_id');
$rsm->addFieldResult('sq', 'sq_id', 'id');
$rsm->addMetaResult('sq', 'sq_search_question_connect_id', 'search_question_connect_id');
$q = $this->getEntityManager()->createNativeQuery("
SELECT
c.id AS c_id,
c.distance AS c_distance,
sq.id AS sq_id,
sq.search_question_connect_id AS sq_search_question_connect_id
FROM search_question_connects AS c
JOIN (SELECT * FROM search_question_connect_price_comments ORDER BY created_at DESC) AS sq ON (sq.search_question_connect_id=c.id)
WHERE
c.search_id = {$searchId}
AND c.status_bidder = 2
GROUP BY c.id
ORDER BY sq.created_at DESC
", $rsm);
$r = $q->getResult();
我们收到以下错误:
注意:未定义的索引:search_question_connect_id
任何人都知道导致此通知的原因是什么?