PHP midgard object method delete_attachments
Delete object's attachments.
boolean delete_attachments(array args);
This method takes one argument:
- args, associative array
Array's keys must be midgard_attachment properties' names, values should define constraints with properties's values.
Delete all attachments with matching properties' values. It's possible to undelete attachment which have been deleted with this method.
Blobs that are linked to attachment are not deleted because one blob can be linked to many attachments. Blobs are deleted with blob's remove_file function
Returns TRUE on success, FALSE otherwise.
Example
<?php
/* Delete all image attachments */
try {
$style = new midgard_style($guid);
} catch (Exception $e) {
echo $e->getMessage();
}
$args = array ("mimetype" => "image/jpeg");
if($style->delete_attachments($args))
echo "Deleted all image attachments";
?>
