I'm developping some functonalities that perform some db related stuff so it should be in my active record model.
I would like to give some feedback to the user depending on the results of the db queries using setFlash
.
So my question is: is it a good practice to set a flash message inside a model instead of a controller?
You can access all these from the controller:
entry already exists - you have $model->isNewRecord
entry added - you have if($model->save()) { //successful } else { //unsuccessful }
The model should best be left to define the model, and not define which message should be displayed to the user - that's what controllers are for.