public function changeArticleStatus(Request $request, $number, $language, $status) { $user = $this->container->get('user')->getCurrentUser(); $statuses = array('N', 'S', 'M', 'Y'); if (!in_array($status, $statuses)) { throw new InvalidParametersException('The provided Status is not valid, available: N, S, M, Y.'); } $articleObj = $this->getArticle($number, $language, $user); $success = $articleObj->setWorkflowStatus($status); $response = new Response(); if ($success) { $response->setStatusCode(201); } else { $response->setStatusCode(500); throw new \Exception('Setting status code failed'); } return $response; }