Cake pluralizes categorized and targets wrong table.
Using the example code on a fresh Cake 2.0 install with migrations applied I get the following error.
Error: Database table categorizeds for model Categorized was not found.
It seems to be failing at this step.
public $hasAndBelongsToMany = array(
'Category' => array(
'className' => 'Categories.Category',
'foreignKey' => 'foreign_key',
'associationForeignKey' => 'category_id',
'with' => 'Categorized'
)
);
The migrations worked fine and I have the categories and categorized tables working fine, so the expected result is that it does not attempt to pluralize the 'with' => 'Categorized' table.
This seems to be an issue with new changes in Cake2.0. The problem seems to be with the example code in the readme. If you change the code above to the following, then it at least won't error out on that part when using multiple categories per object.
class Articles extends AppModel {
public $hasAndBelongsToMany = array(
'Category' => array(
'className' => 'Categories.Category',
'foreignKey' => 'foreign_key',
'associationForeignKey' => 'category_id',
'with' => 'Categories.Categorized'
)
);
}
Thanks for showing this, corrected it!