I have a custom attribute/variable in my model. I set the value for it in afterFind().
How do I make a CActiveDataProvider that only gives me the results that have showInGridView attribute set to true?
Can this be done without first looping over all results and eliminating the ones we don't want? If not, then how do I do I go about kicking the unwanted objects out?
class Asd extends CActiveRecord { public $showInGridView = false; ... public function afterFind() { if(in_array($this->id, array(4, 8, 15, 16, 23, 42))) $this->showInGridView = true; } }
How do I make a CActiveDataProvider that only gives me the results that have showInGridView attribute set to true?
Can this be done without first looping over all results and eliminating the ones we don't want? If not, then how do I do I go about kicking the unwanted objects out?
$asds = Asd::model()->findAll(); foreach($asds as $asd) if(!$asd->showInGridView) unset(???); // how do I remove it? or what... I don't even... how does this work again :)?