mocapapa
(Mocapapa)
October 7, 2010, 12:46am
1
As I was not able to find the solution on the forum/documentation, I am making the question as follows.
Suppose that we have been recording the properties of the bugs such as found date etc.
$criteria = new CDbCriteria(
array(
'condition'=>'result like \'%bug%\'',
'group'=>'date',
'select'=>'count(*)',
)
);
$models=Incident::model()->findAll($criteria);
I was not able to find the count in the models. How do I get it?
zaccaria
(Matteo Falsitta)
October 7, 2010, 10:08am
2
do like that:
$criteria = new CDbCriteria(
array(
'condition'=>'result like \'%bug%\'',
'group'=>'date',
'select'=>'count(*) as bugs',
)
);
$models=Incident::model()->findAll($criteria);
You have also to add the property bugs to Incident
class Incident extends CActiveRecord
{
public $bugs;
mocapapa
(Mocapapa)
October 8, 2010, 2:53am
3
zaccaria:
do like that:
$criteria = new CDbCriteria(
array(
'condition'=>'result like \'%bug%\'',
'group'=>'date',
'select'=>'count(*) as bugs',
)
);
$models=Incident::model()->findAll($criteria);
You have also to add the property bugs to Incident
class Incident extends CActiveRecord
{
public $bugs;
Thank you zaccaria, it solved my issue! <img class=“bbc_emoticon” alt=" " src=“http://www.yiiframework.com/forum/public/style_emoticons/default/biggrin.gif ”><br>