Reputation: 4944
So... I have 2 tables:
banner_channel
banners
I need to create a table to relate the banners (table banners) with the channels of the banners (table banner_channel).
Obs.: I cant rename table banner_channel to channel only because I already have this table in database.
Maybe, the new table is:
banners_banner_channel
or
banners_channel
? I dont know.
Anyway, thanks.
Sorry for my english... I'm brazilian 8D
Upvotes: 0
Views: 490
Reputation: 7585
banners_banner_channel
is the correct table name according to what you have already.
just have a look at all the options in the habtm relations as you will have to set them all manually. instead of just doing 'hasAndBelongsToMany' => array('BannerChannels')
you will need to set everything according to this
first example: you will need atleast the following, className
, joinTable
, foreignKey
, associationForeignKey
and with
the rest you can tweak to your needs
Upvotes: 2
Reputation: 1728
First of all according to the cakePHP naming conventions the table you named banner_channel should be in plurals: banner_channels
As for the naming, it should be: banners_banner_channels
Upvotes: 2