Saturday, February 28, 2009

Big Problem with 1:1 Association

First of all I want to say that I´m not english.
So please forgive me for my bad english and please use easy to
understand english in your answers.
Thank you!!

I write a programm for doctors.
I´ve got a table called 'clients' which looks like

id:int(11):primary key
salutation_id:tinyint(3) //a belongsTo association to table
salutations
title_id:smallint(5) //a belongsTo association to table
titles
gender_id:tinyint(1) //a belongsTo association to table genders
first_name:varchar(50)
last_name:varchar(50)
...
progress_id:int(11) //a hasOne association to table progresses


I want to save a progress for every client (which doctor has talked
with client, what time has it taken, what has been done and so on).
So I wrote a table 'progresses':

id:int(11):primary_key
employee_id //a belongsTo association to table
employees
previous_employees:text
date:date
action:varchar(60)
...


In my view I´ve got 2 divs.
In one div are the input-fields (and Dropdowns) for the client.
In the second div are all field for the progress.

I submit both and the values are submitted to the action.
If I call pr($this->data) and comment out saving of the data then I
see that everything is in the array.

But if I save the data only the thing belonging to the client are
saved. The data from the progress is not saved.
Why?


My Models:
client: hasOne = array('Progress');
progress: hasOne = array('Client');

My Controller:
$this->set->('progresses', $this->Client->Progress->find('list'));

View:
echo $form->input('Progress.<fieldName>');


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

No comments: