等于DQL查询

时间:2016-12-07 17:59:03

标签: php symfony doctrine-orm

我有以下查询应检查另一个实体的开始和结束日期,并将其与输入的开始和结束日期进行比较以创建实体的实例,但是它不会返回任何内容。

  public function createAction(Request $request)
{
    $entity = new Payrollperiod();
    $form = $this->createCreateForm($entity);
    $form->handleRequest($request);

    if ($form->isValid()) {

        $em = $this->getDoctrine()->getManager();
        $qb = $em->getRepository('comtwclagripayrollBundle:PayrollWeek')->createQueryBuilder('p');
            $qb->select('p')
            ->where('p.startDate = :entityStart')
            ->andWhere('p.endDate = :entityEnd')
            ->setParameter('entityStart',$entity->getstartDate())
            ->setParameter('entityEnd',$entity->getendDate())
            ->getQuery()
            ->getResult();

0 个答案:

没有答案