You should also be using the singular form for the model names, whether in $this->ModelName context, 'className' => 'ClassName', or as $data array key. The plural (and lowercase) form is for DB table name or controller name/routes.
On Mon, Sep 21, 2009 at 6:41 PM, #2Will <[email protected]> wrote: > > hmm, actually, te containable thing isn't required then is it? it is > just for restricting the data, not expanding it. i just needed the > recursive. durr. > > > > On Sep 21, 11:25 pm, "#2Will" <[email protected]> wrote: >> Hi, thanks for responding. >> >> i get a Undefined index: Clients >> >> I was thinking part of the problem is getting confused between the >> conventions surrounding pluralizing or not classnames. But i now seem >> to have eliminated any warnings at the top of the page about things >> like "Model "TaxAffiliate" is not associated with model "Client"" so >> now im tm not sure whats up. >> >> tick tick.... update: >> >> i workedit out. Thanks Hols, you set me off looking at it again and i >> realised: >> >> $this->Application->recursive = 2; >> >> is important! i didn't have this set, so it was only going 1 layer >> in. >> >> Brilliant, makes sense, can go to sleep happy. >> >> On Sep 21, 10:48 pm, Hols Kay <[email protected]> wrote: >> >> > What happens if you just use $application['Clients']['tax_rate'] in >> > your view instead of preceding it with your main model? >> >> > On Sep 21, 8:42 am, "#2Will" <[email protected]> wrote: >> >> > > Hi, Im getting in a muddle with associations. >> >> > > I have tables >> >> > > clients, tax_affiliates and applications >> >> > > in my applications view, i want to show rate, which is stored in the >> > > client table. >> >> > > $application['TaxAffiliates']['Clients']['tax_rate'] >> >> > > but that gets me "Undefined index: Clients " >> >> > > applications have a tax_affiliates_id and belong like this >> >> > > var $belongsTo = array( >> > > 'TaxAffiliate' => array( >> > > 'className' => 'TaxAffiliate', >> > > 'foreignKey' => 'tax_affiliates_id', >> > > 'conditions' => '', >> > > 'fields' => '', >> > > 'order' => '' >> > > ) >> > > ); >> >> > > taxAffiliates belong to clients like this: >> >> > > var $belongsTo = array( >> > > 'Clients' => array( >> > > 'className' => 'Clients', >> > > 'foreignKey' => 'clients_id', >> > > 'conditions' => '', >> > > 'fields' => '', >> > > 'order' => '' >> > > ) >> > > ); >> >> > > in my applications controler i have this >> >> > > $this->Application->contain(array('TaxAffiliates'=>array('Client'))); >> >> > > and in the app_model i have set var $actsAs = array('Containable'); >> >> > > I have a feeling it's not even looking in the TaxAffiliate model, as >> > > when i delete it i get the same result. >> >> > > appreciate any guidence towards being able to get at information >> > > deeper than the first level of association. >> >> > > Thanks >> >> > > Will. > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
