'Doctrine2 Criteria convert 1 to TRUE
I've got a problem with Criteria from Doctrine2. Iusing Criteria to check a SMALLINT type in PostreSQL like this :
$criteria = Criteria::create()->where(Criteria::expr()->eq("actif", 1));
return $this->c_Agenda->matching($criteria);
But I've got this error :
Invalid input syntax for integer: "t"
I suppose criteria convert 1 in TRUE and PostreSQL dosen't recognize this value. If I change 1 to 0 I've got the same error but with f instead of t.
In PostreSQL, actif type is SMALLINT.
Solution 1:[1]
Try to replace Criteria::expr()->eq("actif", 1)
with Criteria::expr()->eq("actif", "1")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Guillaume Sainthillier |