Re: HABTM relation on same model - cake doesn't save other fields now?!

2008-12-11 Thread miller218


I've just checked the content of the $this->data variable which is saved by
the edit function in the controller.. It contains all changes!! but somehow
the $this->DictWord->save($this->data) function just saves the HABTM
relation and ignores the other fields!
Any ideas?


-- 
View this message in context: 
http://n2.nabble.com/HABTM-relation-on-same-model---cake-doesn%27t-save-other-fields-now-%21-tp1638973p1643578.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



HABTM relation on same model - cake doesn't save other fields now?!

2008-12-10 Thread miller218


Hi Caker
 
I've a problem with cakephp program.
 
I've a model called DictWord which contains the same word in many languages.
This model should be associated with a model of same kind (DictWord ->
DictWord) using HABTM. (I want to use this association for a "See also"
function, e.g. if you view the word "cake", there should be a field named
"see also" that refers to "baker", "recipe",.. I hope you see what I mean)
 
So here's what I've done:
- created a database table called "dict_words_dict_words" with the fields
"id, word_id, link_id, created, modified"
 
- added the HABTM relation to the DictWord model:
var $hasAndBelongsToMany = array(
'DictWord'=> array(
'className' => 'DictWord'
,'foreignKey' => 'word_id'
,'associationForeignKey' => 'link_id'
,'unique' => true
,'order' => 'DictWord.deu ASC'
)
);

- added list handover to dict_words_controller, function edit():

$dictWords = array('' => '') + 
$this->DictWord->DictWord->find('list',
array('order' => 'DictWord.deu'));
$this->set(compact('dictWords'));

- added new input field in edit.ctp of  dict_word:
echo $form->input('DictWord');


It works perfectly: I can associate another DictWord to a DictWord then
press the save button and they're associated. BUT: The app now doesn't save
the other fields! It only saves the HABTM relation and none of the other
fields like "comment", "source", etc.

When I delete the 3 changes I made to the code then the app works again..

I hope someone can help me figuring out what the problem is :-/

Thank you very much!
-- 
View this message in context: 
http://n2.nabble.com/HABTM-relation-on-same-model---cake-doesn%27t-save-other-fields-now-%21-tp1638973p1638973.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---