Welcome Guest, Not a member yet? Register   Sign In
Naming database columns and form inputs
#1

Examples in the CI4 documentation use snake_case for database column names. Indeed the default values 'created_at', 'updated_at' and 'deleted_at' support this convention. 

CI4 entities promote using the same names for html form inputs as database column names. Doing so streamlines filling the database from html forms. So the convention to use snake_case in column names will (should) lead to the same convention for naming form inputs.


Doesn't this conflict with using camelCase for object properties? For example using both conventions I need to know where an entity property came from: if it was loaded from database I need to refer to it using snake case, but if was created by code at runtime I need to refer to it using camelCase. I need to keep track of which it is. 

Is snake_case for column names a widespread convention? 

Are there good reasons for it? I would love to hear what they are. 

I would appreciate any advice, even a good article to read. I haven't found one in my internet searching. 
Reply


Messages In This Thread
Naming database columns and form inputs - by motownphilippe - 03-13-2021, 10:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB