1
0
mirror of synced 2024-12-14 07:06:04 +03:00
doctrine2/manual/codes/Basic Components - Query - ORDER BY - sorting query results.php
2006-12-15 22:31:28 +00:00

21 lines
587 B
PHP

<?php
$q = new Doctrine_Query();
// find all users, sort by name descending
$users = $q->from('User u')->orderby('u.name DESC');
// find all users sort by name ascending
$users = $q->from('User u')->orderby('u.name ASC');
// find all users and their emails, sort by email address in ascending order
$users = $q->from('User u')->leftJoin('u.Email e')->orderby('e.address');
// find all users and their emails, sort by user name and email address
$users = $q->from('User u')->leftJoin('u.Email e')
->addOrderby('u.name')->addOrderby('e.address');
?>