Open ama3ing opened 9 years ago
uhm .. not sure. what does the form layer do? I mean this should be caught by your validation rules ..?
Yeah, it should. Since $form->isValid()
returns false
. And actually response content returns form errors.
so you end up returning $form
?
what I suspect is that the form is not considered to be bound when there is no data and therefore the handler doesn't look at the form validation failure: https://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/View/ViewHandler.php#L200
@lsmith77, but still this is a bug IMHO
yeah .. I am not sure why we had the isBound()
check .. seems a bit unlikely that someone would pass a form instance for which they do not expect something to be bound, ie. where nothing bound would be considered an error.
anyway, can you try if the issue would be fixed by removing the isBound()
check?
@lsmith77 checked, that works. Created a PR for that :wink:
as discussed in the PR .. the isBound() call needs to stay. lets see if we can find an elegant way to handle this .. but I am not sure I like the idea to add a flag to the View
to be able to tell the ViewHandler
if to do the isBound()
check or not.
Hi guys, I've noticed a bit strange issue. Assume that I have form:
And controller:
So when I'm sending request like:
Everything works as expected. But when I am sending something like
Response status code is 201, but there is content indicating that form is invalid, what am I doing wrong :laughing:?