mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 00:37:42 +02:00
[ticket/11495] Use item_id only as parameter for delete() and remove()
The data is acquired again anyway PHPBB3-11495
This commit is contained in:
@@ -113,21 +113,22 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function remove(array $item)
|
||||
public function remove($item_id)
|
||||
{
|
||||
$items = array_keys($this->get_branch_data($item[$this->column_item_id], 'children'));
|
||||
$items = $this->get_branch_data($item_id, 'children');
|
||||
$item_ids = array_keys($items);
|
||||
|
||||
$this->remove_subset($items, $item);
|
||||
$this->remove_subset($item_ids, $items[$item_id]);
|
||||
|
||||
return $items;
|
||||
return $item_ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function delete(array $item)
|
||||
public function delete($item_id)
|
||||
{
|
||||
$removed_items = $this->remove($item);
|
||||
$removed_items = $this->remove($item_id);
|
||||
|
||||
$sql = 'DELETE FROM ' . $this->table_name . '
|
||||
WHERE ' . $this->db->sql_in_set($this->column_item_id, $removed_items) . '
|
||||
|
@@ -38,20 +38,20 @@ interface phpbb_nestedset_interface
|
||||
*
|
||||
* Also removes all subitems from the nested set
|
||||
*
|
||||
* @param array $item The item to be removed
|
||||
* @return array Items that have been removed
|
||||
* @param int $item_id The item to be deleted
|
||||
* @return array Item ids that have been removed
|
||||
*/
|
||||
public function remove(array $item);
|
||||
public function remove($item);
|
||||
|
||||
/**
|
||||
* Delete an item from the nested set (also deletes the rows form the table)
|
||||
*
|
||||
* Also deletes all subitems from the nested set
|
||||
*
|
||||
* @param array $item The item to be deleted
|
||||
* @return array Items that have been deleted
|
||||
* @param int $item_id The item to be deleted
|
||||
* @return array Item ids that have been deleted
|
||||
*/
|
||||
public function delete(array $item);
|
||||
public function delete($item);
|
||||
|
||||
/**
|
||||
* Move an item by a given delta
|
||||
|
Reference in New Issue
Block a user