本文整理汇总了PHP中Zend_Db_Table_Abstract::fetchAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Table_Abstract::fetchAll方法的具体用法?PHP Zend_Db_Table_Abstract::fetchAll怎么用?PHP Zend_Db_Table_Abstract::fetchAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Table_Abstract
的用法示例。
在下文中一共展示了Zend_Db_Table_Abstract::fetchAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchAll
public function fetchAll()
{
$resultSet = $this->dbTable->fetchAll();
$entries = array();
foreach ($resultSet as $row) {
$entries[] = array('id' => $row->id, 'state' => $row->state, 'info' => $row->info, 'lastupdate' => $row->lastupdate, 'sticked' => $row->sticked);
}
return $entries;
}
示例2: getAll
public function getAll()
{
$resultSet = $this->dbTable->fetchAll();
$resultTab = array();
foreach ($resultSet as $enreg) {
$modelClassName = 'Application_Model_' . $this->className;
$result = new $modelClassName();
$result->fromArray($enreg);
$resultTab[] = $result;
}
return $resultTab;
}
示例3: find
/**
* Find admin
*
* @param int $applicationId
* @param string $username
* @param Admin_Model_Admin $admin
* @return boolean
*/
public function find($applicationId, $username, Admin_Model_Admin $admin)
{
$select = $this->_dbTable->select();
$select->setIntegrityCheck(false)->from(array('a' => 'admin'), array('a.*'))->joinLeft(array("aa" => "admin_application"), "aa.admin_id = a.id")->where('a.username = ?', $username)->where('aa.application_id = ?', $applicationId);
$resultSet = $this->_dbTable->fetchAll($select);
if (0 == count($resultSet)) {
return false;
}
//get first row from resultSet
$row = $resultSet->current();
$admin->setOptions($row->toArray());
return true;
}
示例4: isValid
public function isValid($value)
{
$db = $this->_model->getAdapter();
$where = $db->quoteInto($this->_field . ' = ?', $value);
if (null !== $this->_where) {
$where .= " AND {$this->_where}";
}
$rows = $this->_model->fetchAll($where);
if (count($rows)) {
$this->_messages[] = Axis::translate('core')->__("Record %s already exist", $value);
return $this->_not;
}
$this->_messages[] = Axis::translate('core')->__("Record %s doesn't found", $value);
return !$this->_not;
}
示例5: _loadAcl
/**
* Load ACL rules from DB and load them in a Zend_Acl instance.
*
* @return Zend_Acl
*/
protected function _loadAcl()
{
$this->_roles = $this->_roleTable->fetchAll();
$this->_rules = $this->_ruleTable->fetchAll();
$this->_resources = $this->_resourceTable->fetchAll();
foreach ($this->_roles as $role) {
$this->_loadRole($role);
}
foreach ($this->_resources as $resource) {
$resourceID = null;
$module = $resource->module;
$controller = $resource->controller;
if ($module != null && $controller != null) {
$resourceID = $module . '.' . $controller;
}
if ($resourceID != null && !$this->has($resourceID)) {
$this->add(new Zend_Acl_Resource($resourceID));
}
}
foreach ($this->_rules as $rule) {
$resourceID = null;
$module = $rule->module;
$controller = $rule->controller;
if ($module != null && $controller != null) {
$resourceID = $module . '.' . $controller;
}
if ((bool) $rule->allow) {
$this->allow($rule->role, $resourceID, $rule->action);
} else {
$this->deny($rule->role, $resourceID, $rule->action);
}
}
return $this;
}
示例6: fetchAll
public function fetchAll($where = null, $order = null, $count = null, $offset = null)
{
$select = $this->getQueryAll();
if ($where) {
$select->where($where);
}
return parent::fetchAll($select);
}
示例7: loadData
/**
* Lazy load data via table fetchAll() method.
*
* @return void
*/
protected function loadData()
{
if ($this->data === null) {
$this->data = $this->_table->fetchAll($this->_where, $this->_order, $this->_count, $this->_offset);
if ($this->data instanceof Zend_Db_Table_Rowset_Abstract) {
$this->data = $this->data->toArray();
}
}
}
示例8: fetchAll
/**
* This is overridden to handle cache
*
* (non-PHPdoc)
* @see library_Zend/Db/Table/Zend_Db_Table_Abstract#fetchAll($where, $order, $count, $offset)
*/
public function fetchAll($where = null, $order = null, $count = null, $offset = null)
{
$name = $this->_name . '_' . md5($where);
$data = $this->loadCache($name);
if (!$data) {
$data = parent::fetchAll($where, $order, $count, $offset);
$this->saveCache($data, $name);
}
return $data;
}
示例9: getApplicationsByState
/**
* get enabled or disabled applications
*
* @param int $_state can be Tinebase_Application::ENABLED or Tinebase_Application::DISABLED
* @return Tinebase_Record_RecordSet list of applications
*/
public function getApplicationsByState($_status)
{
if ($_status !== Tinebase_Application::ENABLED && $_status !== Tinebase_Application::DISABLED) {
throw new Tinebase_Exception_InvalidArgument('$_status can be only Tinebase_Application::ENABLED or Tinebase_Application::DISABLED');
}
$where[] = $this->_db->quoteInto($this->_db->quoteIdentifier('status') . ' = ?', $_status);
$rowSet = $this->_applicationTable->fetchAll($where);
$result = new Tinebase_Record_RecordSet('Tinebase_Model_Application', $rowSet->toArray(), TRUE);
return $result;
}
示例10: fetchAll
/**
* wrapper around Zend_Db_Table_Abstract::fetchAll
*
* @param strin|array $_where OPTIONAL
* @param string $_order OPTIONAL
* @param string $_dir OPTIONAL
* @param int $_count OPTIONAL
* @param int $_offset OPTIONAL
* @throws Tinebase_Exception_InvalidArgument if $_dir is not ASC or DESC
* @return the row results per the Zend_Db_Adapter fetch mode.
*/
public function fetchAll($_where = NULL, $_order = NULL, $_dir = 'ASC', $_count = NULL, $_offset = NULL)
{
if ($_dir != 'ASC' && $_dir != 'DESC') {
throw new Tinebase_Exception_InvalidArgument('$_dir can be only ASC or DESC');
}
$order = NULL;
if ($_order !== NULL) {
$order = $_order . ' ' . $_dir;
}
$rowSet = parent::fetchAll($_where, $order, $_count, $_offset);
return $rowSet;
}
示例11: fetchAll
function fetchAll($where = null, $order = null, $count = null, $offset = null)
{
if (!is_object($where) || $where instanceof Zend_Db_Table_Select) {
return parent::fetchAll($where, $order, $count, $offset);
} else {
if (!$where instanceof Zend_Db_Select) {
throw new Exception("Mauvais type de requête");
} else {
throw new Exception("Qui sait traiter ça ? " . gettype($where));
}
}
}
示例12: fetchAll
/**
* (non-PHPdoc)
* @see Zend_Db_Table_Abstract::fetchAll()
*/
public function fetchAll($where = null, $order = null, $count = null, $offset = null)
{
if (empty($where)) {
$tableName = $this->getTableName();
if (false == ($rows = App_Cache::load($tableName))) {
$rows = parent::fetchAll($where, $order, $count, $offset);
App_Cache::save($rows, $tableName);
}
} else {
$rows = parent::fetchAll($where, $order, $count, $offset);
}
$rows = parent::fetchAll($where, $order, $count, $offset);
return $rows;
}
示例13: fetchAll
/**
* wrapper around Zend_Db_Table_Abstract::fetchAll
*
* @param string|array $_where OPTIONAL
* @param string $_order OPTIONAL
* @param string $_dir OPTIONAL
* @param int $_count OPTIONAL
* @param int $_offset OPTIONAL
* @throws Tinebase_Exception_InvalidArgument if $_dir is not ASC or DESC
* @return array the row results per the Zend_Db_Adapter fetch mode.
*/
public function fetchAll($_where = NULL, $_order = NULL, $_dir = 'ASC', $_count = NULL, $_offset = NULL)
{
if ($_dir != 'ASC' && $_dir != 'DESC') {
throw new Tinebase_Exception_InvalidArgument('$_dir can be only ASC or DESC');
}
$order = NULL;
if ($_order !== NULL) {
$order = $_order . ' ' . $_dir;
}
// possibility to tracing queries
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE) && ($config = Tinebase_Core::getConfig()->logger)) {
if ($config->traceQueryOrigins) {
$e = new Exception();
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . "\n" . "BACKTRACE: \n" . $e->getTraceAsString() . "\n" . "SQL QUERY: \n" . $this->select()->assemble());
}
}
$rowSet = parent::fetchAll($_where, $order, $_count, $_offset);
return $rowSet;
}
示例14: loadDestinationData
/**
* loadDestinationData
* @author Thomas Schedler <tsh@massiveart.com>
* @version 1.0
*/
private function loadDestinationData()
{
try {
$objSelect = $this->objTable->select();
$objSelect->setIntegrityCheck(false);
$arrFields = array($this->strDBFLft, $this->strDBFRgt, $this->strDBFDepth);
if (!is_null($this->strDBFParent)) {
$arrFields[] = $this->strDBFParent;
}
if (!is_null($this->strDBFRoot)) {
$arrFields[] = $this->strDBFRoot;
}
$objSelect->from($this->objTable->info(Zend_Db_Table_Abstract::NAME), $arrFields);
$objSelect->where('id = ?', $this->intDestinationId);
$this->objDestinationData = $this->objTable->fetchAll($objSelect);
} catch (Exception $exc) {
$this->core->logger->err($exc);
}
}
示例15: fetchAll
/** Fetch all data
* @access public
* @param array $where
* @param string $order
* @param string $count
* @param integer $offset
* @return array
*/
public function fetchAll($where = null, $order = null, $count = null, $offset = null)
{
$id = md5($where->__toString());
if (!$this->_cache->test($id) || !$this->cache_result) {
$result = parent::fetchAll($where, $order, $count, $offset);
$this->_cache->save($result);
return $result;
} else {
return $this->_cache->load($id);
}
}