Pass the HTTP status code directly in the constructor

My IDE is telling me this way of doing things doesn't not work
```
return new JSONResponse()->setStatus(Http::STATUS_NOT_FOUND);
```
This commit is contained in:
Olivier Paroz
2014-12-12 22:06:50 +01:00
committed by Lukas Reschke
parent a20eccfece
commit 4a8b44ff1f

View File

@@ -504,7 +504,7 @@ Each response subclass has access to the **setStatus** method which lets you set
// try to get author with $id
} catch (NotFoundException $ex) {
return new JSONResponse()->setStatus(Http::STATUS_NOT_FOUND);
return new JSONResponse(array(), Http::STATUS_NOT_FOUND);
}
}