*Nothing new:*
So my models are very heavy and granular on functionality.

Controller actions calls -> method in model -> in turn may calls more 
methods in other related or same model etc.

each of these methods in models return boolean for success or failure.
I want each model method to be responsible for setting the flash message 
also.

the following approach works, but it doesn't seem very neat.

//Somewhere in a model method:

public function savethisstuff($data) {

if($not_ok){
        $this->error = __('My error message');
        return false;
    }
    return true;}

in my controller :

public function add(){
    if(!$this->Modelname->savethisstuff($this->request->data)){
        $this->Session->setFlash($this->Modelname->error);
    }}

writing to the session directly also does not seem like a very good idea 
either, because models can be used in shells where there is no session.
what could be the best way? Or Am I totally missing the point of something?


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to