/** * (non-PHPdoc) * @see de\RaumZeitLabor\PartKeepr\Service.RestfulService::destroy() */ public function destroy () { $this->requireParameter("id"); $file = FootprintAttachment::loadById($this->getParameter("id")); PartKeepr::getEM()->remove($file); PartKeepr::getEM()->flush(); return array("data" => null); }
use de\RaumZeitLabor\PartKeepr\Manufacturer\ManufacturerICLogo; include("../src/de/RaumZeitLabor/PartKeepr/PartKeepr.php"); PartKeepr::initialize(""); $type = $_REQUEST["type"]; $id = $_REQUEST["id"]; try { switch ($type) { case "PartAttachment": $file = PartAttachment::loadById($id); break; case "FootprintAttachment": $file = FootprintAttachment::loadById($id); break; default: $file = null; // Add default image? } } catch (\Exception $e) { $file = null; // Something bad happened } if ($file == null) { // Could not find the image, but maybe we want a temporary image? if (array_key_exists("tmpId", $_REQUEST)) { $file = TempUploadedFile::loadById($_REQUEST["tmpId"]);