Database Naming Conventions? Does Yii expect database tables to be named according to convenition?
Posted 08 March 2010 - 03:01 PM
I say this because when I generated models with yiic, it created model relationships based on the table names.
Posted 08 March 2010 - 03:20 PM
// Maybe a hint to the AR page should be put into the convention page of the guide to make things more clear.
Posted 08 March 2010 - 06:22 PM
As a newbie (with Yii and PHP, not software development) I have gotten confused many times by the minimalistic syntax of the convention. For example, naming a relationship with the same name as the related model except for the case -- e.g. tbl_state (class State) relates to tbl_country (class Country) by relationship (BELONGS_TO) 'country' -- is confusing to me. I don't know whether it's a relationship or an attribute (field) of the table.
I would suggest that the convention be changed so that relations are named explicitly: in the example above, I call the relation 'relToCountry'. By the same token, the reverse relation would be called 'relFromState'. This way the code is more readable to the guy that will end up maintaining it.