Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-16

DQL Ignores properties of subclasses

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.0-ALPHA2
    • Fix Version/s: None
    • Component/s: DQL
    • Security Level: All
    • Labels:
      None

      Description

      I have a classes B and C which inherit from superclass A. I would like
      to get a list of all A's but filter the list to ignore those in C
      which have a property d set to 2.

      select a from A where a.d == 2 fails because "d" is not a property of A.

        Issue Links

          Activity

          Hide
          Marco Pivetta added a comment -

          Implementing it is not the problem. The problem is that it violates ORM invariants that we want to keep.

          Show
          Marco Pivetta added a comment - Implementing it is not the problem. The problem is that it violates ORM invariants that we want to keep.
          Hide
          Bogdan Yurov added a comment -

          Is it worth it to try to implement such behavior? I am not well aware of Doctrine internals thus I can not chose what to do. Would it require rewriting of doctrine kernel and major changes, or it could be implemented somehow without much patching?

          Show
          Bogdan Yurov added a comment - Is it worth it to try to implement such behavior? I am not well aware of Doctrine internals thus I can not chose what to do. Would it require rewriting of doctrine kernel and major changes, or it could be implemented somehow without much patching?
          Hide
          Marco Pivetta added a comment -

          Unlikely right now.

          Show
          Marco Pivetta added a comment - Unlikely right now.
          Hide
          Bogdan Yurov added a comment -

          Is there any chance that this would be implemented?

          Show
          Bogdan Yurov added a comment - Is there any chance that this would be implemented?
          Hide
          Adrian Grayson added a comment -

          "For example, Delphi. It supports casting manually to selected type (for example TObject -> TButton). Does it break best violates OO principles too? No, of course.
          Another example is Java. It has exactly same language construction for exactly same purpose. Is doctrine more concentrated on OO principles than Java or Delphi?"

          I agree. I fail to see how a type safe CAST() violates OO. We're not talking about dangerously casting anything, at least not in theory. It's polymorphism.

          Show
          Adrian Grayson added a comment - "For example, Delphi. It supports casting manually to selected type (for example TObject -> TButton). Does it break best violates OO principles too? No, of course. Another example is Java. It has exactly same language construction for exactly same purpose. Is doctrine more concentrated on OO principles than Java or Delphi?" I agree. I fail to see how a type safe CAST() violates OO. We're not talking about dangerously casting anything, at least not in theory. It's polymorphism.

            People

            • Assignee:
              Marco Pivetta
              Reporter:
              Avi Block
            • Votes:
              6 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: