-
-
Notifications
You must be signed in to change notification settings - Fork 97
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QueryBuilder : lt() on datetime does not exclude current object #595
Comments
@dantleech would you have an idea what happens here? @Peekmo a horrible workaround could be to substract 1 second from your date. |
The query builder seems to be doing its job, the generated SQL2 looks like it should work, so I would say this is indeed a storage layer problem. |
Thanks for your answer. E.G $qb->where()->lt()->field('news.date')->literal($news->getDate()->sub(new \DateInterval('PT1H'))->format('c'))->end(); // Not working $qb->where()->lt()->field('news.date')->literal($news->getDate()->sub(new \DateInterval('PT59M'))->format('c'))->end(); // Not working $qb->where()->lt()->field('news.date')->literal($news->getDate()->sub(new \DateInterval('PT1H01M'))->format('c'))->end(); // works I'm using MySQL as database. |
@Peekmo sorry for the long silence. can you try to provide a failing test so that we can investigate what happens, and see if its maybe a database layer issue? |
Hello.
I have a problem with a filter in the query builder on a datetime field. I want the object with the date just before the given one, and the query returns an object with the same datetime (exactly the same)
Query generated
And var_dump of the datetime from the object that I get
The problem does not appears with gt() method.
Thank you !
The text was updated successfully, but these errors were encountered: