2006-07-24 01:08:06 +04:00
|
|
|
<?php
|
2006-12-16 01:31:28 +03:00
|
|
|
$q = new Doctrine_Query();
|
|
|
|
|
2006-07-24 01:08:06 +04:00
|
|
|
// find all users, sort by name descending
|
|
|
|
|
2006-12-16 01:31:28 +03:00
|
|
|
$users = $q->from('User u')->orderby('u.name DESC');
|
2006-07-24 01:08:06 +04:00
|
|
|
|
|
|
|
// find all users sort by name ascending
|
|
|
|
|
2006-12-16 01:31:28 +03:00
|
|
|
$users = $q->from('User u')->orderby('u.name ASC');
|
2006-07-24 01:08:06 +04:00
|
|
|
|
2006-12-16 01:31:28 +03:00
|
|
|
// find all users and their emails, sort by email address in ascending order
|
2006-07-24 01:08:06 +04:00
|
|
|
|
2006-12-16 01:31:28 +03:00
|
|
|
$users = $q->from('User u')->leftJoin('u.Email e')->orderby('e.address');
|
2006-07-24 01:08:06 +04:00
|
|
|
|
|
|
|
// find all users and their emails, sort by user name and email address
|
|
|
|
|
2006-12-16 01:31:28 +03:00
|
|
|
$users = $q->from('User u')->leftJoin('u.Email e')
|
|
|
|
->addOrderby('u.name')->addOrderby('e.address');
|
2006-07-24 01:08:06 +04:00
|
|
|
?>
|