views:

356

answers:

1

Hi everyone,
I know naming conventions for tables used by plugins generally start with the name of the plugin and then the model pluralized. For example lets say I had a plugin called Poll, with a model also called PollPoll and another model called PollTag then the resulting table names would be poll_polls and poll_tags. They would also have a habtm relationship so what is the convention for that table name? I believe it would poll_poll_polls_poll_tags, although it is a little redundant it makes sense since the first poll_ represents the name of the plugin, while poll_polls and poll_tags relates to the models.

Also have any naming conventions changed for plugins in 1.3? Is the above stated correct? Thanks!

+2  A: 

Not sure about cake 1.3 (I'm not using it yet), but this if you're right this sounds like a perfectly acceptable case of breaking convention and defining the jointable, and foreign keys in the model relationships and possibly in the plugin.

Why does your plugin require a join table? Seems like a design issue. Perhaps there is a case where this is needed, but if I had a HABTM relation with a plugin, I would add a modelname column to the plugin's table, rather than have to create a new table for each model I wanted to use the plugin.

stevenf
Both models in the join table are within the plugin. Perhaps I didn't make that clear. So Poll_Poll and Poll_Tag are both part of the Poll plugin. Nothing else would use those tables except for what is in that plugin. Thanks! :)
Parris
But I don't really want to break naming convention, I want to follow convention, but the convention seems redundant, and a little clunky so I was wondering if something cleaner existed.
Parris