Пример #1
0
	public function destroy () {
		$this->requireParameter("id");

		$logo = ManufacturerICLogo::loadById($this->getParameter("id"));
		
		PartKeepr::getEM()->remove($logo);
		PartKeepr::getEM()->flush();

		return array("data" => null);
	}
Пример #2
0
use de\RaumZeitLabor\PartKeepr\PartKeepr;
use de\RaumZeitLabor\PartKeepr\Image\Image;
use de\RaumZeitLabor\PartKeepr\Image\CachedImage;
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 Image::IMAGE_ICLOGO:
			$image = ManufacturerICLogo::loadById($id);
			break;
		case Image::IMAGE_FOOTPRINT:
			$image = FootprintImage::loadById($id);
			break;
		case Image::IMAGE_PART:
			$image = PartImage::loadById($id);
			break;
		default:
			$image = null;
			// Add default image?
	}
	
} catch (\Exception $e) {
	$image = null;
	// Something bad happened