/** * Fetches a row from the result set. * * @param int $style OPTIONAL Fetch mode for this fetch operation. * @param int $cursor OPTIONAL Absolute, relative, or other. * @param int $offset OPTIONAL Number for absolute or relative cursors. * @return mixed Array, object, or scalar depending on fetch mode. * @throws Zend_Db_Statement_Exception */ public function fetch($style = null, $cursor = null, $offset = null) { $row = parent::fetch($style, $cursor, $offset); $remove = $this->_adapter->foldCase('zend_db_rownum'); if (is_array($row) && array_key_exists($remove, $row)) { unset($row[$remove]); } return $row; }
/** * Fetch statement * * @return mixed */ public function fetchItem() { if (null === $this->fetchStmt) { $this->fetchStmt = $this->getConnection()->query($this->getSelect(), $this->bindParams); } $data = $this->fetchStmt->fetch(); if (!$data) { $data = []; } return $data; }
/** * Returns a collection item that corresponds to the fetched row * and moves the internal data pointer ahead * * @return Varien_Object|bool */ public function fetchItem() { if (null === $this->_fetchStmt) { $this->_fetchStmt = $this->getConnection()->query($this->getSelect()); } $data = $this->_fetchStmt->fetch(); if (!empty($data) && is_array($data)) { $item = $this->getNewEmptyItem(); if ($this->getIdFieldName()) { $item->setIdFieldName($this->getIdFieldName()); } $item->setData($data); return $item; } return false; }