I am using FuelPHP's rest controller.
I am trying to break the flow and display my response after encountering an error.
Here is my basic flow needed:
- When any of the methods are called I run a "validate" function, which validates parameters and other business logic.
- If the "validate" function determines something is off, I want to stop the entire script and display the errors I have complied so far.
I have tried the following in my "validate" function but it simply exits the validate function... then continues to the initial method being requested. How do I stop the script immediately and display the contents of this response?
return $this->response( array(
'error_count' => 2,
'error' => $this->data['errors'] //an array of error messages/codes
) );