The issue I was seeing was that when I was calling Model.destroy() the error callback was being invoked every single time even on successful deletes. I confirmed that I was in fact getting a DELETE request on the Silex end, and that the deletion was being processed successfully. I figured that since the framework was doing everything right, I must have been doing something wrong.
After a bit of investigation I tracked down and fixed the issue. The problem was with the function that was handling the DELETE request. Specifically it was with the Response object it was returning. The original return statement looked like this...
PHP
return new Response('', Response::HTTP_OK);
In hindsight the issue should have been obvious immediately. The HTTP_OK (200) code has this requirement:
Aside from responses to CONNECT, a 200 response always has a payload, though an origin server MAY generate a payload body of zero length. If no payload is desired, an origin server ought to send 204 No Content instead.
I guess Backbone.js is strict about the payloads it receives if the status is 200. There were two possible solutions to this...
One solution - use code HTTP_NO_CONTENT (204) instead of 200...
PHP
return new Response('', Response:: HTTP_NO_CONTENT);
Another solution - return an empty JSON object as the payload...
PHP
return new Response('{}', Response::HTTP_OK);
The error in Backbone.js occured because it was trying to parse the response body as a JSON object whenever it saw a status of 200. So, using either the 204 status or an empty JSON object made it work as expected.
I opted for the second solution but both are valid.
-i