Friday, March 5, 2010

Re: hasOne->HABTM save problem

> Cake's auto-HABTM saving requires the field to be named a particular
> way in order to recognise it.

I personally get away with the as follows without issue:
echo $form->input('ClassificationWhat', array('type'=>'select',
'multiple'=>'checkbox', 'options'=>array($classificationWhats));

I believe the problem will be trying to use saveAll tow models away
from the HABTM association as saveAll does not go infinetly deep, it
only tends to save immideiatly associated records.

Try:
$this->Sample->ExportSample->saveAll($this->data,
array('validate'=>'first'));

This should validate/save all 3 models at once returning all your
required validation errors to your sample form if required.

HTH

Paul.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: