コード例 #1
0
 /**
  * Goes to next object (row) in the resultset
  *
  * @author Hugo Ferreira da Silva
  * @access public
  * @return array
  * @see LumineBase::find()
  */
 function fetch($getLinks = true)
 {
     if (!$this->rs) {
         LumineLog::logger(1, 'Consulta não realizada ou falhou ' . get_class($this), __FILE__, __LINE__);
         return false;
     }
     if ($this->rs->EOF) {
         LumineLog::logger(1, 'Sem dados para recuperar ' . get_class($this), __FILE__, __LINE__);
         $this->rs->MoveFirst();
         return false;
     }
     LumineLog::logger(1, 'recuperando dados de ' . get_class($this), __FILE__, __LINE__);
     $data = $this->rs->fields;
     $this->_currentData = $data;
     foreach ($data as $key => $value) {
         $this->{$key} = $value;
         $p = $this->oTable->getColumnProperties($key);
         if ($p !== false) {
             $this->{$p}['name'] = $this->_getDecryptValue($p, $value);
         }
     }
     if ($getLinks == true) {
         $fks = $this->oTable->getForeignKeys();
         foreach ($fks as $fk => $prop) {
             if (isset($prop['lazy']) && $prop['lazy'] == 'true') {
                 LumineLog::logger(1, 'Recuperando os links lazy de ' . get_class($this), __FILE__, __LINE__);
                 $this->{$fk} = $this->getLink($fk);
             }
         }
     }
     $this->rs->MoveNext();
     return true;
 }