当我在给定的部分中定义一个参数时,它会给我一个错误,即这个" tt"参数是undefine。我不知道是什么问题。它给了我这个错误
注意:未定义的属性:Doctrine \ ORM \ QueryBuilder :: $ SELECT u1.unitid,m1.id FROM ApiMapBundle:Mappaths m1 INNER JOIN ApiMapBundle:Unitids u1 WITH m1.refUnitids2 = u1.id OR m1.refUnitids1 = u1。 id WHERE m1.id =:tt
$cn=2;
$qb = $em->createQueryBuilder();
$query = $qb->select('u1.unitid','m1.id')
->from('ApiMapBundle:Mappaths', 'm1')
->join('ApiMapBundle:Unitids', 'u1', 'WITH', $qb->expr()->orX('m1.refUnitids2 = u1.id', 'm1.refUnitids1 = u1.id'))
->andWhere('m1.id=:tt')
->$qb->setParameter('tt', $cn)
->getQuery()
->getResult();
return $query;
任何想法?
答案 0 :(得分:0)
尝试从->$qb
->$qb->setParameter('tt', $cn)