DDC-425: E_NOTICE in Doctrine/ORM/UnitOfWork.php when using DateTime w/ DQL #530

Closed
opened 2026-01-22 12:41:38 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 15, 2010).

Jira issue originally created by user jakajancar:

I'm trying to do the following:

$this->em->createQuery('DELETE Foo f WHERE f.someTimedateField > ?1')->execute(array(1=>new \DateTime()));

Which results in
E_NOTICE (8): Undefined index: 0000000051c01e2c00000000e1c5cc8d
in Doctrine/ORM/UnitOfWork.php:1916

Originally created by @doctrinebot on GitHub (Mar 15, 2010). Jira issue originally created by user jakajancar: I'm trying to do the following: ``` $this->em->createQuery('DELETE Foo f WHERE f.someTimedateField > ?1')->execute(array(1=>new \DateTime())); ``` Which results in E_NOTICE (8): Undefined index: 0000000051c01e2c00000000e1c5cc8d in Doctrine/ORM/UnitOfWork.php:1916
admin added the Bug label 2026-01-22 12:41:39 +01:00
admin closed this issue 2026-01-22 12:41:40 +01:00
Author
Owner

@doctrinebot commented on GitHub (Mar 15, 2010):

Comment created by romanb:

Reproduced successfully and scheduled for BETA1.

@doctrinebot commented on GitHub (Mar 15, 2010): Comment created by romanb: Reproduced successfully and scheduled for BETA1.
Author
Owner

@doctrinebot commented on GitHub (Mar 29, 2010):

Comment created by romanb:

You can now use explicit binding types to work around this issue:

use DateTime, Doctrine\DBAL\Types\Type;
...
$query->setParameter(1, new DateTime(), Type::DATETIME);

The DQL parser can not yet automatically infer the type of the bound parameter from the field (e.someDatetimeField) during parsing because this is non-trivial. Maybe this will change in the future.

@doctrinebot commented on GitHub (Mar 29, 2010): Comment created by romanb: You can now use explicit binding types to work around this issue: ``` use DateTime, Doctrine\DBAL\Types\Type; ... $query->setParameter(1, new DateTime(), Type::DATETIME); ``` The DQL parser can not yet automatically infer the type of the bound parameter from the field (e.someDatetimeField) during parsing because this is non-trivial. Maybe this will change in the future.
Author
Owner

@doctrinebot commented on GitHub (Mar 29, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Mar 29, 2010): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#530