public static function removePublisher($name) { $publisher = self::$r->x->one->publisher->name($name)->find(); if (!empty($publisher->id)) { self::$r->trash($publisher); } }
/** * Execute a REST DELETE Request * * @param string $path RESTFul path to resource * * @return int ID of the stored object */ public function handleRESTDeleteRequest($path) { if (!is_string($path)) { return null; } $path = explode('/', $path); if (count($path) < 2) { return null; } try { $bean = $this->instance->load($path[0], $path[1]); $this->instance->trash($bean); return $path[1]; } catch (Exception $exception) { return null; } }