Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2401

INDEX BY not working on multiple columns

    Details

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

      Description

      According to the docs on this page:
      http://docs.doctrine-project.org/en/latest/reference/dql-doctrine-query-language.html#using-index-by

      The following "multi-dimensional index" should be perfectly possible, with a default hydration mode:
      SELECT b as business, p as product FROM Businesses b INDEX BY b.id JOIN Products p WITH b.id = p.businessid INDEX BY p.id

      However, b.id is completely ignored (it is a numeric primary key).

      I tried to go further, giving 2 products a matching barcode and indexing by barcode and then a (unique, numeric) productid. Only the barcode worked as a key and only one of the products with a matching barcode was selected. I used this query to test:
      SELECT p FROM Products p INDEX BY p.barcode JOIN p.businessid b INDEX BY p.id

      I also flagged the docs, because I don't think a userid should/could be starting from 0.

        Activity

        Quintenvk created issue -
        Quintenvk made changes -
        Field Original Value New Value
        Description According to the docs on this page:
        http://docs.doctrine-project.org/en/latest/reference/dql-doctrine-query-language.html#using-index-by

        The following "multi-dimensional index" should be perfectly possible, with a default hydration mode:
        SELECT b as business, p as product FROM Businesses b INDEX BY b.id JOIN Products p WITH b.id = p.businessid INDEX BY p.id

        However, b.id is completely ignored (it is a numeric primary key).

        I tried to go further, giving 2 products a matching barcode and indexing by barcode and then id. Only the barcode worked as a key and only one of the products with a matching barcode was selected. I used this query to test:
        SELECT p FROM Products p INDEX BY p.barcode JOIN p.businessid b INDEX BY p.id

        I also flagged the docs, because I don't think a userid should/could be starting from 0.
        According to the docs on this page:
        http://docs.doctrine-project.org/en/latest/reference/dql-doctrine-query-language.html#using-index-by

        The following "multi-dimensional index" should be perfectly possible, with a default hydration mode:
        SELECT b as business, p as product FROM Businesses b INDEX BY b.id JOIN Products p WITH b.id = p.businessid INDEX BY p.id

        However, b.id is completely ignored (it is a numeric primary key).

        I tried to go further, giving 2 products a matching barcode and indexing by barcode and then a (unique, numeric) productid. Only the barcode worked as a key and only one of the products with a matching barcode was selected. I used this query to test:
        SELECT p FROM Products p INDEX BY p.barcode JOIN p.businessid b INDEX BY p.id

        I also flagged the docs, because I don't think a userid should/could be starting from 0.
        Quintenvk made changes -
        Attachment Testcase.zip [ 11524 ]

          People

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

            Dates

            • Created:
              Updated: