本文整理汇总了PHP中Zend_Db_Table::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Table::delete方法的具体用法?PHP Zend_Db_Table::delete怎么用?PHP Zend_Db_Table::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Table
的用法示例。
在下文中一共展示了Zend_Db_Table::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($id)
{
$db = $this->getAdapter();
$where = $db->quoteInto("id in(?)", $id);
$deletedRows = parent::delete($where);
return $deletedRows ? true : false;
}
示例2: delete
public function delete($where)
{
$rows_affected = parent::delete($where);
if ($rows_affected == 0) {
throw new Respondenci_Exception('Podany adres e-mail nie istnieje w bazie danych.');
}
}
示例3: delete
public function delete($id, $log = true)
{
$where = $this->getAdapter()->quoteInto('id = ?', $id);
parent::delete($where);
if ($log) {
log_sql($this->_name, $id, 'deleted');
set_session('notice', 'last record deleted');
}
}
示例4: del
/**
* Del new setting and return ID of the setting
*/
public function del($setting, $table)
{
global $logger;
$oTable = new Zend_Db_Table($table);
$where = $oTable->getAdapter()->quoteInto('id = ?', $setting->id);
$result = $oTable->delete($where);
$logger->log("Del setting {$table}={$setting->id}", Zend_Log::INFO);
return $result;
}
示例5: delete
/**
* delete с учётом удаления таблицы с публикациями
*
* @param array|string $where SQL WHERE clause(s).
* @return int The number of rows deleted.
*/
public function delete($where)
{
$resultSet = $this->fetchAll($where);
if (sizeof($resultSet)) {
foreach ($resultSet as $row) {
$_migrationManager = new Modules_Dbmigrations_Framework_Manager();
$_migrationManager->downTo('Modules_Publications_Migrations_CreatePublicationAbstractTable', $row->table_name);
}
}
return parent::delete($where);
}
示例6: addSite
/**
* Stores information about trusted/untrusted site for given user
*
* @param string $id user identity URL
* @param string $site site URL
* @param mixed $trusted trust data from extensions or just a boolean value
* @return bool
*/
public function addSite($id, $site, $trusted)
{
if (is_null($trusted)) {
$this->_sitesTable->select()->where('site = ?', $site);
$this->_sitesTable->delete($where);
return true;
}
$row = $this->_sitesTable->createRow();
$row->openid = $id;
$row->site = $site;
$row->time = date('Y-m-d H:i:s O');
$row->trusted = serialize($trusted);
$row->save();
return true;
}
示例7: delete
/**
* delete с учётом удаления поля из таблицы публикаций
*
* @param array|string $where SQL WHERE clause(s).
* @return int The number of rows deleted.
*/
public function delete($where)
{
$resultSet = $this->fetchAll($where);
if (sizeof($resultSet)) {
$modelList = new Modules_Publications_Model_List();
foreach ($resultSet as $row) {
$tableInfo = $modelList->fetchRow($modelList->select()->where('rubric_id = ?', $row->rubric_id));
$tableName = $tableInfo->table_name;
$filedName = $row->name;
$_migrationManager = new Modules_Dbmigrations_Framework_Manager();
$_migrationManager->downTo('Modules_Publications_Migrations_CreatePublicationAbstractFieled', array($tableName, $filedName));
}
}
return parent::delete($where);
}
示例8: productDeleteBefore
/**
* Handle product delete
*
* @param $event
* @return AW_Advancedreports_Model_Observer
*/
public function productDeleteBefore($event)
{
/** @var Mage_Catalog_Model_Product $product */
$product = $event->getProduct();
$searchSku = $product->getSku();
$sku = $product->getSku;
/** @var AW_Advancedreports_Model_Sku $skuRelevance */
$sku = Mage::getModel('advancedreports/sku');
$tableName = $sku->getResource()->getMainTable();
$writeAdapter = $this->_helper()->getWriteAdapter();
try {
$writeAdapter->beginTransaction();
$tableConnection = new Zend_Db_Table(array(Zend_Db_Table::ADAPTER => $writeAdapter, Zend_Db_Table::NAME => $tableName));
$tableConnection->delete("sku = '{$searchSku}'");
$writeAdapter->commit();
} catch (Exception $e) {
Mage::logException($e);
}
return $this;
}
示例9: deleteThread
/**
* Deletes a new thread, by marking it as deleted. If both users deleted it
* it is phisically deleted as well
*
* @param array $data: thread_id and user_id who is deleting
*/
public function deleteThread(array $data)
{
/* Fetch thread */
$threads_table = new Zend_Db_Table('threads');
$select = $threads_table->select()->where('id = ?', $data['thread_id']);
$thread = $threads_table->fetchRow($select);
/* Update flags */
if ($thread->user_from == $data['user_id']) {
$thread->deleted_from = 1;
} elseif ($thread->user_to == $data['user_id']) {
$thread->deleted_to = 1;
} else {
return null;
}
$thread->save();
/* If both deleted, delete physically */
if ($thread->deleted_from && $thread->deleted_to) {
$messages_table = new Zend_Db_Table('messages');
$whereM = $messages_table->getAdapter()->quoteInto('id = ?', $data['thread_id']);
$messages_table->delete($whereM);
$thread->delete();
}
return;
}
示例10: saveUserAttributes
public function saveUserAttributes(Application_Model_Models_User $user)
{
$paramsCount = func_num_args();
if ($paramsCount === 1) {
list($user) = func_get_args();
$attribs = $user->getAttributes();
} elseif ($paramsCount === 2) {
list($user, $attribs) = func_get_args();
} elseif ($paramsCount === 3) {
$params = func_get_args();
$user = array_shift($params);
$attribs = array($params[0] => $params[1]);
unset($params);
}
$dbTable = new Zend_Db_Table('user_attributes');
$userId = $user->getId();
$dbTable->delete(array('user_id = ?' => $userId));
if (is_array($attribs) && !empty($attribs)) {
foreach ($attribs as $name => $value) {
$dbTable->insert(array('user_id' => $userId, 'attribute' => $name, 'value' => $value));
}
$user->setAttributes($attribs);
}
return $user;
}
示例11: delete
/**
* 删除新闻
*
* @param array $arrayID
*/
public function delete($arrayID)
{
try {
//开启事务
$this->getAdapter()->beginTransaction();
//遍历所有ID
foreach ($arrayID as $id) {
//清除指定标识的缓存
$this->_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array(strtolower($this->_name)));
$this->_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array(strtolower($this->_name . '_findById_' . $id)));
}
//指定查询条件
$where = $this->getAdapter()->quoteInto('id in(?)', $arrayID);
parent::delete($where);
//提交查询
$this->getAdapter()->commit();
} catch (Zend_Exception $e) {
echo $e->getMessage();
//如果出错则事务回滚
$this->getAdapter()->rollBack();
}
}
示例12: delete
/**
* delete data overloaded to log the action
*/
public function delete($where)
{
$toreturn = parent::delete($where);
if ($toreturn > 0) {
$this->log('DELETE:' . $toreturn . ' row(s) deleted');
} else {
$this->log('DELETE:no row(s) deleted', Zend_Log::ERR);
}
return $toreturn;
}
示例13: delete
/**
* 删除ID所在行
* @param int or array $id
* @param string $column 字段名
* @see Zend_Db_Table_Abstract::delete()
* @return boolean 更新成功返回true,否则false
*/
public function delete($id, $column = 'id')
{
$db = $this->getAdapter();
$wherePre = $column . " in(?)";
$where = $db->quoteInto($wherePre, $id);
$deletedRows = parent::delete($where);
return $deletedRows ? true : false;
}
示例14: unregisterRecipients
/**
* Unregisters plugin custom recipients
* @param $pluginName
* @return Application_Model_Mappers_EmailTriggersMapper
*/
public function unregisterRecipients($pluginName)
{
$recipients = $this->_getRecipients($pluginName);
if (is_array($recipients) && !empty($recipients)) {
$recipientsTable = new Zend_Db_Table('email_triggers_recipient');
foreach ($recipients as $recipient) {
$recipientsTable->delete(array('recipient = ?' => $recipient));
}
}
return $this;
}
示例15: delete
public function delete($where)
{
$this->_db = CrFramework_Db_Control::getAdapter('write');
$this->setDefaultAdapter($this->_db);
logStd(get_class($this) . '->delete()', 'Write to MASTER');
return parent::delete($where);
}