/** * This method is internally called. * @param string $sql the SQL statement * @param array $params parameters to be bound to the SQL statement * @return \Database\ActiveRecord\Record[] */ public function findAllBySql($sql, $params = []) { var_echo(get_class($this->_joinTree->model) . '.findAllBySql() eagerly', 'Database_ActiveRecord_Record'); if (($rows = $this->_builder->createSqlCommand($sql, $params)->queryAll()) !== []) { $baseRecords = $this->_joinTree->model->populateRecords($rows, false); $this->_joinTree->findWithBase($baseRecords); $this->_joinTree->afterFind(); $this->destroyJoinTree(); return $baseRecords; } else { $this->destroyJoinTree(); return []; } }