Hi Johannes

Ich verwende folgende Repository-Klasse um *immer* zu sortieren. Im Controller genügt dann der Aufruf von findAll(). In deiner Funktion ist $query-->setOrderings(... nur ein Zusatz. Es fehlen $query-->matching(... und return $query-->execute();

/**
 * A repository for person
 */
class Tx_Kernaarau_Domain_Repository_PersonRepository extends Tx_Extbase_Persistence_Repository {

protected $defaultOrderings = array('name' => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING);
}
Liebe Grüsse. Thomas
(Bitte entschuldige meinen Tippfehler vor einer Woche)

Am 16.05.2014 10:42, schrieb JCL - Johannes C. Laxander:

Hallo,

ich möchte die Ergebnismenge einer 1:n Relation in einer bestimmten Sortierung 
ausgeben:

cruise-A -> Kategorie-X, 1000 €
cruise-A -> Kategorie-D, 900 €
cruise-A -> Kategorie-L, 950 €

Sortiert:

cruise-A -> Kategorie-D, 900 €
cruise-A -> Kategorie-L, 950 €
cruise-A -> Kategorie-X, 1000 €

Dafür habe ich in der Repository-Klasse diesen Code:

public function findAllSortByCabinCategory() {
   $query = $this->createQuery();
   $query->setOrderings(array(
     'cabinCategory' => 
\TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
   ));
}

Funktionsaufruf im Controller:

$cabinPricePerPersons = 
$this->cabinPricePerPersonRepository->findAllSortByCabinCategory();
$this->view->assign('cabinPricePerPersons', $cabinPricePerPersons);

Die Ausgabe erscheint aber nach wie vor "unsortiert". Jemand eine Erklärung 
dafür? Wo liegt der Fehler?

Gruß, Johannes.


_______________________________________________
TYPO3-german mailing list
[email protected]
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german

Antwort per Email an