本文整理汇总了PHP中Zend_Db_Table_Select类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Table_Select类的具体用法?PHP Zend_Db_Table_Select怎么用?PHP Zend_Db_Table_Select使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Db_Table_Select类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
* Display a list of all users in the system.
*
*/
public function indexAction()
{
$filterStatus = $this->_getParam('status', 'any');
$filterTrigger = $this->_getParam('trigger', 'any');
$filterSort = $this->_getParam('sort', 'queueDt');
$filterDirection = $this->_getParam('direction', 'asc');
$form = new Ot_Form_EmailqueueSearch();
$form->populate($_GET);
$eq = new Ot_Model_DbTable_EmailQueue();
$select = new Zend_Db_Table_Select($eq);
if ($filterStatus != '' && $filterStatus != 'any') {
$select->where('status = ?', $filterStatus);
}
if ($filterTrigger != '' && $filterTrigger != 'any') {
$select->where('attributeName = ?', 'triggerActionId');
$select->where('attributeId = ?', $filterTrigger);
}
$select->order($filterSort . ' ' . $filterDirection);
$adapter = new Zend_Paginator_Adapter_DbSelect($select);
$paginator = new Zend_Paginator($adapter);
$paginator->setCurrentPageNumber($this->_getParam('page', 1));
$ta = new Ot_Model_DbTable_TriggerAction();
$actions = $ta->fetchAll();
$triggers = array();
foreach ($actions as $a) {
$triggers[$a->triggerActionId] = $a;
}
$this->_helper->pageTitle('ot-emailqueue-index:title');
$this->view->assign(array('paginator' => $paginator, 'form' => $form, 'interface' => true, 'sort' => $filterSort, 'direction' => $filterDirection, 'triggers' => $triggers));
}
示例2: getCertPath
public function getCertPath($extension = null)
{
$select = new Zend_Db_Table_Select(new WsServiceSmsCert());
$select->where('ghost IS FALSE')->where('is_archived IS FALSE');
$row = $this->findDependentRowset('WsServiceSmsCert', null, $select)->current();
if (null === $row) {
return null;
}
return APPLICATION_PATH . $row->file_path . DIRECTORY_SEPARATOR . $row->file_name . ($extension ? '.' . $extension : '');
}
示例3: onStatistics
public function onStatistics($event)
{
$table = Engine_Api::_()->getDbTable('playlists', 'music');
$select = new Zend_Db_Table_Select($table);
$select->from($table->info('name'), array('COUNT(*) AS count'));
$event->addResponse($select->query()->fetchColumn(0), 'playlist');
$table = Engine_Api::_()->getDbTable('playlistSongs', 'music');
$select = new Zend_Db_Table_Select($table);
$select->from($table->info('name'), array('COUNT(*) AS count'));
$event->addResponse($select->query()->fetchColumn(0), 'song');
}
示例4: __construct
function __construct(Zend_Db_Table_Select $select, $count = 15, $current = 1)
{
$table = $select->getTable();
$this->select = $select->distinct();
$this->row_count = $table->countRows($select);
$this->pages_count = intval(ceil($this->row_count / $count));
$current = min($current, $this->pages_count);
// selection les tuples de cette pages.
$select->limitPage($current, $count);
$rowset = $table->fetchAll($select);
parent::__construct($rowset, $count, $current);
$this->pages_id = range(1, $this->pagesCount(), 1);
}
示例5: parseSelect
private function parseSelect(\Zend_Db_Table_Select $select)
{
$return = array();
foreach ($select->getPart('columns') as $c) {
if ($c[1] instanceof \Zend_Db_Expr) {
$return[] = $c[1];
} elseif ($c[1] == '*') {
foreach ($this->table->info(\Zend_Db_Table_Abstract::COLS) as $col) {
$return[] = '`' . $c[0] . '`.`' . $col . '`';
}
} else {
$return[] = '`' . $c[0] . '`.`' . $c[1] . '`';
}
}
return $return;
}
示例6: _applySelectOptions
protected function _applySelectOptions(Zend_Db_Table_Select $select, array $options = array())
{
if (isset($options[self::OPTION_WHERE])) {
foreach ((array) $options[self::OPTION_WHERE] as $where) {
$select->where($where);
}
}
if (isset($options[self::OPTION_OR_WHERE])) {
foreach ((array) $options[self::OPTION_OR_WHERE] as $orWhere) {
$select->orWhere($orWhere);
}
}
if (isset($options[self::OPTION_HAVING])) {
foreach ((array) $options[self::OPTION_HAVING] as $having) {
$select->having($having);
}
}
if (isset($options[self::OPTION_ORDER])) {
foreach ((array) $options[self::OPTION_ORDER] as $order) {
$select->order($order);
}
}
$limit = isset($options[self::OPTION_LIMIT]) ? $options[self::OPTION_LIMIT] : null;
$offset = isset($options[self::OPTION_OFFSET]) ? $options[self::OPTION_OFFSET] : null;
$select->limit($limit, $offset);
return $select;
}
示例7: __construct
function __construct(Zend_Controller_Request_Abstract $request, array $orderFields, array $searchFields, Zend_Db_Table_Select $select, Zend_Db_Table_Select $selectFiltered)
{
// Load the params
$iDisplayStart = $request->getParam('iDisplayStart');
$iDisplayLength = $request->getParam('iDisplayLength');
$iSortingCols = intval($request->getParam('iSortingCols'));
$sSearch = $request->getParam('sSearch');
// Build sort array
$order = array();
if ($iSortingCols > 0) {
for ($i = 0; $i < $iSortingCols; $i++) {
if (array_key_exists($request->getParam('iSortCol_' . $i), $orderFields)) {
$order[] = $orderFields[$request->getParam('iSortCol_' . $i)] . ' ' . strtoupper($request->getParam('sSortDir_' . $i));
}
}
}
// Count the total rows
$selectCount = clone $select;
if (count($selectCount->getPart(Zend_Db_Table_Select::GROUP)) <= 0) {
$selectCount->reset(Zend_Db_Table_Select::COLUMNS)->columns(array('count' => 'COUNT(*)'));
$this->_totalCount = $selectCount->getTable()->fetchRow($selectCount)->count;
} else {
$this->_totalCount = $selectCount->getTable()->fetchAll($selectCount)->count();
}
// Append search
if ($sSearch !== null && $sSearch != '') {
$sSearch = '\'%' . $sSearch . '%\'';
$selectFiltered->where('(' . implode(' LIKE ' . $sSearch . ') OR (', $searchFields) . ' LIKE ' . $sSearch . ')');
}
// Count the filtered rows
$selectCount = clone $selectFiltered;
if (count($selectCount->getPart(Zend_Db_Table_Select::GROUP)) <= 0) {
$selectCount->reset(Zend_Db_Table_Select::COLUMNS)->columns(array('count' => 'COUNT(*)'));
$this->_filteredCount = $selectCount->getTable()->fetchRow($selectCount)->count;
} else {
$this->_filteredCount = $selectCount->getTable()->fetchAll($selectCount)->count();
}
// Load the limited result
$selectFiltered->limit($iDisplayLength, $iDisplayStart);
if (count($order) > 0) {
$selectFiltered->order($order);
}
$this->_data = $selectFiltered->getTable()->fetchAll($selectFiltered);
}
示例8: _getServiceGroup
/**
*
* @param string $groupType
* @return type
*/
protected function _getServiceGroup($groupType, $groupId = null)
{
$matchTable = "WsService" . ucfirst($groupType) . "Group";
$referenceTable = "WsClientHasServiceGroup";
if ($groupType == Wsclient::GROUP_SERVICE_SET) {
$matchTable = "WsServiceSet";
$referenceTable = "WsClientHasServiceSet";
}
$select = null;
if (false === class_exists($matchTable) || false === class_exists($referenceTable)) {
throw new Logic_Exception("Class {$matchTable} or {$referenceTable} not found!");
}
$select = new Zend_Db_Table_Select(new $matchTable());
$select->where('i.ghost=?', 'FALSE')->where('m.ghost=?', 'FALSE');
if (null !== $groupId) {
$select->where('m.id=?', $groupId);
}
return $this->_client->findManyToManyRowset($matchTable, $referenceTable, null, null, $select);
}
示例9: get_items_list_paginator
/**
* Pobranie listy delegacji i zwrócenie paginatora
* @param Zend_Db_Table_Select $statement - warunki dla których ma być pobrana lista
* @return Zend_Paginator - lista delegacji
*/
private function get_items_list_paginator(Zend_Db_Table_Select $statement)
{
$request = Zend_Controller_Front::getInstance()->getRequest();
$page = $request->getParam('page', 1);
$sort = $request->getParam('sort', 'id');
$order = $request->getParam('order', 'asc');
$statement->order("{$sort} {$order}");
$adapter = new Zend_Paginator_Adapter_DbTableSelect($statement);
$paginator = new Base_Paginator($adapter);
$paginator->setCurrentPageNumber($page);
return $paginator;
}
示例10: _order
/**
* Generate ORDER clause from user-supplied string or array
*
* @param string|array $order OPTIONAL An SQL ORDER clause.
* @return Zend_Db_Table_Select
*/
protected function _order(Zend_Db_Table_Select $select, $order)
{
if (!is_array($order)) {
$order = array($order);
}
foreach ($order as $val) {
$select->order($val);
}
return $select;
}
示例11: addRule
public function addRule(Zend_Db_Table_Select &$select)
{
$select->join(array("tr" => "trader"), "tr.id = trader_id");
}
示例12: _addJoinQuery
/**
* Add some data from other table, tests the joinTables
* property. If not empty add tables and join clauses.
*
* @param Zend_Db_Table_Select $select
* @param array $params
*
* @return Zend_Db_Table_Select
*/
private function _addJoinQuery($select, array $params = array())
{
if (isset($params['joinTables']) && count($params['joinTables'])) {
$this->_joinTables = $params['joinTables'];
}
/* If needs to add some data from other table, tests the joinTables
* property. If not empty add tables and join clauses.
*/
if (count($this->_joinTables) > 0) {
// Get the constraint attribute = foreign key to link tables.
$constraint = $params['constraint'];
// Loop on tables list(given by object class) to build the query
foreach ($this->_joinTables as $key => $object) {
//Create an object and fetch data from object.
$tmpObject = new $object();
$tmpDataTable = $tmpObject->getDataTableName();
$tmpIndexTable = $tmpObject->getIndexTableName();
$tmpColumnData = $tmpObject->getDataColumns();
$tmpColumnIndex = $tmpObject->getIndexColumns();
//Add data to tables list
$tables[$tmpDataTable] = $tmpColumnData;
$tables[$tmpIndexTable] = $tmpColumnIndex;
//Get the primary key of the first data object to join table
$tmpDataId = $tmpObject->getDataId();
// If it's the first loop, join first table to the current table
if ($key == 0) {
$select->joinLeft($tmpDataTable, $tmpDataId . ' = ' . $constraint);
//If there's an index table then it too and filter according language
if (!empty($tmpIndexTable)) {
$tmpIndexId = $tmpObject->getIndexId();
$select->joinLeft($tmpIndexTable, $tmpDataId . ' = ' . $tmpIndexId);
$select->where($tmpObject->getIndexLanguageId() . ' = ?', $this->_defaultEditLanguage);
}
/* If there's more than one table to link, store the current
* table name for the next loop
*/
if (count($this->_joinTables) > 1) {
$prevConstraint = $tmpObject->getConstraint();
}
} elseif ($key > 0) {
// We have an other table to join to previous.
$tmpDataId = $tmpObject->getDataId();
$select->joinLeft($tmpDataTable, $prevConstraint . ' = ' . $tmpDataId);
if (!empty($tmpIndexTable)) {
$tmpIndexId = $tmpObject->getIndexId();
$select->joinLeft($tmpIndexTable, $constraint . ' = ' . $tmpIndexId);
$select->where($tmpObject->getIndexLanguageId() . ' = ?', $this->_defaultEditLanguage);
}
}
}
}
return $select;
}
示例13: addWhereActive
protected function addWhereActive(Zend_Db_Table_Select $oSelect, $prefix = '')
{
$prefix && ($prefix .= '.');
$date = new Zend_Date();
$date->add('1', Zend_Date::DAY);
return $oSelect->where($prefix . 'PER > ?', $this->getDbTable()->PDO_dateFormat($date));
}
示例14: limit
public function limit($count = null, $offset = null)
{
if (is_array($count)) {
$offset = $count['start'];
$count = $count['limit'];
}
return parent::limit($count, $offset);
}
示例15: assemble
public function assemble()
{
$assembled = parent::assemble();
/** @var $logger Logger_Application_Logger */
$logger = Zend_Registry::get('logger');
$logger->log(__CLASS__ . ":: " . $assembled, "system", Zend_log::DEBUG);
return $assembled;
}