Skip to content

Loading…

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

Closed
doctrinebot opened this Issue · 2 comments

2 participants

@doctrinebot

Jira issue originally created by user k-fish:

Given $date instanceof \DateTime, instead of this:

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

I would love to be able to use this:

$this->entityManager->createQuery(' ... p.date >= :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.

@doctrinebot

Comment created by @guilhermeblanco:

This was already fixed by ParameterTypeInferer released in 2.1

@doctrinebot

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.