FriendsOfSymfony/FOSRestBundle — pull request #356 by j (2013-01-10 21:17:15+00:00)
Title: Empty responses

Fixes issue #355

I went ahead and set up defaults to make it somewhat BC... however, I made it so that the serializer, by default, never tries to serialize null values. I can change this default value, but I feel that you should never really have to serialize an explicitly set null value.

Here are some outputs of what this does:

1)
```php
echo $this->view()
```
Produces headers:
```
HTTP/1.1 204 No Content
Content-Type: application/json
Connection: keep-alive
cache-control: no-cache
date: Thu, 10 Jan 2013 21:05:48 GMT
```

2)
```php
echo $this->view(['content' => 'goes here!'])
```
Produces headers:
```
HTTP/1.1 200 OK
Content-Type: application/json
Connection: keep-alive
cache-control: no-cache
date: Thu, 10 Jan 2013 21:07:11 GMT

{ "content": "goes here!" }
```

3)
```php
echo $this->view()->setStatusCode(Codes::HTTP_NOT_FOUND);
```
Produces headers:
```
HTTP/1.1 404 Not Found
Content-Type: application/json
Connection: keep-alive
cache-control: no-cache
date: Thu, 10 Jan 2013 21:11:36 GMT
```

------------------

This functionality is disabled by default. To enable:
```yml
fos_rest:
view:
force_no_content_code: true
```

Included in this PR is also the ability to serialize null values. This is enabled by default. To disable and serialize null values:
This functionality is disabled by default. To enable:
```yml
fos_rest:
view:
should_serialize_null: true
```

... however, I don't know when this would be appropriate... and we can enforce never serializing null values in the ViewHandler and we can remove that commit.