Infrastructure
Exception
> Old version : HunterException was deprecated with Symfony 5/6 version
Create an Exception
All new Exception need to depends of : ResponseMessageException classes.
You need to change __construct signature with this :
public function __construct(array $context, ?Throwable $previous = null);
On the $context, on key|value needed (if key is not present, application can throw HTTP_CODE 500 error). The key needed was : status => StatusCode (StatusCode like 2001, 2002, …)
You need to add exception with HTTP_CODE in file : config/packages/fos_rest.yaml.
code:
App\YourNamespace\YourClass: HTTP_CODE