Re: Do I need to load a Model if I reference it in a contain?

2012-03-12 Thread Kro
Okay, I obviously need to get a better understanding of
'contain'...thanks again for taking the time...

On Mar 12, 11:34 pm, euromark  wrote:
> well, If you use it inside a contain there has to be a relation present!
> either in the model - hardcoded in $hasMany/$belongsTo or dynamically via
> bindModel()
>
> but without the relation definition the containable behavior doesnt know
> what to do with it.
>
> Am Montag, 12. März 2012 13:32:32 UTC+1 schrieb Kro:
>
>
>
>
>
>
>
>
>
> > I have removed 'var $uses' from a controller and replaced it with
> > calls to 'loadModel()'. I'm just wondering if I need to load a model
> > which isn't referenced directly in a function, but is referenced in a
> > contain.
> > e.g.
>
> > $contain =
> > array('SurveyResponse'=>array('SurveyQuestion'),'BookingOrder'=>array('Room 
> > ','Rate','AddOnPurchase'=>array('AddOn')));
> > //
> > Association between Booking and SurveyResponse in SurveyResponse Model
> > $this->Booking->contain($contain);
>
> > Is it necessary to load the 'SurveyResponse' Model as it is mentioned
> > in the above contain statement for the Booking Model?
>
> > Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Do I need to load a Model if I reference it in a contain?

2012-03-12 Thread euromark
well, If you use it inside a contain there has to be a relation present!
either in the model - hardcoded in $hasMany/$belongsTo or dynamically via 
bindModel()

but without the relation definition the containable behavior doesnt know 
what to do with it.


Am Montag, 12. März 2012 13:32:32 UTC+1 schrieb Kro:
>
> I have removed 'var $uses' from a controller and replaced it with 
> calls to 'loadModel()'. I'm just wondering if I need to load a model 
> which isn't referenced directly in a function, but is referenced in a 
> contain. 
> e.g. 
>
> $contain = 
> array('SurveyResponse'=>array('SurveyQuestion'),'BookingOrder'=>array('Room','Rate','AddOnPurchase'=>array('AddOn')));
>  
> // 
> Association between Booking and SurveyResponse in SurveyResponse Model 
> $this->Booking->contain($contain); 
>
> Is it necessary to load the 'SurveyResponse' Model as it is mentioned 
> in the above contain statement for the Booking Model? 
>
> Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Do I need to load a Model if I reference it in a contain?

2012-03-12 Thread Kro
Thanks for the reply. So in the above scenario (contain reference to
'SurveyRespose') I would need to load the 'SurveyResponse' Model as it
is not related to the 'Booking' Model?

On Mar 12, 2:25 pm, euromark  wrote:
> no
> not if there is a relation between those models and you properly access it
> via chain:
>
>     $this->Booking->SurveyResponse->find();
> etc
>
> Am Montag, 12. März 2012 13:32:32 UTC+1 schrieb Kro:
>
>
>
>
>
>
>
>
>
> > I have removed 'var $uses' from a controller and replaced it with
> > calls to 'loadModel()'. I'm just wondering if I need to load a model
> > which isn't referenced directly in a function, but is referenced in a
> > contain.
> > e.g.
>
> > $contain =
> > array('SurveyResponse'=>array('SurveyQuestion'),'BookingOrder'=>array('Room 
> > ','Rate','AddOnPurchase'=>array('AddOn')));
> > //
> > Association between Booking and SurveyResponse in SurveyResponse Model
> > $this->Booking->contain($contain);
>
> > Is it necessary to load the 'SurveyResponse' Model as it is mentioned
> > in the above contain statement for the Booking Model?
>
> > Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Do I need to load a Model if I reference it in a contain?

2012-03-12 Thread euromark
no
not if there is a relation between those models and you properly access it 
via chain:

$this->Booking->SurveyResponse->find();
etc


Am Montag, 12. März 2012 13:32:32 UTC+1 schrieb Kro:
>
> I have removed 'var $uses' from a controller and replaced it with 
> calls to 'loadModel()'. I'm just wondering if I need to load a model 
> which isn't referenced directly in a function, but is referenced in a 
> contain. 
> e.g. 
>
> $contain = 
> array('SurveyResponse'=>array('SurveyQuestion'),'BookingOrder'=>array('Room','Rate','AddOnPurchase'=>array('AddOn')));
>  
> // 
> Association between Booking and SurveyResponse in SurveyResponse Model 
> $this->Booking->contain($contain); 
>
> Is it necessary to load the 'SurveyResponse' Model as it is mentioned 
> in the above contain statement for the Booking Model? 
>
> Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Do I need to load a Model if I reference it in a contain?

2012-03-12 Thread Kro
I have removed 'var $uses' from a controller and replaced it with
calls to 'loadModel()'. I'm just wondering if I need to load a model
which isn't referenced directly in a function, but is referenced in a
contain.
e.g.

$contain =
array('SurveyResponse'=>array('SurveyQuestion'),'BookingOrder'=>array('Room','Rate','AddOnPurchase'=>array('AddOn')));
 //
Association between Booking and SurveyResponse in SurveyResponse Model
$this->Booking->contain($contain);

Is it necessary to load the 'SurveyResponse' Model as it is mentioned
in the above contain statement for the Booking Model?

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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