/** * Check whether the internal resource has rows to fetch * * @return boolean */ public function valid() { if ($this->_type === 1) { $result = $this->_result; if (is_object($result) === true) { $row = $result->fetch($result); //@note ?! } else { $row = false; } } else { $rows = $this->_rows; if (is_array($rows) === false) { $result = $this->_result; if (is_object($result) === true) { $rows = $result->fetchAll(); $this->_rows = $rows; } } if (is_array($rows) === true) { $row = current($rows); if ($row !== false) { next($row); } } else { $row = false; } } if (is_array($row) === false) { $this->_activeRow = false; return false; } //Set records as dirty state PERSISTENT by default $dirtyState = 0; //Get current hydration mode $hydrateMode = $this->_hydrateMode; //Tell if the resultset is keeping snapshots $keepSnapshots = $this->_keepSnapshots; //Get the resultset column map $columnMap = $this->_columnMap; //Hydrate based on the current hydration switch ((int) $hydrateMode) { case 0: //$this->model is the base entity $model = $this->_model; //Perform the standard hydration based on objects $activeRow = Model::cloneResultMap($model, $row, $columnMap, $dirtyState, $keepSnapshots); break; default: //Other kinds of hydrations $activeRow = Model::cloneResultMapHydrate($row, $columnMap, $hydrateMode); break; } $this->_activeRow = $activeRow; return true; }