src/User/Controller/RestController.php
public function delete($id)
	{
		$this->getResponse()
			->setStatusCode(Response::STATUS_CODE_200);
		
		// @todo Map available user roles using class constants if 
		// an ACL impementation is needed
		$forceLogout = true;
		if($this->zfcUserAuthentication()->hasIdentity()) {
			$identity = $this->zfcUserAuthentication()->getIdentity();
			$forceLogout = 'god' == $identity->getRole() ? false : true;
		}
		
		try {
			$userService = $this->getServiceLocator()->get('user.service.user');
			$userService->delete($id, $forceLogout);
			$data = array(
				'status' => 'success',
				'message' => 'Utente eliminato con successo'
			);
		} catch(\Exception $e) {
			$this->getResponse()
				->setStatusCode(Response::STATUS_CODE_500);
			$data = array(
				'status' => 'danger',
				'message' => $e->getMessage()
			);
		}
		
		return new JsonModel($data);
	}
public function delete($id)
	{
		$this->getResponse()
			->setStatusCode(Response::STATUS_CODE_200);
		
		// @todo Map available user roles using class constants if 
		// an ACL impementation is needed
		$forceLogout = true;
		if($this->zfcUserAuthentication()->hasIdentity()) {
			$identity = $this->zfcUserAuthentication()->getIdentity();
			$forceLogout = 'god' == $identity->getRole() ? false : true;
		}
		
		try {
			$userService = $this->getServiceLocator()->get('user.service.user');
			$userService->delete($id, $forceLogout);
			$data = array(
				'status' => 'success',
				'message' => 'Utente eliminato con successo'
			);
		} catch(\Exception $e) {
			$this->getResponse()
				->setStatusCode(Response::STATUS_CODE_500);
			$data = array(
				'status' => 'danger',
				'message' => $e->getMessage()
			);
		}
		
		return new JsonModel($data);
	}
public function delete ( $ id ) { $ this -> getResponse ( ) -> setStatusCode ( Response :: STATUS_CODE_200 ) ; // @todo Map available user roles using class constants if  // an ACL impementation is needed $ forceLogout = true ; if ( $ this -> zfcUserAuthentication ( ) -> hasIdentity ( ) ) { $ identity = $ this -> zfcUserAuthentication ( ) -> getIdentity ( ) ; $ forceLogout = 'god' == $ identity -> getRole ( ) ? false : true ; } try { $ userService = $ this -> getServiceLocator ( ) -> get ( 'user.service.user' ) ; $ userService -> delete ( $ id , $ forceLogout ) ; $ data = array ( 'status' => 'success' , 'message' => 'Utente eliminato con successo' ) ; } catch ( \ Exception $ e ) { $ this -> getResponse ( ) -> setStatusCode ( Response :: STATUS_CODE_500 ) ; $ data = array ( 'status' => 'danger' , 'message' => $ e -> getMessage ( ) ) ; } return new JsonModel ( $ data ) ; }
Respond to HTTP DELETE method with :id
@see \Zend\Mvc\Controller\AbstractRestfulController::delete()
Respond to HTTP DELETE method with : id