Пример #1
0
 /**
  * This is based on CActiveRecord::query().
  * @param CActiveRecord $model
  * @param CDbCriteria $criteria
  * @return array containing CDbDataReader and CActiveFinder objects
  */
 private function createDataReader($model, $criteria)
 {
     $model->beforeFindInternal();
     $model->applyScopes($criteria);
     if (empty($criteria->with)) {
         $finder = null;
         $command = $model->getCommandBuilder()->createFindCommand($model->tableSchema, $criteria, $model->getTableAlias());
     } else {
         $finder = new EActiveFinder($model, $criteria->with);
         $command = $finder->createCommand($criteria);
     }
     $command->prepare();
     $command->execute($command->params);
     return array(new CDbDataReader($command), $finder);
 }
Пример #2
0
 public function getDataReader()
 {
     $this->dataProvider->setPagination(false);
     $model = $this->dataProvider->model;
     $baseCriteria = $this->dataProvider->getCriteria();
     if (empty($baseCriteria->with)) {
         $command = $model->getCommandBuilder()->createFindCommand($model->tableSchema, $baseCriteria);
     } else {
         $finder = new EActiveFinder($model, $baseCriteria->with);
         $command = $finder->createCommand($baseCriteria);
     }
     $command->prepare();
     $command->execute($command->params);
     return new CDbDataReader($command);
 }