active-data-provider-with-scopes Use scopes in CActiveDataProvider

  1. Documentation
  2. Change Log

Simple extension that can be used to apply scopes to a CActiveDataProvider

Resources

Documentation

Requirements
  • Yii 1.0 or above
Installation
  • Extract the release file under protected/extensions
Usage

See the following code example:

$dataProvider=new EActiveDataProvider('Post', array(
   'scopes'=>array('published'),
   'criteria'=>array(
      //'condition'=>'status=1 AND tags LIKE :tags',
      //'params'=>array(':tags'=>$_GET['tags']),
      'with'=>array('author'),
   ),
   'pagination'=>array(
      'pageSize'=>20,
   ),
));
$dataProvider->joinAll = true; // optional if you want to also join the *_MANY relations
$dataProvider->getData(); // will return a list of Post objects

Change Log

September 7, 2010
  • Update to make it work with Yii 1.1.4
    March 19, 2010
  • Initial release.
5 0
3 followers
1 287 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Database
Tags:
Developed by: Troto
Created on: Mar 19, 2010
Last updated: 7 years ago

Downloads

show all