У меня возникли проблемы с выполнением Doctrine DQL Query. Это ошибка, которую она мне дает.
Doctrine\Common\Annotations\AnnotationException: [Syntax Error] Expected PlainValue, got 'integer' at position 13 in property Base\Session::$lifetime. Мой код выглядит так:
 $query = $em->createQuery("SELECT s FROM Base\Session s WHERE s.session = \"$id\""); 
Где $ id – текущий session_id. Моя модель выглядит так:
 namespace Base; /** @Entity @Table(name="session") */ class Session extends Skeleton { /** * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ protected $id; /** @Column(length=32) */ protected $session; /** @Column(type=integer) */ protected $lifetime; /** @Column(type=integer) */ protected $modified; /** @Column(type="text") */ protected $data; } 
       У вас есть две ошибки:
В вашем запросе должны использоваться подготовленные инструкции, т. Е.
$ query = $ em-> createQuery ("SELECT s FROM Base \ Session s WHERE s.session =? 1"); $ query-> setParameter (1, $ id);