gabordemooij / redbean

ORM layer that creates models, config and database on the fly
https://www.redbeanphp.com
2.31k stars 280 forks source link

Documentation: Shared Lists #254

Closed linqcan closed 11 years ago

linqcan commented 11 years ago

http://redbeanphp.com/shared_lists

This section: "..., RedBeanPHP will make a link table army_village to associate the armies with their villages."

Should be: "..., RedBeanPHP will make a link table village_army to associate the armies with their villages."

The table will be named using the convention: bean1->sharedBean2 ==> "bean1_bean2"

Or am I missing?

linqcan commented 11 years ago

I am probably wrong here. Made a "village-army" test and the table created was "army_village". However, I needed the name convention above (bean1_bean2) in my schema to satisfy RB in my "real" application. Strange?

gabordemooij commented 11 years ago

RedBeanPHP creates the link table by sorting the bean type names alphabetically. This makes the table layout extremely predictable.

However, did you encounter a situation where RedBeanPHP created the wrong table? If so could you please send me a code snippet that demonstrates the issue? I can't reproduce this issue myself right now..

linqcan commented 11 years ago

Ok, that's probably why. My beans were named 'user' and 'card'.

Closing this for now. Will get back when I have more relevant information.