New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Test failing...] DDC-1048 reported by cordoval #647
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-2397 We use Jira to track the state of pull requests and the versions they got |
馃憤 Ran into this issue with one of my bundles, fortunately I only needed it for the query builder, and made it work without creating an expression. I believe the cause of the problem is this: |
This is a DQL issue (or DQL builder issue, to be specific), not a mapping or MySQL-specific issue. I think @Padam87 is correct, $qb->expr()->eq('x.booleanField', 'FALSE'); or use parameter: $qb->expr()->eq('x.booleanField', ':foo');
$qb->setParameter('foo', FALSE); |
@Majkl578 The second one does not work for me, it works only if false is a string and not a boolean : $qb->expr()->eq('x.booleanField', ':foo');
$qb->setParameter('foo', 'false'); |
This should work then:
|
|
||
$false = $qb | ||
->where($qb->expr()->andX( | ||
$qb->expr()->eq('x.booleanField', false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cordoval This is using string concatenation. It is expected to work this way. You should use parameters instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing is, DQL supports booleans without parameters so one would expect this to work. This behavior is at least strange and unexpected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Majkl578 But it supports it by using a string, not a boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, but that doesn't mean DQL builder can't use some extra logic for converting input to string representation (which would make sense here). Also, looking at Comparison::__construct, it says @param mixed $rightExpr
, not @param string $rightExpr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, because it could be another Expr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The query builder is a string builder and has nothing to do with casting constant values to their corresponding DQL representations. here, binding a string would mean using '"false"'
and binding a boolean would require to use 'false'
, and not just the boolean false
. these are all different
Invalid |
i tried 馃懚 |
http://www.doctrine-project.org/jira/browse/DDC-1048
@Ocramius now you believe me 馃槩