Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1309

Doctrine_Collection toArray() does not return results of table joins.

    Details

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

      Description

      e.g.
      $doctrineCollection = Doctrine_Query::create()
      ->from('Table1 a')
      ->innerJoin('a.Table2 b ON a.id = b.id')
      ->execute();

      $doctrineCollection->toArray() will return only the contents of Table1. However, $doctrineCollection->getFirst()->toArray() will return the results of Table1 + an additional key named 'Table2' which returns the join result from Table2.

      It does not make sense for the collection hydration to differ to that of the objects in the collection.

        Activity

        Hide
        Sharn White added a comment -

        If this is intended you can go ahead and trash this issue. Just doesn't seem right to me.

        Show
        Sharn White added a comment - If this is intended you can go ahead and trash this issue. Just doesn't seem right to me.
        Hide
        Sharn White added a comment -

        Nevermind. I should have been setting $deep to true.

        Show
        Sharn White added a comment - Nevermind. I should have been setting $deep to true.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Sharn White
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: