本文整理汇总了PHP中Base_model::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Base_model::delete方法的具体用法?PHP Base_model::delete怎么用?PHP Base_model::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base_model
的用法示例。
在下文中一共展示了Base_model::delete方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Deletes one Author
* and the corresponding lang data
*
* @param int $id
*
* @return int Number of delete items in main table
*
*/
public function delete($id)
{
$nb_rows = parent::delete($id, $this->_author_table);
if ($nb_rows > 0) {
parent::delete($id, $this->_author_lang_table);
}
return $nb_rows;
}
示例2: delete_temp
public function delete_temp($Id = NULL)
{
$className = get_class($this);
if (isset($Id) && $Id != NULL) {
if (property_exists($className, $this->getStateKey())) {
return $this->db->update($this->getTableName(), array($this->getStateKey() => 0), array('Id' => $Id));
} else {
return $this->db->delete($this->getTableName(), array('Id' => $Id));
}
} else {
return parent::delete();
}
}
示例3: delete
/**
* Deletes one item definition
* Also deletes :
* - All items linked to this definition
* - All corresponding extend field & extend fields instances
* - Links between content & items
*
* @param null $id_item_definition
*
* @return int|void
*/
public function delete($id_item_definition)
{
// Items instances IDs
$item_ids = $this->get_keys_array('id_item', array($this->get_pk_name() => $id_item_definition), self::$_ITEM);
// Items Definition & Item definition langs
$where = array($this->get_pk_name() => $id_item_definition);
parent::delete($where);
parent::delete($where, $this->get_lang_table());
// Extend fields instances
if (!empty($item_ids)) {
parent::delete(array('parent' => 'item', 'where_in' => array('id_parent' => $item_ids)), self::$_EXTEND_FIELDS);
}
// Extend Field definition
parent::delete(array('parent' => 'item', 'id_parent' => $id_item_definition), self::$_EXTEND_FIELD);
// Item definition
parent::delete($where, self::$_ITEM);
// Items links to content
if (!empty($item_ids)) {
parent::delete(array('where_in' => array('id_parent' => $item_ids)), self::$_ITEMS);
}
}
示例4: remove
/**
* Remove one media
* Unlink it from all content
* Does not remove the source file
*
* @param $id_media
*/
public function remove($id_media)
{
$where = array('id_media' => $id_media);
parent::delete($where, 'media');
parent::delete($where, 'media_lang');
parent::delete($where, 'page_media');
parent::delete($where, 'article_media');
}
示例5: unlink_from_context
public function unlink_from_context($id_extend_field, $context, $id_context = NULL)
{
$where = array('id_extend_field' => $id_extend_field, 'context' => $context);
if (!is_null($id_context)) {
$where['id_context'] = $id_context;
}
if ($this->exists($where, self::$_CONTEXT_TABLE)) {
parent::delete($where, self::$_CONTEXT_TABLE);
}
}
示例6: delete_extend_field
public function delete_extend_field($id_extend_field)
{
// Begin transaction
$this->{$this->db_group}->trans_start();
// Definition
parent::delete(array('id_extend_field' => $id_extend_field), 'extend_field');
// Lang
parent::delete(array('id_extend_field' => $id_extend_field), 'extend_field_lang');
// Instances
$this->delete_extend_fields($id_extend_field);
// Context
parent::delete(array('id_extend_field' => $id_extend_field), 'extend_field_context');
// Transaction complete
$this->{$this->db_group}->trans_complete();
return $this->{$this->db_group}->trans_status();
}
示例7: delete_all
/**
* @param $id_tag
*
* @return bool|int|the
*/
public function delete_all($id_tag)
{
$affected_rows = parent::delete(array('id_tag' => $id_tag));
$this->{$this->db_group}->where('id_tag', $id_tag);
$this->{$this->db_group}->delete('article_tag');
return $affected_rows;
}
示例8: delete
public function delete($id_item)
{
$affected_rows = 0;
$item = $this->get($id_item);
// Check if exists
if ($this->exists(array($this->get_pk_name() => $id_item))) {
// Item
$affected_rows = parent::delete(array($this->get_pk_name() => $id_item));
// Extend fields content delete
$affected_rows += parent::delete(array('id_parent' => $id_item, 'parent' => 'item'), self::$_EXTEND_FIELDS);
// Links with content
$affected_rows += parent::delete(array('id_item' => $id_item), self::$_ITEMS);
$this->_reorder($item['id_item_definition']);
}
return $affected_rows;
}
示例9: delete_extend_field
public function delete_extend_field($id_extend_field)
{
try {
if (Event::has_listeners('Extend.field.delete.before')) {
// Listeners must throw one Exception if the item cannot be deleted
Event::fire('Extend.field.delete.before', $id_extend_field);
}
// Begin transaction
$this->{$this->db_group}->trans_start();
// Definition
parent::delete(array('id_extend_field' => $id_extend_field), 'extend_field');
// Lang
parent::delete(array('id_extend_field' => $id_extend_field), 'extend_field_lang');
// Instances
$this->delete_extend_fields($id_extend_field);
// Context
// parent::delete(array('id_extend_field'=>$id_extend_field), 'extend_field_context');
// Transaction complete
$this->{$this->db_group}->trans_complete();
return $this->{$this->db_group}->trans_status();
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
}
示例10: unlink_extend_from_element
public function unlink_extend_from_element($id_extend, $id_ui_element)
{
$where = array('id_extend' => $id_extend, 'id_ui_element' => $id_ui_element);
parent::delete($where, self::$_TBL_LK_EXTEND);
}