Jon Warner Thu Dec 15 06:53:21 -0500 2011

Subject: Convention limits


I'm currently using (learning) this with Code Igniter. Whilst some aspects seem logical*, I'm not sure how conventions are defined and how the naming is limited. For example, I understand that php-AR looks in 'Books' for a 'Book'. How does it do this - does it just strip the trailing 's' off to find the singular object? The People/Person example would indicate it's not that basic. How about Companies/Company or, to be pedantic, Murder/Crow (as in a murder of crows)?

Rather than declaring static table names (as none of my pre-existing table names adhered to the convention) I'm redesigning a database for a current learning project to fully exploit php-AR. The following tables seem obvious: accounts, people, companies, addresses, telephones, emails. I also have other tables that aren't, to me, as simple: LoginDateTimes (to store all login activities) and AccountTypes. Would both of these be recognised as the tables associated with the singular (LoginDateTime and AccountType, respectively)?

Is there a way to define, globally, non-standard additions to the convention for a particular project, eg array('murder' => 'crow', 'drunkenship' => 'cobbler')?

Any insight would be greatly appreciated.

*I have no doubt that what seems illogical to me is due to my current understanding or lack thereof.