src/Sulu/Bundle/SnippetBundle/Controller/SnippetController.php
public function deleteAction(Request $request, $id)
    {
        $locale = $this->getLocale($request);
        $webspaceKey = $request->query->get('webspace', null);

        $references = $this->snippetRepository->getReferences($id);

        if (count($references) > 0) {
            $force = $request->headers->get('SuluForceRemove', false);
            if ($force) {
                $this->contentMapper->delete($id, $webspaceKey, true);
            } else {
                return $this->getReferentialIntegrityResponse($webspaceKey, $references, $id, $locale);
            }
        } else {
            $this->contentMapper->delete($id, $webspaceKey);
        }

        return new JsonResponse();
    }
public function deleteAction(Request $request, $id)
    {
        $locale = $this->getLocale($request);
        $webspaceKey = $request->query->get('webspace', null);

        $references = $this->snippetRepository->getReferences($id);

        if (count($references) > 0) {
            $force = $request->headers->get('SuluForceRemove', false);
            if ($force) {
                $this->contentMapper->delete($id, $webspaceKey, true);
            } else {
                return $this->getReferentialIntegrityResponse($webspaceKey, $references, $id, $locale);
            }
        } else {
            $this->contentMapper->delete($id, $webspaceKey);
        }

        return new JsonResponse();
    }
public function deleteAction ( Request $ request , $ id ) { $ locale = $ this -> getLocale ( $ request ) ; $ webspaceKey = $ request -> query -> get ( 'webspace' , null ) ; $ references = $ this -> snippetRepository -> getReferences ( $ id ) ; if ( count ( $ references ) > 0 ) { $ force = $ request -> headers -> get ( 'SuluForceRemove' , false ) ; if ( $ force ) { $ this -> contentMapper -> delete ( $ id , $ webspaceKey , true ) ; } else { return $ this -> getReferentialIntegrityResponse ( $ webspaceKey , $ references , $ id , $ locale ) ; } } else { $ this -> contentMapper -> delete ( $ id , $ webspaceKey ) ; } return new JsonResponse ( ) ; }
Deletes an existing Snippet.

@param Request $request
@param string $id

@return JsonResponse
Deletes an existing Snippet .