Вопрос

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