Skip to content


DDC-1021: Automatically infer type when DateTime is used as parameter in queries #1611

doctrinebot opened this Issue · 2 comments

2 participants


Jira issue originally created by user k-fish:

Given $date instanceof \DateTime, instead of this:

$this->entityManager->createQuery(' ... >= :pdate')
  ->setParameters(array('pdate' => $date), array('pdate' => 'datetime'))

I would love to be able to use this:

$this->entityManager->createQuery(' ... >= :pdate')
  ->execute(array('pdate' => $date))

Even when using setParameters() - which you need to do, e.g. when using getSingleResult(), it would be nice to be able to leave that out for DateTime instances - seems to be about the only thing that is not handled transparently.


Comment created by @guilhermeblanco:

This was already fixed by ParameterTypeInferer released in 2.1


Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.1.1 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.