I have habtm relationship between articles and tags. This works correctly.
Now in my Articles/admin_add.ctp want beside multiple selection inputs, add
fields to add additional tags, and save it all together.
echo $this->Form->input('Tag'); // multiple select
echo $this->Form->input('Tag.0.name'); // add new tag
echo $this->Form->input('Tag.1.name'); // add new tag
in my ArticlesController::admin_add i have:
... $this->Article->saveAll($this->request->data, array('deep' => true)) ..
debug submitet data:
debug($this->request->data);
array('Article' => array(
'title' => 'Test title',
'user_id' => '1',
....),'Tag' => array(
'Tag' => array(
(int) 0 => '2', // selected data
(int) 1 => '3' // selected data
),
(int) 0 => array(
'name' => 'Wine' // new data
),
(int) 1 => array(
'name' => 'Icecreme' // new data
)),
The aim is to save the new tags and make their association when saving a
new article. What is the correct way to save this query?
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.