Re: Call Functions of another controller.
well, what exactly Im trying to do is make a function that registers every movement of my application; I tried make a component but because depending of the parameters its the table that I extract the information; the component doesn't work so I tried the metod above cause was the one someone suggest me So I used requestAction in this way $results = $this->requestAction('/iptelpm_logs/bitacora/'. $numTables .'/'.$idTable .'/'.$keys .'/'.$mov.'/'.$model1 .'/'. $resource); And the only problem I had with it is that doesn't send and return arrays; but I controlled the function "bitacora" to prevent performance problems. Thanks everyone for your replys, and I want to know why don't use requestAction(), it's good know every point of view. On Mar 4, 1:34 pm, keymaster wrote: > You have these options: > 1. put the common function in a component. > 2. put the common function in appController. > 3. use requestAction() - (not good practise) > 4. combine all the actions of both controllers into a single > controller > 5. put the function in a model (if applicable) and have both > controllers access the model. > 6. put the common function in a file and include it in both > controllers (not good practise). > > Option #1 is recommended if it is only a few controllers sharing the > function. If all or most controllers need the function, option #2 is > best. The other options are not usually recommended. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Call Functions of another controller.
You have these options: 1. put the common function in a component. 2. put the common function in appController. 3. use requestAction() - (not good practise) 4. combine all the actions of both controllers into a single controller 5. put the function in a model (if applicable) and have both controllers access the model. 6. put the common function in a file and include it in both controllers (not good practise). Option #1 is recommended if it is only a few controllers sharing the function. If all or most controllers need the function, option #2 is best. The other options are not usually recommended. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Call Functions of another controller.
On Wed, Mar 4, 2009 at 4:33 PM, Max Granados wrote: > > Hello Everyone! > I want to now if someone knows how to call a function from another > controller, I have already tried > > $results = $this->WhateverModelIs->TheModelIWantToCall- > >thefunctionIwanttocall($passeddata); > > but cake sends me this notice: > > Notice: Undefined property: WhateverModelIs::$TheModelIWantToCall > Makes sense. You're trying to call a related model to WhateverModells when your message states you're trying to call a function from another *controller* (I'm confused). You might be able to use requestAction() but it depends on what you're trying achieve (requestAction() is not always recommended, as it can affect performance when abused) - Gonzalo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Call Functions of another controller.
On Mar 4, 7:33 pm, Max Granados wrote: > Hello Everyone! > I want to now if someone knows how to call a function from another > controller, I have already tried > > $results = $this->WhateverModelIs->TheModelIWantToCall- > > >thefunctionIwanttocall($passeddata); > > but cake sends me this notice: > > Notice: Undefined property: WhateverModelIs::$TheModelIWantToCall > > And I really don´t know what else can I do, I'd suggest not making up code and error messages and stating exactly what you're doing and exactly what you're getting. AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Call Functions of another controller.
Hello Everyone! I want to now if someone knows how to call a function from another controller, I have already tried $results = $this->WhateverModelIs->TheModelIWantToCall- >thefunctionIwanttocall($passeddata); but cake sends me this notice: Notice: Undefined property: WhateverModelIs::$TheModelIWantToCall And I really don´t know what else can I do, I'll apreciate your help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---