views:

67

answers:

1

i have theses tables article , article_currency, currency in database and i made HABTM between article and currency like this

var $hasAndBelongsToMany = array('currency'=>array('className' => 'currency','joinTable'=>'article_currency','foreignKey' => 'articleid','associationForeignKey' => 'CurrencyID'));

var $hasAndBelongsToMany = array('articlemodel'=>array('className' => 'articlemodel','joinTable'=>'article_currency','foreignKey' => 'CurrencyID','associationForeignKey' => 'ArticleID'));

and here cake genrate the model ArticleCurrency for me when i try to change its name using with to 'article_currency' is give me this error *Database table article_currencies for model article_currency was not found.*

how i can solve this

+2  A: 

Table names are plural by convention: articles, currencies, articles_currencies

http://book.cakephp.org/view/24/Model-and-Database-Conventions

harpax
i dont; want to stuck with cakephp convention
islam
in that case use can use the model-attribute `useTable` to let Cake know how you named the tablehttp://book.cakephp.org/view/436/useTable
harpax