Exemplo n.º 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);
 }
Exemplo n.º 2
0
 /**
  * Constructor.
  * A join tree is built up based on the declared relationships between active record classes.
  * @param CActiveRecord $model the model that initiates the active finding process
  * @param mixed $with the relation names to be actively looked for
  */
 public function __construct($model, $with)
 {
     $this->_builder = $model->getCommandBuilder();
     $this->_joinTree = new CJoinElement($this, $model);
     $this->buildJoinTree($this->_joinTree, $with);
 }