cake-php@googlegroups.com
[Top] [All Lists]

Re: falsefalse

Subject: Re: falsefalse
From: "Arak Tai'Roth"
Date: Thu, 25 Feb 2010 11:05:41 -0800 PST
I'll post the important parts. My models are slightly bigger then
this, but they only contain other associations not related to this,
validation, or functions.

This is Permit.php

var $hasAndBelongsToMany = array(
                        'Activity' => array(
                                'className' => 'Activity',
                                'joinTable' => 'permits_activities',
                                'foreignKey' => 'permit_id',
                                'associationForeignKey' => 'activity_id',
                                'unique' => true,
                                'fields' => array(
                                        'Activity.activity_name'
                                )
                        )
                );

                var $belongsTo = array(
                        'RegistrationLocation' => array(
                                'className' => 'RegistrationLocation',
                                'foreignKey' => 'registration_location_id',
                                'fields' => array(
                                        
'RegistrationLocation.registration_location_name'
                                )
                        ),
                        'User' => array(
                                'className' => 'User',
                                'foreignKey' => 'user_id',
                                'fields' => array(
                                        'User.first_name', 'User.last_name'
                                )
                        ),
                        'Leader' => array(
                                'className' => 'Leader',
                                'foreignKey' => 'leader_id',
                                'fields' => array(
                                        'Leader.first_name', 
'Leader.last_name', 'Leader.address',
'Leader.city', 'Leader.prov_state_id', 'Leader.country_id',
'Leader.postal_code', 'Leader.phone_number',
'Leader.emergency_phone_number'
                                )
                        )
                );

And this Leader.php

                var $hasMany = array(
                        'Permit' => array(
                                'className' => 'Permit',
                                'foreign_key' => 'leader_id',
                                'fields' => array(
                                        'Permit.id', 'Permit.date_in', 
'Permit.date_out',
'Permit.group_size', 'Permit.deregistration', 'Permit.checked_in'
                                )
                        )
                );

                var $belongsTo = array(
                        'User' => array(
                                'className' => 'User',
                                'foreignKey' => 'user_id'
                        ),
                        'Country' => array(
                                'className' => 'Country',
                                'foreignKey' => 'country_id',
                                'fields' => array(
                                        'Country.printable_name'
                                )
                        ),
                        'ProvState' => array(
                                'className' => 'ProvState',
                                'foreignKey' => 'prov_state_id',
                                'fields' => array(
                                        'ProvState.name'
                                )
                        )
                );

I have nothing for Country or ProvState.

On Feb 25, 12:16 pm, John Andersen <j.andersen...@xxxxxxxxx> wrote:
> Please show the code (copy/paste) from your models, where you define
> the relationships/associations. I suggest from the Permit, Leader,
> Country and ProvState models.
>    John
>
> On Feb 25, 8:04 pm, "Arak Tai'Roth" <nielsen.dus...@xxxxxxxxx> wrote:> For 
> the second one, I get data from the Leader model as well as the
> > Country and ProvState model contained in Leader, that is what is
> > expected. In the first one, I expect the same, while also getting back
> > RegistrationLocation, User, and Activity. For the second one, I get
> > all the right data, except I get no Country and ProvState as I believe
> > I should be with them in the contain array, I even get the Leader
> > data, just not what is associated with Leader.
>
> > I did your suggestion earlier in my own testing, and I still don't get
> > Country and ProvState as I expect too get.
>
> [snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

<Prev in Thread] Current Thread [Next in Thread>