0

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();
Tofuwarrior
  • 669
  • 9
  • 21

1 Answers1

1

You have to do ORDER BY c.updated_at

Then you can do:

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

to get the most recent one

Flip
  • 4,778
  • 1
  • 34
  • 48