Hi,
I'm developing an app that has database relationships.
The table in question is like so:
tbl practice_instances
id - int (primary)
created - timestamp (default: null)
modified - timestamp (default: null)
timeminutes - int
practice_session_id - int
practice_item_id - int
tempostart - int
tempofinish - int
practice_session_id refers to an entry in the PracticeSession model
(PracticeSession hasMany PracticeInstance)
practice_item_id refers to an entry in the PracticeItem model
(PracticeInstance belongsTo PracticeItem)
I have a form under /cakeRoot/practice_instances/add which accepts the
following fields:
<?php
echo $form->create("PracticeInstance");
echo $form->input("timeminutes");
echo $form->input("practice_session_id");
echo $form->input("practice_item_id");
echo $form->input("tempostart");
echo $form->input("tempofinish");
echo $form->end("Create Practice Instance");
?>
When I submit the form, I can see in my controller dump:
[data] => Array
(
[PracticeInstance] => Array
(
[timeminutes] => 20
[practice_session_id] => 42
[practice_item_id] => 3
[tempostart] => 120
[tempofinish] => 128
)
)
So everything is fine there, but when I look in my table, all the
fields other than id, created, and modified are set to a value of 0.
This is odd because cake is telling me that it saved $this->data, and
as you can see, the values above are not zero. I have the feeling that
I'm not understanding something about data relationships. Any idea why
these fields are getting set to 0?
In the final application users won't really create PracticeInstances
manually (it will be part of creating a PracticeSession), but I'd like
to be able to add fields for testing.
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 [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
To unsubscribe, reply using "remove me" as the subject.