On Fri, Mar 13, 2009 at 6:06 AM, Ernesto <[email protected]> wrote: > > Hello > > i have 2 models > Order hasMany Item > > each model has his own Controller > - OrdersController > - ItemsController > > in OrdersController i have a function like this > > function orderCode_exists ($orderCode) { > //this function checks if the order exists > } > > is there any way to call that function from ItemsController?
Better to put the method inside the Order model. That way, you can do $this->Order->checkExists($order_code) or, in the ItemsController, $this->Item->Order->checkExists($order_code). BTW, there's an exists() method in the Model class: http://api.cakephp.org/class/model#method-Modelexists You need to set the ID first to use it. However, i guess $orderCode is something else entirely. Just fyi. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
