views:

291

answers:

1

Here is my problem, i'm trying to do tag cloud in symfony, what i want to perform is such a sql query

select tag, count(tag) from tagi group by tag order by count(tag) desc limit 10

anyone can help?

+1  A: 

Create a funtion in the Peer (not the BasePeer) class that maps to your "tag" table. Example:

public static function doGetTags() {

    $connection = Propel::getConnection();
    // get the query from configuration
    $query = sfConfig::get('app_query_tags_all');
    $statement = $connection->prepare($query);
    $statement->execute();
    $results = self::populateObjects($statement);
}
mattsidesinger