• Type: New Feature
    • Status: Resolved
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: Git Master
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
    • Environment:


      Note: I used critical priority for this issue because this is one of the most criticised things about Doctrine 2 worldwide.

      The worst thing about Doctrine 2 is, that you can do almost nothing through methods like Category::getArticles();.
      For example, you have the Category and want to output all the articles. Fine, nothing easier:

      foreach ($category->getArticles() as $article) {
      echo $article->name;

      OK. And now I need only "visible" articles (others are hidden for now). And here it is. You need DQL even for this easy task. Without DQL you can't do nothing, but using DQL (or QueryBuilder) everywhere is very very bad. Simply there is no way to write method like getVisibleArticles(). (Except selecting all and using some filter, but that's nonsense.)

      The solution would be some kind of smart collections (but i don't mind if you come up with something different):

      public function getArticles($visibility = 0, $limit = NULL) {
      return $this->articles->filter('visibility', $visibility)->limit($limit);

      Of course when you need any AND, OR, XOR, IN, LIKE and so DQL is needed. This should be for some simple things only.

        Issue Links


          enumag Jáchym Toušek created issue -
          beberlei Benjamin Eberlei made changes -
          Field Original Value New Value
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Duplicate [ 3 ]
          beberlei Benjamin Eberlei made changes -
          Link This issue duplicates DDC-551 [ DDC-551 ]
          beberlei Benjamin Eberlei made changes -
          Workflow jira [ 12337 ] jira-feedback [ 14747 ]
          beberlei Benjamin Eberlei made changes -
          Workflow jira-feedback [ 14747 ] jira-feedback2 [ 16611 ]
          beberlei Benjamin Eberlei made changes -
          Workflow jira-feedback2 [ 16611 ] jira-feedback3 [ 18864 ]


            • Assignee:
              beberlei Benjamin Eberlei
              enumag Jáchym Toušek
            • Votes:
              0 Vote for this issue
              5 Start watching this issue


              • Created: