2007-04-12 20:43:01 +04:00
|
|
|
<?php
|
2007-04-12 20:48:37 +04:00
|
|
|
// SELECT u.*, COUNT(p.id) num_posts FROM User u, u.Posts p WHERE u.id = 1 GROUP BY u.id
|
2007-04-12 20:45:13 +04:00
|
|
|
|
|
|
|
$query = new Doctrine_Query();
|
|
|
|
|
|
|
|
$query->select('u.*, COUNT(p.id) num_posts')
|
|
|
|
->from('User u, u.Posts p')
|
|
|
|
->where('u.id = ?', 1)
|
2007-04-12 20:47:56 +04:00
|
|
|
->groupby('u.id')
|
|
|
|
->execute();
|
2007-04-12 20:43:01 +04:00
|
|
|
?>
|