src/Sulu/Bundle/ContactBundle/Controller/ContactTitleController.php
public function deleteAction($id)
    {
        try {
            $delete = function($id) {
                /* @var ContactTitle $title */
                $title = $this->getDoctrine()
                    ->getRepository(self::$entityName)
                    ->find($id);

                if (!$title) {
                    throw new EntityNotFoundException(self::$entityName, $id);
                }

                $em = $this->getDoctrine()->getManager();
                $em->remove($title);
                $em->flush();
            };

            $view = $this->responseDelete($id, $delete);
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        }

        return $this->handleView($view);
    }
public function deleteAction($id)
    {
        try {
            $delete = function($id) {
                /* @var ContactTitle $title */
                $title = $this->getDoctrine()
                    ->getRepository(self::$entityName)
                    ->find($id);

                if (!$title) {
                    throw new EntityNotFoundException(self::$entityName, $id);
                }

                $em = $this->getDoctrine()->getManager();
                $em->remove($title);
                $em->flush();
            };

            $view = $this->responseDelete($id, $delete);
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        }

        return $this->handleView($view);
    }
public function deleteAction ( $ id ) { try { $ delete = function ( $ id ) { /* @var ContactTitle $title */ $ title = $ this -> getDoctrine ( ) -> getRepository ( self :: $ entityName ) -> find ( $ id ) ; if ( ! $ title ) { throw new EntityNotFoundException ( self :: $ entityName , $ id ) ; } $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> remove ( $ title ) ; $ em -> flush ( ) ; } ; $ view = $ this -> responseDelete ( $ id , $ delete ) ; } catch ( EntityNotFoundException $ enfe ) { $ view = $ this -> view ( $ enfe -> toArray ( ) , 404 ) ; } return $ this -> handleView ( $ view ) ; }
Delete a contact title for the given id.

@param $id

@return \Symfony\Component\HttpFoundation\Response
Delete a contact title for the given id .