Wednesday, February 27, 2013

Re: Calling functions in other controllers



On Wednesday, February 27, 2013 6:33:41 AM UTC+2, Yasir Arafat wrote:
Hello,
Before calling make sure you load the model of your cart model
like
$this->loadModel('Cart');


Since he is already including Cart in the $uses variable he does not need to call loadModel.

Also, the notation $this->Checkout->Cart is only relevant if the two models are related via an associate (i.e Checkout hasOne or hasMany Cart).  If the two models are not associated and the other model is loaded separately (either through $uses or through loadModel) then $this->Cart is the correct notation.

--
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 cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: