mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-843: Cannot compare or find date fields #1042
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 @doctrinebot on GitHub (Oct 20, 2010).
Jira issue originally created by user odisey:
Here is my dql (get by getDql() method) after the generation:
SELECT u FROM Entities\Music\Articles u WHERE u.date = 2010-08-30
In the database the field is marked as DATE and has the mentioned value;
No results are returned.
Here is how I generate the dql:
$date = new DateTime($date);
$date = $date->format('Y-m-d');
$date_operator = 'eq';
$qb = $this->doctrine->em->createQueryBuilder();
$qb ->select('u')
->from($class, 'u');
$qb->andWhere($qb->expr()->$date_operator('u.date', $date));
@doctrinebot commented on GitHub (Oct 20, 2010):
Comment created by mjh_ca:
This is not a bug. The date value needs to be quoted just like SQL -- i.e.
Or bind it as a parameter
To debug these kind of things it is often helpful to do
@doctrinebot commented on GitHub (Oct 20, 2010):
Comment created by odisey:
thank you very much!
@doctrinebot commented on GitHub (Oct 20, 2010):
Issue was closed with resolution "Fixed"