tarouma
(Taro Uma)
1
When I retrieve records with this, what is possible as far as working with the records and saving them?
Is each record then an object that I can use like this?
$mySomeModels = Some::model()->findAllByAttributes(array('val1'=>0,'val2'=>1,'val3'=>0);
foreach($mySomeModels as $someModel){
$someModel->val4 = 1;
$someModel->save();
}
Any ‘findAll’ in Yii should return an array of model objects, and U can use each of them like U normally would. So U can do like U wrote.
tarouma
(Taro Uma)
3
Thanks, I was hoping that’s how it worked. I couldn’t tell if it was an array of objects or not when I just did a print_r but hoped that was the case.
alirz23
(Ali Raza)
4
findAll returns an array of objects you can just loop thru and manipulate them