Still don't working
The content of $this->data is
Array
(
[Robot] => Array
(
[name] => robotname
[description] => robotdescription
)
[Tag] => Array
(
[0] => Array
(
[id] => 6
[tag] => tag1
)
[1] => Array
(
[id] => 7
[tag] => tag2
)
[2] => Array
(
[tag] => tag3
)
)
)
I save using $this->Robot->saveAll($this->data) and got these queries:
START TRANSACTION
INSERT INTO `robots` (`name`, `description`) VALUES ('robotname',
'robotdescription')
SELECT LAST_INSERT_ID() AS insertID
SELECT `RobotsTag`.`tag_id` FROM `robots_tags` AS `RobotsTag` WHERE
`RobotsTag`.`robot_id` = 2
COMMIT
The models relations are:
class Tag extends AppModel {
var $name = 'Tag';
var $hasAndBelongsToMany = array(
'Robot' => array('className' => 'Robot',
'joinTable' => 'robots_tags',
'foreignKey' => 'tag_id',
'associationForeignKey' => 'robot_id',
'unique' => true,
);
}
class Robot extends AppModel {
var $name = 'Robot ';
var $hasAndBelongsToMany = array(
'Tag' => array('className' => 'Tag',
'joinTable' => 'robots_tags',
'foreignKey' => 'robot_id',
'associationForeignKey' => 'tag_id',
'unique' => true,
)
);
What I am doing wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---