[TYPO3-mvc] MM-Relation with ordering

Dawid Pacholczyk dpacholczyk at gmail.com
Mon Oct 25 17:59:26 CEST 2010


Check your database first. Maybe the name of the field is different if you
created it manualy ? Check also ext_tables.sql. Is there declaration of this
field ? If yes - go to install tool and update database.

If you`re creating mm relation via extbase_kickstarter it should create such
field in your database automaticly like it was in blog_example

Best regards,
Dawid Pacholczyk

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Dawid Pacholczyk
tel: 502-054-334
gg: 5564051
skype: dpacholczyk
http://typo3blog.pl (only polish version at the moment)
                  

-----Original Message-----
From: typo3-project-typo3v4mvc-bounces at lists.typo3.org
[mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] On Behalf Of
Daniel Lorenz
Sent: Monday, October 25, 2010 10:10 AM
To: typo3-project-typo3v4mvc at lists.typo3.org
Subject: Re: [TYPO3-mvc] MM-Relation with ordering

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

_______________________________________________
TYPO3-project-typo3v4mvc mailing list
TYPO3-project-typo3v4mvc at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list