Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-16

DQL Ignores properties of subclasses

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: 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
          agwidarsito 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
          agwidarsito 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.
          Hide
          nick4fake Bogdan Yurov added a comment -

          Is there any chance that this would be implemented?

          Show
          nick4fake Bogdan Yurov added a comment - Is there any chance that this would be implemented?
          Hide
          ocramius Marco Pivetta added a comment -

          Unlikely right now.

          Show
          ocramius Marco Pivetta added a comment - Unlikely right now.
          Hide
          nick4fake 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
          nick4fake 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
          ocramius 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
          ocramius Marco Pivetta added a comment - Implementing it is not the problem. The problem is that it violates ORM invariants that we want to keep.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: