HI there,

I did a mod to my add function in a model/controller.

My model-1 view now has a button calling the add function of model-2
sending some parameters to be shown in the add view.

Now I want the model-2 to disable any add function inside the
conroller if no data was passed from model-1 (or via url).

Is there a best practise solution or is it ok just to do something
like the check done for id when deleting a record?:
        function edit($id = null) {
                if (!$id && empty($this->data)) {
                        $this->Session->setFlash(sprintf(__('Invalid %s', true),
'booking'));
                        $this->redirect(array('action' => 'index'));

Additional question I want to redirect to the calling model-1.
Hot to call model-1-index instead of model-2-index as shown?

Thanks

Michael

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to