src/Sulu/Bundle/PageBundle/Controller/NodeController.php
public function deleteAction(Request $request, $id)
    {
        $language = $this->getLanguage($request);
        $webspace = $this->getWebspace($request);
        $force = $this->getBooleanRequestParameter($request, 'force', false, false);

        if (!$force) {
            $references = array_filter(
                $this->getRepository()->getReferences($id),
                function(PropertyInterface $reference) {
                    return $reference->getParent()->isNodeType('sulu:page');
                }
            );

            if (count($references) > 0) {
                $data = [
                    'structures' => [],
                    'other' => [],
                ];

                foreach ($references as $reference) {
                    $content = $this->get('sulu.content.mapper')->load(
                        $reference->getParent()->getIdentifier(),
                        $webspace,
                        $language,
                        true
                    );
                    $data['structures'][] = $content->toArray();
                }

                return $this->handleView($this->view($data, 409));
            }
        }

        $view = $this->responseDelete(
            $id,
            function($id) use ($webspace) {
                try {
                    $this->getRepository()->deleteNode($id, $webspace);
                } catch (DocumentNotFoundException $ex) {
                    throw new EntityNotFoundException('Content', $id);
                }
            }
        );

        return $this->handleView($view);
    }
public function deleteAction(Request $request, $id)
    {
        $language = $this->getLanguage($request);
        $webspace = $this->getWebspace($request);
        $force = $this->getBooleanRequestParameter($request, 'force', false, false);

        if (!$force) {
            $references = array_filter(
                $this->getRepository()->getReferences($id),
                function(PropertyInterface $reference) {
                    return $reference->getParent()->isNodeType('sulu:page');
                }
            );

            if (count($references) > 0) {
                $data = [
                    'structures' => [],
                    'other' => [],
                ];

                foreach ($references as $reference) {
                    $content = $this->get('sulu.content.mapper')->load(
                        $reference->getParent()->getIdentifier(),
                        $webspace,
                        $language,
                        true
                    );
                    $data['structures'][] = $content->toArray();
                }

                return $this->handleView($this->view($data, 409));
            }
        }

        $view = $this->responseDelete(
            $id,
            function($id) use ($webspace) {
                try {
                    $this->getRepository()->deleteNode($id, $webspace);
                } catch (DocumentNotFoundException $ex) {
                    throw new EntityNotFoundException('Content', $id);
                }
            }
        );

        return $this->handleView($view);
    }
public function deleteAction ( Request $ request , $ id ) { $ language = $ this -> getLanguage ( $ request ) ; $ webspace = $ this -> getWebspace ( $ request ) ; $ force = $ this -> getBooleanRequestParameter ( $ request , 'force' , false , false ) ; if ( ! $ force ) { $ references = array_filter ( $ this -> getRepository ( ) -> getReferences ( $ id ) , function ( PropertyInterface $ reference ) { return $ reference -> getParent ( ) -> isNodeType ( 'sulu:page' ) ; } ) ; if ( count ( $ references ) > 0 ) { $ data = [ 'structures' => [ ] , 'other' => [ ] , ] ; foreach ( $ references as $ reference ) { $ content = $ this -> get ( 'sulu.content.mapper' ) -> load ( $ reference -> getParent ( ) -> getIdentifier ( ) , $ webspace , $ language , true ) ; $ data [ 'structures' ] [ ] = $ content -> toArray ( ) ; } return $ this -> handleView ( $ this -> view ( $ data , 409 ) ) ; } } $ view = $ this -> responseDelete ( $ id , function ( $ id ) use ( $ webspace ) { try { $ this -> getRepository ( ) -> deleteNode ( $ id , $ webspace ) ; } catch ( DocumentNotFoundException $ ex ) { throw new EntityNotFoundException ( 'Content' , $ id ) ; } } ) ; return $ this -> handleView ( $ view ) ; }
deletes node with given id.

@param Request $request
@param string $id

@return \Symfony\Component\HttpFoundation\Response
deletes node with given id .