Advertisement
Guest User

Untitled

a guest
Apr 11th, 2012
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. // special case for cactivedataprovider - dont pull active
  2. // records cause its crazy overhead. bypass that shizzle dawg. tits.
  3. if($this->dataProvider instanceof CActiveDataProvider) {
  4.     if ($this->convertADPtoCommand) {
  5.         // method you already implemented
  6.     } else {
  7.         // get array of ActiveRecord models    
  8.         $models = $this->dataProvider->getData();
  9.        
  10.         // convert to array
  11.         $data = array();
  12.         $attributes = $this->dataProvider->model->getMetaData()->columns;
  13.         foreach($models as &$model) {
  14.             $row = array();
  15.             foreach($attributes as $attribute=>$col) {
  16.                 $row[$attribute] = $model->{$attribute};
  17.             }
  18.             $data[] = $row;
  19.         }
  20.     }
  21. } else {
  22.     (..)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement