本文整理汇总了PHP中Zend_Db_Table_Abstract::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Table_Abstract::find方法的具体用法?PHP Zend_Db_Table_Abstract::find怎么用?PHP Zend_Db_Table_Abstract::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Table_Abstract
的用法示例。
在下文中一共展示了Zend_Db_Table_Abstract::find方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find
public function find($id)
{
$result = $this->dbTable->find($id);
if (0 == count($result)) {
return false;
}
$row = $result->current();
return array('id' => $row->id, 'state' => $row->state, 'info' => $row->info, 'lastupdate' => $row->lastupdate, 'sticked' => $row->sticked);
}
示例2: get
public function get($_id)
{
$resultRet = $this->dbTable->find($_id);
$enreg = $resultRet->current();
if ($enreg === null) {
return null;
}
$modelClassName = 'Application_Model_' . $this->className;
$result = new $modelClassName();
$result->fromArray($enreg);
return $result;
}
示例3: deleteEntry
/**
* Delete Entry
*
* @param Postr_Model_Entry $entry
* @return Postr_Model_EntryMapper Provides a fluent interface
*/
public function deleteEntry(Postr_Model_Entry $entry)
{
$dbAdapter = $this->_entryTable->getAdapter();
$dbAdapter->beginTransaction();
$entryRow = $this->_entryTable->find($entry->getId())->current();
$entryRow->delete();
$dbAdapter->commit();
return $this;
}
示例4: get
/**
* Returns the first row of the find query
*
* @param Integer|Array $primary
* @return Zend_Db_Table_Row
*/
public function get($pk)
{
// If the Primary Key is an Array
if (is_array($pk)) {
// Call the parent's find method with dynamic amount of parameters
return call_user_func_array(array($this, 'find'), $pk)->current();
}
// The primary Key Is a single column
return parent::find($pk)->current();
}
示例5: 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;
}
示例6: find
public function find($id)
{
$frontendOptions = array('lifetime' => 60 * 60 * 24, 'automatic_serialization' => true);
$backendOptions = array('cache_dir' => APPLICATION_CACHE_PATH);
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
$row = null;
if ($cache->test('role_' . $id)) {
$row = $cache->load('role_' . $id);
} else {
$row = parent::find($id)->current();
$cache->save($row, 'role_' . $row->id);
}
return $row;
}
示例7: find
/**
* Overwrite the find method to get relations too.
*
* @return Phprojekt_ActiveRecord_Abstract An instance of Phprojekt_ActiveRecord_Abstract.
*/
public function find()
{
$args = func_get_args();
if (1 > count($args)) {
throw new Phprojekt_ActiveRecord_Exception('Missing argument');
}
if (1 < count($args)) {
throw new Phprojekt_ActiveRecord_Exception('Too many arguments');
}
if (is_null($args[0])) {
throw new Phprojekt_ActiveRecord_Exception('Argument cannot be NULL');
}
$find = parent::find($args[0]);
if (false === is_array($find) || count($find) === 0) {
return $find;
}
$find = $find[0];
// Reset data as all our relatios, etc stuff has to
// deal with a new id
$this->_data = array();
$this->_storedId = null;
foreach ((array) $find->_data as $col => $value) {
$this->_data[self::convertVarFromSql($col)] = $value;
}
unset($find);
if (!array_key_exists('id', $this->_data)) {
throw new Phprojekt_ActiveRecord_Exception('Table must have an id');
}
$this->_storedId = $this->_data['id'];
$this->_originalData = $this->_data;
return $this;
}
示例8: find
/**
* 扩充了父类的同名方法,如果传入的是整形值或整数字符串,则取得主键值为该整形值的所有记录。
*
* @param mixed $key The value(s) of the primary keys.
* @return ZtChart_Model_Db_Table_Rowset Row(s) matching the criteria.
*/
public function find()
{
if (1 == func_num_args()) {
$primary = func_get_arg(0);
if ($this->_isInt($primary)) {
return parent::find(intval($primary));
}
}
return call_user_func_array(array('parent', 'find'), func_get_args());
}