/** * @Route("{id}/get") * @param int $int * @Method("GET") * @return Response */ public function get($id) { if ($this->securityContext->isUserAllowedToView($this->user)) { $styleMap = $this->styleManager->getById($id); if ($styleMap != null) { return $this->getSuccessMessage($styleMap); } else { return $this->getEmptyMessage($id); } } return $this->getErrorMessage("Get: Current user is not authorized to access style w ith id " . $id, HTTPStatusConstants::_UNAUTHORIZED); }
/** * @param string $styleMapId * @param string $styleId * @return bool * @throws \Symfony\Component\Config\Definition\Exception\Exception */ public function removeStyle($styleMapId, $styleId) { $styleMap = $this->getById($styleMapId); if ($styleMap) { $style = $this->styleManager->getById($styleId); if (!$style) { throw new Exception('Der Style kann nicht gelöscht werden. Er gehört nicht zu der Stylemap.'); } $style->removeStyleMapById($styleMapId); $styleMap->removeStyleById($styleId); $this->styleManager->save($style); return $this->save($styleMap) ? true : false; } return false; }