Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-2190

findBy() support finding by a single DateTime but not by multiple DateTime

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      The following code works:

      $repository->findBy(array('date' => new \DateTime()))

      but the following code fails as it does not apply the conversion of the date type for each element:

      $repository->findBy(array('date' => array(new \DateTime(), new \DateTime('tomorrow')))
      1. DDC2190Test.php
        0.6 kB
        Benjamin Eberlei

        Activity

        stof Christophe Coevoet created issue -
        stof Christophe Coevoet made changes -
        Field Original Value New Value
        Description The following code works:

        {code}$repository->findBy('date' => new \DateTime()){code}

        but the following code fails as it does not apply the conversion of the {{date}} type for each element:

        {code}$repository->findBy('date' => array(new \DateTime(), new \DateTime('tomorrow')){code}
        The following code works:

        {code}$repository->findBy(array('date' => new \DateTime())){code}

        but the following code fails as it does not apply the conversion of the {{date}} type for each element:

        {code}$repository->findBy(array('date' => array(new \DateTime(), new \DateTime('tomorrow'))){code}
        Hide
        beberlei Benjamin Eberlei added a comment -

        This is actually very hard to implement, the problem is that we only have ARRAY constants for PDO::PARAM_INT and PDO::PARAM_STR - all the other types would require special handling.

        Show
        beberlei Benjamin Eberlei added a comment - This is actually very hard to implement, the problem is that we only have ARRAY constants for PDO::PARAM_INT and PDO::PARAM_STR - all the other types would require special handling.
        Hide
        beberlei Benjamin Eberlei added a comment -

        Attaching failing testcase.

        The idea is to have something like "datetime[]" as type and detect this in the SQLParserUtils of DBAL.

        Another approach would be to convert the values in the ORM already, before passing to the DBAL.

        Show
        beberlei Benjamin Eberlei added a comment - Attaching failing testcase. The idea is to have something like "datetime[]" as type and detect this in the SQLParserUtils of DBAL. Another approach would be to convert the values in the ORM already, before passing to the DBAL.
        beberlei Benjamin Eberlei made changes -
        Attachment DDC2190Test.php [ 11526 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={expand=changesets[0:20].revisions[0:29],reviews, query=DDC-2190}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            beberlei Benjamin Eberlei
            Reporter:
            stof Christophe Coevoet
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: