本文整理汇总了PHP中Zend_Db_Table_Abstract::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Table_Abstract::select方法的具体用法?PHP Zend_Db_Table_Abstract::select怎么用?PHP Zend_Db_Table_Abstract::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Table_Abstract
的用法示例。
在下文中一共展示了Zend_Db_Table_Abstract::select方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: select
public function select($withFromPart = self::SELECT_WITHOUT_FROM_PART)
{
$Select = parent::select($withFromPart);
$Select->assemble();
$Select->setIntegrityCheck(false);
return $Select;
}
示例3: __construct
/**
* Creating a query using a Model.
*
* @param Zend_Db_Table_Abstract $model
* @param array $relationmap Relation map for joins
*
* @return $this
*/
public function __construct(Zend_Db_Table_Abstract $model, array $relationMap = array())
{
$this->_model = $model;
$this->_relationMap = $relationMap;
$info = $model->info();
$select = $model->select();
$map = $info['referenceMap'];
$map = array_merge_recursive($map, $this->_relationMap);
if (is_array($map) && count($map) > 0) {
$select->setIntegrityCheck(false);
$columnsToRemove = array();
foreach ($map as $sel) {
if (is_array($sel['columns'])) {
$columnsToRemove = array_merge($columnsToRemove, $sel['columns']);
} else {
$columnsToRemove[] = $sel['columns'];
}
}
$columnsMainTable = array_diff($info['cols'], $columnsToRemove);
$select->from($info['name'], $columnsMainTable, $info['schema']);
$tAlias = array($info['name'] => 1);
$this->_setJoins($info['name'], $map, $select, $tAlias);
} else {
$select->from($info['name'], $info['cols'], $info['schema']);
}
parent::__construct($select);
return $this;
}
示例4: select
public function select($withFromPart = self::SELECT_WITHOUT_FROM_PART)
{
$select = parent::select($withFromPart);
if ($this->_multilang_type == 1 && $this->_current_lang) {
$select->where('`lang` = ' . $this->_current_lang->id);
}
return $select;
}
示例5: getSelect
/**
* Returns a \Zend_Db_Table_Select object to work with
*
* @return \Zend_Db_Table_Select
*/
public function getSelect()
{
if ($this->hasItemsUsed()) {
$select = $this->_table->select(\Zend_Db_Table_Abstract::SELECT_WITHOUT_FROM_PART);
$select->from($this->_getTableName($this->_table), array());
return $select;
} else {
return $this->_table->select(\Zend_Db_Table_Abstract::SELECT_WITH_FROM_PART);
}
}
示例6: getAttribute
public function getAttribute($id)
{
if (isset($this->_attributes[$id])) {
return $this->_attributes[$id];
} elseif (is_numeric($id)) {
$attribute = $this->_attributeModel->find($id)->current();
} else {
$where = $this->_attributeModel->select()->where($this->_attributeFieldName . ' = ?', $id);
$attribute = $this->_attributeModel->fetchRow($where);
}
$this->cacheAttribute($attribute);
return $attribute;
}
示例7: _parseData
/**
* Get data from database table if avalid
* @return array
*/
protected function _parseData()
{
$data = $this->_data;
if ($this->_adapter) {
$select = $this->_adapter->select()->where("language=?", $this->_language);
$stmt = $select->query();
if ($stmt) {
while ($row = $stmt->fetch()) {
$data[] = array(self::MESSAGE_ID_KEY => $row[self::MESSAGE_ID_KEY], self::MESSAGE_STRING_KEY => $this->replaceEndLineCharacter($row[self::MESSAGE_STRING_KEY]));
}
$stmt->closeCursor();
}
unset($select, $row, $stmt);
}
return $data;
}
示例8: loadRow
public function loadRow($value, $field = false) {
$select = $this->table->select();
//$this->table->getAdapter()->quote($v)
// Check if value is an array
if (is_array($value)) {
foreach ($value as $k => $v) {
$select->where("`$k` = ?", $v);
}
}
else {
if (!$field) {
$field = $this->table->getPrimary();
}
$select->where("`$field` = ?", $value);
}
$this->row = $this->table->fetchRow($select);
}
示例9: 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);
}
}
示例10: testDbTableSelectDoesNotThrowException
public function testDbTableSelectDoesNotThrowException()
{
$adapter = new Zend_Paginator_Adapter_DbSelect($this->_table->select());
$count = $adapter->count();
$this->assertEquals(500, $count);
}
示例11: select
public function select($withFromPart = self::SELECT_WITHOUT_FROM_PART)
{
$select = parent::select($withFromPart);
$select->where('removed = ?', false);
return $select;
}
示例12: indexOfEntries
/**
* Index Of Entries
*
* @return Zend_Paginator
*/
public function indexOfEntries()
{
$entrySelect = $this->_entryTable->select();
$paginator = new Zend_Paginator(new Postr_Model_EntryPaginatorAdapter($entrySelect, $this));
return $paginator;
}