Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-425

E_NOTICE in Doctrine/ORM/UnitOfWork.php when using DateTime w/ DQL

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0-BETA1
    • Component/s: DQL
    • Security Level: All
    • Labels:
      None

      Description

      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

        Activity

        Hide
        Roman S. Borschel added a comment -

        Reproduced successfully and scheduled for BETA1.

        Show
        Roman S. Borschel added a comment - Reproduced successfully and scheduled for BETA1.
        Hide
        Roman S. Borschel added a comment -

        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.

        Show
        Roman S. Borschel added a comment - 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.

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            Jaka Jancar
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: