I'm using David Perssons Media Behaviour (http://github.com/ davidpersson/media), and i have a small problem. When trying to save a model that has a hasOne association, the associated model is saved, but the behaviour isn't triggered.
The association in my model, named Release, is set up like this: var $hasOne = array( 'Cover' => array( 'className' => 'Cover', 'foreignKey' => 'release_id' 'dependent' => true ) ); In the Cover model the Media Behaviours are set up like this: var $actsAs = array('Media.Transfer', 'Media.Generator', 'Media.Coupler'); And in my view i've added/changed this: echo $this->Form->create('Release', array('type' => 'file')); .... echo $this->Form->input('Cover.file', array('type' => 'file', 'label' => 'Cover')); According to the manual all i need to do now is to call saveAll, but unfortunately it doesn't work correctly. The data sent is structured correctly (according to http://book.cakephp.org/view/1031/Saving-Your-Data), it looks like this: Array ( ... [Release] => Array ( ... ) [Cover] => Array ( [file] => Array ( [name] => test.jpg [type] => image/jpeg [tmp_name] => G:\xampp\tmp\php6E91.tmp [error] => 0 [size] => 178534 ) ) ) and the associated model is saved, ie a record for the Cover model is created, but the behaviours aren't triggered, ie no file is uploaded and the additional dirname and basename fields are empty. Adding some debug output i've found out that the associated model when saved by saveAll isn't using the actual Cover model, instead it uses AppModel where no actsAs is defined. So my question is... what the heck is going on there? ;) Regards 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@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en