Details

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

      Description

      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

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: