Controller/ConfigController.php
public function deleteAction($id)
	{
		if ( false === $this->get('security.authorization_checker')->isGranted('ROLE_ADMIN') )
			throw new AccessDeniedException();
		  
		$config = $this->get('asf_website.config.manager')->getRepository()->findOneBy(array('id' => $id));

		try {
			$this->get('asf_website.config.manager')->getEntityManager()->remove($config);
			$this->get('asf_website.config.manager')->getEntityManager()->flush();
			
			$this->get('asf_layout.flash_message')->success($this->get('translator')->trans('The website config "%name%" successfully deleted.', array('%name%' => $config->getName()), 'asf_website'));
				
		} catch (\Exception $e) {
			$this->get('asf_layout.flash_message')->danger($e->getMessage());
		}

		return $this->redirect($this->get('router')->generate('asf_website_config_list'));
	}
public function deleteAction($id)
	{
		if ( false === $this->get('security.authorization_checker')->isGranted('ROLE_ADMIN') )
			throw new AccessDeniedException();
		  
		$config = $this->get('asf_website.config.manager')->getRepository()->findOneBy(array('id' => $id));

		try {
			$this->get('asf_website.config.manager')->getEntityManager()->remove($config);
			$this->get('asf_website.config.manager')->getEntityManager()->flush();
			
			$this->get('asf_layout.flash_message')->success($this->get('translator')->trans('The website config "%name%" successfully deleted.', array('%name%' => $config->getName()), 'asf_website'));
				
		} catch (\Exception $e) {
			$this->get('asf_layout.flash_message')->danger($e->getMessage());
		}

		return $this->redirect($this->get('router')->generate('asf_website_config_list'));
	}
public function deleteAction ( $ id ) { if ( false === $ this -> get ( 'security.authorization_checker' ) -> isGranted ( 'ROLE_ADMIN' ) ) throw new AccessDeniedException ( ) ; $ config = $ this -> get ( 'asf_website.config.manager' ) -> getRepository ( ) -> findOneBy ( array ( 'id' => $ id ) ) ; try { $ this -> get ( 'asf_website.config.manager' ) -> getEntityManager ( ) -> remove ( $ config ) ; $ this -> get ( 'asf_website.config.manager' ) -> getEntityManager ( ) -> flush ( ) ; $ this -> get ( 'asf_layout.flash_message' ) -> success ( $ this -> get ( 'translator' ) -> trans ( 'The website config "%name%" successfully deleted.' , array ( '%name%' => $ config -> getName ( ) ) , 'asf_website' ) ) ; } catch ( \ Exception $ e ) { $ this -> get ( 'asf_layout.flash_message' ) -> danger ( $ e -> getMessage ( ) ) ; } return $ this -> redirect ( $ this -> get ( 'router' ) -> generate ( 'asf_website_config_list' ) ) ; }
Delete a website config

@param  integer $id           ASFWebsiteBundle:Config Entity ID

@throws AccessDeniedException If authenticate user is not allowed to access to this resource (minimum ROLE_ADMIN)
@throws \Exception            Error on Config not found or on removing element from DB

@return \Symfony\Component\HttpFoundation\RedirectResponse
Delete a website config