[TYPO3-mvc] Setting ordering has no effect?

Joerg Schoppet joerg at schoppet.de
Sat Jul 11 22:19:49 CEST 2009


Hi,

I implemented the following method within my own Repository-Class:

public function getOrdered() {
	$query = $this->createQuery();
	$query->setOrderings(array('name' => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING));
	$result = $query->execute();
	$this->persistenceManager->getSession()->registerReconstitutedObjects($result);
	return $result;
}

Have I done something wrong, or is actually the content of the orderings-field not taken into account?

What I have done now to implement it is changing Typo3DbBackend.php:

in function parseSource() I added in the first if-statement:
                         foreach ($query->getOrderings() as $field => $order) {
                                 $sql['orders'][] = $field . ' ' . $order;
                         }

and in function getRows() I added before the replacePlaceholders-call:
                 if (!empty($sql['orders'])) {
                         $sqlString .= ' ORDER BY ' . implode (', ', $sql['orders']);
                 }


Is this ok this way? Should I open a bug-/feature-request?

Joerg


More information about the TYPO3-project-typo3v4mvc mailing list