我收到此错误[语义错误]第0行,第102行附近' pw WHERE pw.startdate':错误:' pw'已定义。这就是我所拥有的:
public function findBystartdateAndenddate($startdate, $enddate)
{
return $this
->createQueryBuilder('pw')
->select('pw')
->from ('comtwclagripayrollBundle:Payrollweek','pw')
->where ('pw.startdate = :startdate and pw.enddate = :enddate')
->setParameter('startdate', $startdate)
->setParameter('enddate', $enddate)
->getQuery()
->getResult();
答案 0 :(得分:1)
->from ('comtwclagripayrollBundle:Payrollweek')
这应该工作
答案 1 :(得分:1)
<ListView fx:id="listView" prefHeight="${listView.parent.width}"/>
如果你想尝试DQL:
->from ('comtwclagripayrollBundle:Payrollweek')
答案 2 :(得分:1)
你可以试试这个:
您的错误是(pw
和->createQueryBuilder('pw')
)
->from ('comtwclagripayrollBundle:Payrollweek','pw')
public function findBystartdateAndenddate($startdate, $enddate)
{
return $this
->createQueryBuilder('pw')
->select('pw')
->where ('pw.startdate = :startdate')
->andWhere('pw.enddate = :enddate')
->setParameter('startdate', $startdate)
->setParameter('enddate', $enddate)
->getQuery()
->getResult();
}
您也可以在Controller
来电标准f.e:
$this->getDoctrine()->getRepository('YourFooBundle:YourEntity')->findBy(array('startdate' => $startdate, 'enddate' => $enddate));
答案 3 :(得分:0)
请删除->from ('comtwclagripayrollBundle:Payrollweek','pw')
。因为您已经可以使用->createQueryBuilder('pw')
为当前存储库
public function findBystartdateAndenddate($startdate, $enddate)
{
return $this
->createQueryBuilder('pw')
->select('pw')
->where ('startdate = :startdate and enddate = :enddate')
->setParameter('startdate', $startdate)
->setParameter('enddate', $enddate)
->getQuery()
->getResult();