I've been reading CakePHP's 2.0 migration guide where it's stated that cakeError()
has been removed because it was used for exceptions. It's a really weird change IMHO because I used it to block access to unauthorized users or to trigger an error when the paginated items exceeded the total, and things like that.
And now what? Should I just throw a die()
or a redirect? I really want to let know the users that something was not found and Cake used to provie a stright way to do so... now it doesn't.
Any thoughts/hacks/workarounds about it? Thanks, happy holidays!
You have to throw the corresponding exception, in your case the NotFoundException
:
throw new NotFoundException();
See also the chapter about exceptions in the cook book.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With