php - FOSRestBundle - POST went fine, but when use PUT/PATCH $request is null -


I was following this tutorial and then I've added a new unit, author.

Using GET, Post and Delete everything goes as expected, but when I use PUT or Patch, it results in:

 < Code> ["message": "Exception occurred when executing 'author (id, name), password) [16, blank, blank] with parameters (?,?,?)' Parameter: \ n \ nSQLSTATE [23502 ]: Not an empty violation: (...)  

I get this header:

  Allow +, keep, patch, cache -Remove control No-cache connection → live-content content-type → app / jason date → Tuesday, October 28, 2014 14:30:10 GMT server → nginx / 1.1.19 transfer-encoding → selected X-Debug-Token → 6d899c X- Debug-token-link → / api / _profiler/6d899cx-power-by → PHP / 5.4.33-2 + deb.sury.org ~ exact + 1  

This is my PHP code Public function putAuthorAction (Request $ request, $ id) {Try {if (! ($ Author = $ this-> Container-> ('Acme_blog.author. Handler ') -> Get ($ ID)) {$ statusCode = Codes :: HTTP_CREATED; $ Author = $ this- & gt; Container-> Receive ('acme_blog.author.handler') - & gt; Post ($ request-> Request-> All ()); } And {$ statusCode = code :: HTTP_NO_CONTENT; $ Author = $ this- & gt; Container-> Receive ('acme_blog.author.handler') - & gt; Put ($ author, $ request-> request-> all ()); } $ RouteOptions = Array ('id' = & gt; $ author- & gt; getId (), '_format' = & gt; $ request- & gt; (('_ format');); $ This- & gt; Return routeRedirectView ('get_author', $ route option, $ statusCode); } Hold (invalid form exceptions $ exceptions) {return $ exception-& gt; GetForm (); }}

and then I have a

  back $ request-> Request-> all ();  

Before attempting a block inside putAuthorAction and I get an empty array as a response ...

Is anyone having a similar problem?

I have already tried to do this but there is no success ..

I am using Postman extension in Chromium to test ... (and Sorry for my english, this is not my primary language)


Comments

Popular posts from this blog

Active Directory Authenticated Proxy Server with Squid or CNTLM -

java - Can't add JTree to JPanel of a JInternalFrame -

c - The joining operator ";" in my shell isn't working properly -