0

当我在给定部分定义一个参数时,它给我这个“tt”参数未定义的错误。我不知道是什么问题。它给了我这个错误

注意:未定义的属性: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;

任何想法?

4

1 回答 1

0

尝试->$qb->$qb->setParameter('tt', $cn)

于 2016-01-13T14:17:32.040 回答