/** * @param ProductBindingModel $product * @throws \Exception * @Route("list") */ public function listNewProduct(ProductBindingModel $product) { if ($_POST['csrf'] !== $_SESSION["token"]) { http_response_code(400); ob_end_clean(); echo "CSRF not matching error"; die; } if (!$product->modelState()->isValid()) { http_response_code(400); ob_end_clean(); var_dump($product->modelState()->get()); die; } $this->_productsRepo->create($product); }