In my app, I want to add a user notification each time a user receives a comment on an image or other page. Therefore in my add action in my images controller, I’d like to also call the addNotifications action which is in my Notifications controller. I’m trying to stay away from requestAction based on the warnings, but is there another way?
Workflow is this:
New event occurs -> trigger addition of notification in notifications table -> email user that notification exists.
If it’s going to be a notification for all sorts of things, then I would consider something in the
app_controlleras this will make it available across your whole application. Meaning you’ll be able to call something likeThen you can deal with the other bits in your app controllers notify function. You might need to add your User model to your app_controller, which could be tricky.
I would try using
uses()as this could allow you to add the model and thus pull user data from your app_controller if you wanted to say include the users last login details, username or formal greeting etc. http://api.cakephp.org/class/controller