Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2250

Joining Associations in Single Inheritance Scheme

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Can't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      Let's assume the following class hierarchy:

      AbstractComment
      SpecialComment extends AbstractComment
      {
          private $specialAssociation;
      }
      RegularComment extends RegularComment
      

      Now, I'd like to write a query such as:

      SELECT c, a FROM AbstractComment c LEFT JOIN c.specialAssociation a
      

      The idea is to preload the association when selecting all comments. Now, that association is only present on a sub-class of the queried class, but since it is a single table inheritance, Doctrine should be able to join it for those entities where it is present.

      At the moment unfortunately, Doctrine shows an error that the association does not exist on the AbstractComment class. Also, there is no real alternative to this except moving the collection to the base class even if it does not belong there.

        Activity

          People

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

            Dates

            • Created:
              Updated:
              Resolved: