Now delete_instance() in resource classes receives the

full $resource record instead of the $id alone. Needed
to be able to specialize such method in some resource types.
This commit is contained in:
stronk7
2005-12-05 23:59:24 +00:00
parent 2d49ed8505
commit 88535c6753
+3 -7
View File
@@ -249,15 +249,11 @@ function update_instance($resource) {
}
function delete_instance($id) {
// Given an ID of an instance of this module,
function delete_instance($resource) {
// Given an object containing the resource data
// this function will permanently delete the instance
// and any data that depends on it.
if (! $resource = get_record("resource", "id", "$id")) {
return false;
}
$result = true;
if (! delete_records("resource", "id", "$resource->id")) {
@@ -310,7 +306,7 @@ function resource_delete_instance($id) {
$resourceclass = "resource_$resource->type";
$res = new $resourceclass();
return $res->delete_instance($id);
return $res->delete_instance($resource);
}