Maybe set your persons controller to also use the judges controller,
then just save the judge in the persons_controller?
On Mar 26, 11:40 am, "dima" <[EMAIL PROTECTED]> wrote:
> in your afterSave() of the Person model you can do something along
> these lines:
>
> if (isset($this->Judge) && !empty($this->data['Judge']))
> {
> $this->data['Judge']['person_id'] = $this->id;
> $this->Judge->save($this->data);
>
> }
>
> Dimitry Z.
>
> On Mar 26, 12:05 pm, "christianandradet" <[EMAIL PROTECTED]>
> wrote:
>
> > hi,
> > i am traing to insert data with a one to one relationship, i am
> > working with this tables:
> > CREATE TABLE 'people` (
> > `id` smallint(5) unsigned NOT NULL auto_increment,
> > `lastname` varchar(40) NOT NULL,
> > `firstname` varchar(40) NOT NULL,
> > PRIMARY KEY (`id`) )
>
> > CREATE TABLE `judges` (
> > `person_id` smallint(5) unsigned NOT NULL,
> > `location_id` smallint(5) unsigned NOT NULL,
> > `flavor` enum('USDJ','USMJ') default 'USDJ' )
>
> > in the people controller:
> > var $hasOne = array('judge' => array('className' => 'judge',
> > 'conditions' => '',
> > 'order' => '',
> > 'dependent' => true,
> > 'foreignKey' => 'person_id'
> > )
> > );
>
> > but i don't know how to insert data in both tables at the same time,
> > how do i configure the add method??? (i can list both tables)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---