SQLSTATE[22P02]: Invalid text representation: 7
ERROR: invalid input syntax for type boolean: ""
500 Internal Server Error - PDOException
It's the error message cause by Doctrine2 (2.2-DEV) and i'm afraid it's that bug which appeared again: http://www.doctrine-project.org/jira/browse/DDC-1394
The query which causes this error is as follows:
public function getFindAllNonOthersQueryBuilder()
{
return $this
->createQueryBuilder('t')
->where('t.isOther = :isOther')
->setParameter('isOther', false);
}
The field isOther is mapped this way :
/**
* @var boolean $isOther
*
* @ORM\Column(name="isOther", type="boolean")
*/
protected $isOther = false;
What's happening in here?
I've checked the type in the postgres database and it's a boolean
too
You have to use Literal
expression. It is related with issue #DDC-1683
My sample code:
$q->andWhere($q->expr()->eq('item.published', $q->expr()->literal(true)));
I did some more googling as I have the same issue and I found the solution through the FOSMessageBundle, if you add '\PDO::PARAM_BOOL' to your setParameter it works, like so:
$qb->setParameter('isOther', false, \PDO::PARAM_BOOL);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With