Invalid PathExpression. Must be a StateFieldPathExpression

前端 未结 1 468
谎友^
谎友^ 2021-01-29 10:13

I get an error which is [Semantical Error] line 0, col 57 near \'room FROM AppBundle:bookings\': Error: Invalid PathExpression. Must be a StateFieldPathExpression.

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-29 10:36

    I think the problem is about the WHERE NOT. try with this query:

    $query = $em->createQuery(
                                'SELECT r ' .
                                'FROM AppBundle:Room r ' .
                                'WHERE r NOT IN ( ' .
                                'SELECT b.room ' .
                                'FROM AppBundle:Bookings b ' .
                                'WHERE  ' .
                                'b.check_out < :check_in ' .
                                'OR ' .
                                'b.check_in > :check_out ' .
                                ') ' .
                                'ORDER BY r.id'
                        )
                        ->setParameter('check_in', $request->query->get('check-in'))
                        ->setParameter('check_out', $request->query->get('check-out'));
    

    0 讨论(0)
提交回复
热议问题