Perhaps this is a question for beginners, as I am trying to understand that all these "PHP frameworks" are in my free time.
To get started, I want to add some tags to several photos. I have a tag model and a moto model (photos). Snip mot-model:
var $hasAndBelongsToMany = array(
'Tag' =>
array(
'className' => 'Tag',
'joinTable' => 'mots_tags',
'foreignKey' => 'mot_id',
'associationForeignKey' => 'tag_id',
'unique' => false
)
);
In my tags, the controller in add () has me:
$this->Tag->save($this->data);
When print_r'ing $ this-> data I see:
Array
([Mot] => Array ([id] => 2)
[Tag] => Array
(
[title] => 21e21e
)
)
The tag is inserted into the tag table, but nothing is inserted into the mottags (underscore between the mot and the tag, but it is italic when I write it here, and not become the underscore). My schema mys_tags db: (sqlite)
create table mots_tags (id INTEGER PRIMARY KEY, mot_id INTEGER, tag_id INTEGER)
, Cake , ? SQL-. , ?