hi didrik, i dont know how to do it with an akelos method, but if it is ok to you doing it with sql you can do it like this:
$sessions =& $this->Session->findBySql('select language, count(*) as column1 from sessions group by language');
important thing: as you can see i used an alias for count. i do this because the name of the columns on the select statement will be the properties of the object, and this properties need to match the name of the columns of the table (sorry for the redundancy) or it will fail. so you can access what you want like this:
foreach ($sessions as $session){
$session->column1 //count(*)
$session->language
}
Extension:
in case you want an alias that is not a column name of the table, you can use any alias, if you declare it as a propertie in the model class.
class Session extends AKActiveRecord{
var $random_alias;
and now is ok to use "count(*) as random_alias"
hi, like i said above:
important thing: as you can see i used an alias for count. i do this because the name of the columns on the select statement
will be the properties of the object, and this properties need to match the name of the columns of the table (sorry for the redundancy)
or it will fail. so you can access what you want like this:
i will add that you need alias for the selected columns you want to retrieve.
so you should make an alias for 'l.property_id' too. and these alias need to be known properties for the model.(like columns name from the model your executing the sql or declared properties in the model , see Extension above)
And by the way, i dont think execute and findBySql are the same. so maybe that could be the problem.
1 to 6 of 6