symfony2 Set status code


Example

public function someAction(){
    
    // Action's code 

    return new Response($error, 500); 
}

Another example:

public function someAction(){
    
    // Action's code 

    $response = new Response(); 
    $response->setStatusCode(500)
    $response->setContent($content); 
    return $response;
}