public function delete($object) { // get database $db = $this->getDBO(); // update childrens parent category $query = "UPDATE " . $this->getTableName() . " SET parent=" . $object->parent . " WHERE parent=" . $object->id; $db->query($query); // delete category to item relations CategoryHelper::deleteCategoryItemRelations($object->id); return parent::delete($object); }
public function delete($object) { // delete related categories $table = YTable::getInstance('category'); $categories = $table->getAll($object->id); foreach ($categories as $category) { $table->delete($category); } // delete related items $table = YTable::getInstance('item'); $items = $table->findAll($object->id); foreach ($items as $item) { $table->delete($item); } return parent::delete($object); }
public function delete($object) { // get database $db = $this->getDBO(); // delete item to category relations $query = "DELETE FROM " . ZOO_TABLE_CATEGORY_ITEM . " WHERE item_id = " . (int) $object->id; $db->query($query); // delete related comments $query = "DELETE FROM " . ZOO_TABLE_COMMENT . " WHERE item_id = " . (int) $object->id; $db->query($query); // delete related search data rows $query = "DELETE FROM " . ZOO_TABLE_SEARCH . " WHERE item_id = " . (int) $object->id; $db->query($query); // delete related rating data rows $query = "DELETE FROM " . ZOO_TABLE_RATING . " WHERE item_id = " . (int) $object->id; $db->query($query); return parent::delete($object); }
public function delete($object) { // get database $db = $this->getDBO(); $old_parent = $object->id; $new_parent = $object->parent_id; parent::delete($object); $query = "UPDATE " . $this->getTableName() . " SET parent_id = " . $new_parent . " WHERE parent_id = " . $old_parent; return $db->query($query); }