Monday, September 28, 2009

Modyfication into beforeSave()

I have relations Post hasMany Tag, and my form look like this:

<?php echo $form->create('Post');
echo $form->input('name');
echo $form->input('content');
echo $form->input('Tag.0.name');
echo $form->input('Tag.1.name');
echo $form->end('Submit'); ?>

...and this form create 3 INSERT queries ($this->Post->saveAll()),
but I would like adding some fields in beforeSave() function, for
example:
$this->data['Tag'][2]['name'] = 'some...';
$this->data['Tag'][3]['name'] = 'some2...';

But this's not working, why?
How I can adding fields into beforeSave
--~--~---------~--~----~------------~-------~--~----~
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: