문제

I have relation of relation of relation query thus and i want to select only the most recently created record for table CancellationRequest c.

Anyone any idea if this is/should be possible and how?

Doctrine_Query::create()
    ->from('UserNotificationTo unt')
    ->leftJoin('unt.Notification un')
    ->leftJoin('un.QuoteOrder qo')
    ->leftJoin('qo.CancellationRequest c')
    ->where('un.sent_external = 0')
    ->andWhere('c.updated_at *IS THE MOST RECENTLY CREATED ONE*')
    ->execute();
도움이 되었습니까?

해결책

You have to do ORDER BY c.updated_at

Then you can do:

$userNotifcation->getQuoteOrder()->getCancellationRequest()->first()

to get the most recent one

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top