eactivedataproviderex Some CActiveDataProvider enhancements (query caching, total item count fix)

  1. Requirements
  2. Installation
  3. Usage
  4. Example
  5. Change log
  6. Resources

EActiveDataProviderEx enhance the CActiveDataProvider class by:

  • adding the new query caching feature introduced in Yii 1.1.7
  • circumventing the issue of miscalculation of the number of elements when a having and / or group criteria is used by the active record

Requirements

Yii 1.1.7 or later

Installation

Extract the release file under protected/components
Be sure to import the component using the 'import' parameter of the config file

Usage

Use EActiveDataProviderEx the exact same way you use CActiveDataProvider.
In addition, you can specify a cache property as an array consisting in two parameters: array($cache_duration, $cache_dependency).
$cache_duration is the cache duration in seconds
$cache_dependency is an optional CCacheDependency object

Example

$criteria=new CDbCriteria;
// add some criteria here
$dependency = new CDbCacheDependency('SELECT MAX(UNIX_TIMESTAMP(`modified`)) FROM yourModelTable'); // Optional
$activeDataProviderEx = new EActiveDataProviderEx(yourModel, array(
     'criteria'=>$criteria,
     'pagination' => array('pageSize' => 30),
     'sort' => array('defaultOrder' => '`t`.`name`'),
     'cache' => array(3600, $dependency)
));

Change log

Version 1.1.1

  • Fix for criterias not being retrieved from cache (small fetchData overloading)

Version 1.1.0

Version 1.0.0

  • Initial release

Resources

7 0
6 followers
738 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Caching
Developed by: juban_
Created on: Aug 14, 2011
Last updated: 13 years ago

Downloads

show all

Related Extensions