So am new to FuelPHP and am liking it a lot, features such as the namespaces, lightweightness of the framework and so on. But am really struggling to learn, its taking a lot longer than usual.
But anyways so am picking apart tutorials and generated code and everything and came across the Response class.
I looked at the dev_docs and docs and couldn't find what I needed so went to the source code of the class and basically found the reforge method just responds with the given content.
But in the Welcome class the code is as follows...
return Response::forge(View::forge('home/index'));
But I found that you can actually just use View::forge to return the content. So why in the Welcome class you use both classes and functions?
Returning nothing or string values (or anything that evaluates to string) was standard in v1.0, but is deprecated in v1.1.
Because we don't remove deprecated functionality until the next release, you can currently still use the old method, as you have found out. If you have logging active, you will see deprecated warnings in your logs.
In the next release (after v1.1) the code will be removed, and you will have to return a Response object. The current Response object does HTTP only, but towards the future it is likely that more response types will be supported.
Returning anything but a Reponse object is deprecated.
In previous versions, a string was exepected. Returning a view worked because it contains a __toString() magic method, which renders the view to a string when requested.
With whatever response you want to return.
Because it's not always about display, it could be an HMVC request that returns a response to the calling controller.