Very easy to install!!
Scopes allow you to predefine filters for the record set and apply them and chain them without having to rewrite the conditions.
(Guide to named scopes)
i.e., in the model:
public function scopes(){ return array( 'enabled'=>array( 'condition'=>'isEnabled=1', ), 'newest'=>array( 'order'=>'dateAdded DESC', 'limit'=>5 ), ); }
This extension simply allows you to use the same functionality with the DataProviders.
Simply import the EActiveDataProvider from the extensions directory.
Then, in the $criteria, I simply add the scope and call EActiveDataProvider instead of CActiveDataProvider.
The REALLY nice thing about the scopes is that if the business logic needs to change at some point, I can do so at a single point of entry -vs- customized criteria scattered around.
No comments:
Post a Comment