{"action":"closed","issue":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1013","labels_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1013/labels{/name}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1013/comments","events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/issues/1013/events","html_url":"https://github.com/FriendsOfSymfony/FOSRestBundle/issues/1013","id":68071811,"number":1013,"title":"How to change error message given by ParamFetcher","user":{"login":"feridmovsumov","id":2485826,"avatar_url":"https://avatars.githubusercontent.com/u/2485826?v=3","gravatar_id":"","url":"https://api.github.com/users/feridmovsumov","html_url":"https://github.com/feridmovsumov","followers_url":"https://api.github.com/users/feridmovsumov/followers","following_url":"https://api.github.com/users/feridmovsumov/following{/other_user}","gists_url":"https://api.github.com/users/feridmovsumov/gists{/gist_id}","starred_url":"https://api.github.com/users/feridmovsumov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feridmovsumov/subscriptions","organizations_url":"https://api.github.com/users/feridmovsumov/orgs","repos_url":"https://api.github.com/users/feridmovsumov/repos","events_url":"https://api.github.com/users/feridmovsumov/events{/privacy}","received_events_url":"https://api.github.com/users/feridmovsumov/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-04-13T11:12:42Z","updated_at":"2015-05-08T07:32:48Z","closed_at":"2015-05-08T07:32:48Z","body":"Validation with ParamFetcher is very elegant but error messages is not pretty\r\n\r\nFor example: \"Query parameter parent_id value 'a' violated a constraint (Query parameter value 'a', does not match requirements '\\\\d+')\"\r\n\r\nI want to convert this message to more simple message like: \"parent_id must be an integer\"\r\n\r\nHow can I do it?\r\n\r\n```php\r\n$constraint = new Regex(array(\r\n         'pattern' => '#^'.$config->requirements.'$#xsu',\r\n         'message' => sprintf(\r\n                    \"%s parameter value '%s', does not match requirements '%s'\",\r\n                    $paramType,\r\n                    $param,\r\n                    $config->requirements\r\n         ),\r\n));\r\n```\r\nhttps://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/Request/ParamFetcher.php#L220\r\n\r\nI asked a question about this subject on Stackoverflow http://stackoverflow.com/questions/29608164/how-to-change-an-error-message-given-by-paramfetcher"}}