[TYPO3-mvc] MM-Relation with ordering

Daniel Lorenz mailinglists at capsicumnet.de
Mon Oct 25 10:10:25 CEST 2010


Hi, thank for your reply.

Am Freitag, den 22.10.2010, 10:26 +0000 schrieb Jochen Rau:
> > The next question is, how can I get the first car of a station? And if I
> > had a car object, how can I get the next car, if there is one.
> 
> Have a look at the PostRepository::findNext() of the BlogExample.

I tried this in adaption from BlogExample

    /**
     * Finds the first car to the given station
     *
     * @param Tx_RentCar_Domain_Model_Station $station
     * @return Tx_RentCar_Domain_Model_Car
     */
    public function getFirstByAudit(Tx_RentCar_Domain_Model_Station
$station) {
	$query = $this->createQuery();
	return $query->matching($query->equals('station', $station))
		->setOrderings(array('sorting' =>
Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING))
		->setLimit(1)
		->execute();
    }

But I get an error:

Unknown column 'tx_rentcar_domain_model_car.sorting' in 'order clause'.
The problem could not solved by using:

->setOrderings(array('tx_capaudit_station_car_mm.sorting' =>
Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING))

Setting the ordering in TCA do not solve my problem, because the
ordering by sorting is only needed in a special case, other cases needs
the default ordering.

CU Daniel



More information about the TYPO3-project-typo3v4mvc mailing list