Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1385

INDEX BY doesn't work for selects with scalars only

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.1
    • Fix Version/s: 2.2
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      By scalars-only-selects I mean this:

      SELECT c.id, c.name FROM GLocalityBundle:Country c  INDEX by c.id 
      

      The result won't be indexed by c.id, as opposites to this:

      SELECT c FROM GLocalityBundle:Country c  INDEX by c.id 
      

      Assuming that GLocalityBundle:Country has several hunders of fields, and you need only two of them, this is very disappointing

      After diving in the code, due to rigorous separation of entities on objects and scalars, it looks practically impossible even to implement this feature
      What is this? Bad design?

        Activity

        Hide
        Benjamin Eberlei added a comment -

        I agree it seems very complex to implement for the Object and ArrayHydrator, however it should be very easy for the getScalarResult() hydrator.

        Even more I think there is a general bug with INDEX BY and scalars in Object and ArrayHydrator that has to be evaluated.

        Show
        Benjamin Eberlei added a comment - I agree it seems very complex to implement for the Object and ArrayHydrator, however it should be very easy for the getScalarResult() hydrator. Even more I think there is a general bug with INDEX BY and scalars in Object and ArrayHydrator that has to be evaluated.
        Hide
        Benjamin Eberlei added a comment -

        This PR will fix this issue https://github.com/doctrine/doctrine2/pull/151, it is scheduled for 2.2

        Show
        Benjamin Eberlei added a comment - This PR will fix this issue https://github.com/doctrine/doctrine2/pull/151 , it is scheduled for 2.2
        Hide
        Benjamin Eberlei added a comment -

        This is fixed in master

        Show
        Benjamin Eberlei added a comment - This is fixed in master
        Hide
        Oleg Namaka added a comment - - edited

        This behavior has not changed in the latest 2.2.1. getArrayResult returns an indexed result. getScalarResult returns zero based result. Do I need to create a separate ticket for that issue?

        Show
        Oleg Namaka added a comment - - edited This behavior has not changed in the latest 2.2.1. getArrayResult returns an indexed result. getScalarResult returns zero based result. Do I need to create a separate ticket for that issue?

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Dmitry Strygin
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: