Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2479

Add possibility to only query for root entities in a class table inheritance

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: DQL, ORM
    • Security Level: All
    • Labels:

      Description

      It is not possible to query for root/topmost class entities (only) in a class table inheritance situation without extra JOINs to the child entities/classes.

      E.g.
      Person -> root entity/class
      Employee -> child entity/class extending Person

      The DQL:

      SELECT p
      FROM Person p;

      also joins Employee even though I am not interested in Employee properties.

      Person is the base class in this use case and it should be possible to only retrieve those information. Thinking of OOP, if I instanciate Person I do not have any reference to its child either.
      This is especially useful for large base tables where you want to only retrieve base information without inferring the childs.

      IMO the DQL should be modified to allow selecting root/base information only, similar to the INSTANCE OF operator, that allows selecting specific childs only.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Steve Müller
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: