Exemple #1
0
 /**
  * fetchAll
  * Returns an array containing all of the result set rows
  *
  * @param integer $fetchMode            Controls how the next row will be returned to the caller.
  *                                      This value must be one of the Doctrine::FETCH_* constants,
  *                                      defaulting to Doctrine::FETCH_BOTH
  *
  * @param integer $columnIndex          Returns the indicated 0-indexed column when the value of $fetchStyle is
  *                                      Doctrine::FETCH_COLUMN. Defaults to 0.
  *
  * @return array
  */
 public function fetchAll($fetchMode = Doctrine::FETCH_BOTH, $columnIndex = null)
 {
     $event = new Doctrine_Event($this, Doctrine_Event::STMT_FETCHALL, $this->getQuery());
     $event->fetchMode = $fetchMode;
     $event->columnIndex = $columnIndex;
     $this->_conn->getListener()->preFetchAll($event);
     if (!$event->skipOperation) {
         if ($columnIndex !== null) {
             $data = $this->_stmt->fetchAll($fetchMode, $columnIndex);
         } else {
             $data = $this->_stmt->fetchAll($fetchMode);
         }
         $event->data = $data;
     }
     $this->_conn->getListener()->postFetchAll($event);
     return $data;
 }