Closed aliechti closed 8 years ago
Using such naming in most databases requires explicit quoting, as most databases are case insensitive by default. That's not convienient and adding any code that tries to convert naming automatically is too complex and confusing.
Also Yii doesn't provide full SQL abstraction so column names in queries would be still the ones that are actually in database.
@samdark this is not what I wanted to archive. The case is that the actual column names do not match the expected naming convention. Column names should be the same as in the objects, nobody wants a conversion this would lead to confusion.
Well, that's up to the project about how to name DB columns. In some cases you don't even have a choice.
but here with the migration and the rbac tables we have the choice...
We're sticking to what's common for SQL world: http://www.sqlstyle.guide
Would it not make sense, to use a more strict naming convention, in places where the DB is used?
I know that this was discussed more than once, but it felt wrong as I compared some properties of normal classes with properties of ActiveRecords.
In Yii2 a table is used in a class, which is named in the UpperCamelCase format. The columns are the properties in the object which should be named in the lowerCamelCaseFormat.
But if I look in the migration or the rbac module everything is snake_case. This leads to objects with snake_case properties which is not recomended in the code style sheet of Yii2.
I know too, that this is a very personal or company oriented decision, but if felt that it should be like my example below. In my opinion this should be in this way because of the object oriented way Yii2 handles SQL tables, rows and columns.