我有:
# config/schema.yml
propel:
jobeet_category:
id: ~
name: { type: varchar(255), required: true, index: unique }
jobeet_job:
id: ~
category_id: { type: integer, foreignTable: jobeet_category, foreignReference: id, required: true }
type: { type: varchar(255) }
company: { type: varchar(255), required: true }
例如:
JobeetCategory:
id | name
1 | first
2 | second
JobeetJob:
id | category_id | name
1 | 1 | bbb
2 | 1 | ccc
3 | 1 | aaa
4 | 2 | zzz
5 | 2 | xxx
我这样做:
$c = new Criteria();
$categories = JobeetCategoryPeer::doSelect($c);
我可以:
foreach($categories as $category){
echo $category->getName();
foreach ($category->getJobeetJobs() as $job){
echo '-' . $job->getName();
}
}
这告诉我:
first
- bbb
- ccc
- aaa
second
- zzz
- xxx
但我想对此进行排序ASC by NAME
:
first
- aaa
- bbb
- ccc
second
- xxx
- zzz
我怎样才能用 PROPEL QUERY 做到这一点?