[TYPO3-mvc] How and where should I sort my data?

Oliver Salzburg oliver.salzburg at googlemail.com
Tue Mar 20 15:33:43 CET 2012


I'm trying to get my feet wet with extbase/fluid development and am
kind of confused about where to properly sort my collected data.

I only have 2 entities that are relevant: Item and Category.
Every Item should only be in a single Category.

So far so good, everything is working pretty great. I get my list of
Items in the frontend, but not sorted as I want them.
So I added the following snippet to my ItemRepository:

  public function findThings() {
    $query = $this->createQuery();
    $query->setOrderings(
      array(
        "category" =>
Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING
      )
    );

    return $query->execute();
  }

Great, now my Items are sorted the the ID of the Category.
But what I *really* want is to sort them based on the *Name* of my
Category.

I tried several approaches that seemed logical to me but either
resulted in error messages or seemed to have no effect.

How is this generally solved?

Cheers
Oliver


More information about the TYPO3-project-typo3v4mvc mailing list