mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Expression builder doesn't convert boolean value to 0 or 1. #4934
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tomazahlin on GitHub (Dec 11, 2015).
Originally assigned to: @Ocramius on GitHub.
I am using query builder and the expression builder to create a query.
Generates:
"WHERE ... a.property = "(without any value)While
Generates:
"WHERE a.property = 1"And
Generates:
"WHERE a.property = 0"The property is annotated as boolean and doctrine knows it is boolean too. Any suggestions?
Thank you.
@Ocramius commented on GitHub (Dec 11, 2015):
This is expected behavior: the query builder is a string builder, and it doesn't care about the types of the passed in parameters: it just converts them to strings in the end.
What you are supposed to do with any parameter is to use parameter binding instead:
@tomazahlin commented on GitHub (Dec 14, 2015):
Thank you for the help, sounds fine.