本文整理汇总了PHP中type::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP type::delete方法的具体用法?PHP type::delete怎么用?PHP type::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类type
的用法示例。
在下文中一共展示了type::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
*
* @param type $id
*/
public function delete($id)
{
try {
$this->repository->delete($id);
} catch (\Exception $e) {
return ['error' => 'true', 'messege' => "Produto não encontrado!"];
}
}
示例2: delete
/**
* Generic method to delete any album
*
* @param type $id
*
* @return type
*/
function delete($id)
{
/* action to perform any task befor deleting an album */
do_action('rtmedia_before_delete_album', $this);
/**
* First fetch all the media from that album
*/
add_filter('rt_db_model_per_page', array($this, 'set_queries_per_page'), 10, 2);
$page = 1;
$flag = true;
/**
* Delete each media from the album first
*/
while ($media = $this->media->model->get_by_album_id($id, $page)) {
$media_id = $media['result'][0]['media_id'];
$flag = wp_delete_attachment($media_id);
if (!$flag) {
break;
}
$page++;
}
/**
* If all the media are deleted from the album then delete the album at last.
*/
if ($flag) {
$this->media->delete($id);
}
/* action to perform any task after deleting an album */
do_action('rtmedia_after_delete_album', $this);
return $flag;
}
示例3: delete
/**
* Delete
*
* @return type
*/
public function delete()
{
if (is_array($this->primaryKey)) {
// @todo compound primary keys
}
$where = array($this->primaryKey => $this->originalData[$this->primaryKey]);
return $this->tableGateway->delete($where);
}
示例4: erase
/**
* Erase value of key
* @param type $key
* @return \Framework\Cache\Driver\Memcached
* @throws Exception\Service
*/
public function erase($key)
{
if (!$this->_isValidService()) {
throw new Exception\Service("Not connected to a valid service");
}
$this->_service->delete($key);
return $this;
}
示例5: destroy
/**
*
* @param type $id
*/
public function destroy($id)
{
$produto = $this->service->show($id);
if ($produto['error']) {
return redirect($this->url)->with("danger", $produto['messege']);
}
$this->service->delete($id);
return redirect($this->url)->with("success", "Produto excluido!");
}
示例6: destroy
/**
*
* @param type $id
*/
public function destroy($id)
{
$cliente = $this->service->show($id);
if ($cliente['error']) {
return redirect($this->url)->with("danger", $cliente['messege']);
}
$this->service->delete($id);
return redirect($this->url)->with("success", "Cliente excluido!");
}
示例7: destroy
/**
*
* @param type $id
*/
public function destroy($id)
{
$fornecedor = $this->service->show($id);
if ($fornecedor['error']) {
return redirect($this->url)->with("danger", $fornecedor['messege']);
}
$this->service->delete($id);
return redirect($this->url)->with("success", "Fornecedor excluido!");
}
示例8: delete
/**
* 删除数据
* $whereData说明:支持k、v、s的数组结构,
* 例如:$whereData = array(
* array('k'=>'shopId','v'=>1,'s'=>'='),
* array('k'=>'orderStatus','v'=>'waitpay','s'=>'='),
* array('k'=>'createdTime','v'=>'1365389457','s'=>'>='),
* )
* 默认数组元素之间的关系为AND关系,牵涉到具体规则按相应规则处理,规则如下:
* 1、若$whereData为以为数组,数组元素的键为属性名,则键值对之间的关系为“=”,数组元素之间的关系为AND关系.
* 例如:$whereData = array('shopId'=>1,'shopName'=>'kongfz'),则where条件为 shopId=1 && shopName='kongfz'
*
* 2、若$whereData为二维数组,数组元素的键为属性名,值为数组,则键值对之间的关系为IN关系。
* 例如:$whereData = array('shopId'=>array(1,2,3,..)),则where条件为 shopId in (1,2,3,..)
*
* 3、若$whereData中的数组元素的键为OR,则值必须包括两个及以上的数组,数组之间为OR关系;
* 例如:$whereData = array('shopId'=>1,
* 'OR'=>array('orderStatus'=>'waitSellerConfirmed','orderStatus'=>'waitPay')
* ),
* 则where条件之间的关系为:shopId=1 && (orderStatus='waitSellerConfirmed' && orderStatus='waitPay')
*
* 4、若$whereData为一维数组,且各个键为k、v、s,则where条件之间的关系是:$whereData['k']. $whereData['s']. $whereData['v']
* 例如:$whereData = array('k'=>'shopName','v'=>'%kongfz%','s'=>'like'),
* 则where条件之间的关系为:shopName like '%kongfz%'
*
* 5、若$whereData为二维数组,且一维数组的键k、v、s,$whereData['s'] = 'IN',$whereData['v']为一维数组,
* 则其关系为$whereData['k'] IN (implode(',',$whereData['v'])),
* 例如:$whereData = array('k'='shopId','v'=>array(1,2,3,..),'s'=>'IN'),
* 则其关系为shopId IN (1,2,3,...)
*
* 6、若$whereData 为多维数组,且数组都是满足k、v、s的数组结构,
* 例如:$whereData = array(
* array('k'=>'shopId','v'=>1,'s'=>'='),
* array('k'=>'orderStatus','v'=>'waitpay','s'=>'='),
* array('k'=>'createdTime','v'=>'1365389457','s'=>'>='),
* ),
* 则where条件之间的关系为:shopId=1 && orderStatus='waitpay' && createdTime>='1365389457'
* @param array $whereData 一维数组或k、v、s结构组成的数组。一维数组元素之间为and关系,键和值为等于关系;k、v、s结构数组,k:属性名,v:属性值,s:属性名和属性值之间的操作符
* @param string $table 删除数据的表,若为空,从默认表中删除数据
* @param boolean $isReturnAffectedRows 是否返回删除记录的条数,默认是不返回
* @return boolean
*/
public function delete(array $whereData, $table = '', $isReturnAffectedRows = false)
{
if (is_null($this->db)) {
$this->db = \Util\Db\Manager::getInstance($this->dbName);
}
//如果方法中没传递表名,则向默认表中插入数据
$table = is_string($table) && $table != '' ? $table : $this->defaultTable;
$state = $this->db->delete($table, $whereData);
if ($isReturnAffectedRows && $state) {
return $this->db->getAffectedRows();
}
return $state;
}
示例9: disable_page
/**
* Desactiva una página/controlador.
* @param type $page
*/
private function disable_page($page)
{
if ($page->name == $this->page->name) {
$this->new_error_msg("No puedes desactivar esta página (" . $page->name . ").");
} else {
if (!$page->delete()) {
$this->new_error_msg('Imposible eliminar la página ' . $page->name . '.');
}
}
}
示例10: destroy
/**
*
* @param type $id
*/
public function destroy($id)
{
$this->service->delete($id);
}
示例11: deleteUser
/**
*
* @param type $user
* @return type
*/
public function deleteUser($user)
{
return $user->delete();
}
示例12: clean_checked_tables
protected function clean_checked_tables()
{
self::$checked_tables = array();
$this->cache->delete('fs_checked_tables');
}
示例13: uninstall
/**
* Remove options values from the database.
*/
public function uninstall()
{
$this->options->delete();
}
示例14: deleteContact
/**
* Deletes a contact
* @param type $artist_id
* @return type
*/
public function deleteContact($contact_id)
{
$this->tableGateway->delete(array('contact_id' => $contact_id));
return;
}
示例15: deleteArtist
/**
*
* @param type $artist_id
* @return type
*/
public function deleteArtist($artist_id)
{
$this->tableGateway->delete(array('artist_id' => $artist_id));
return;
}