'Id' coloumn in any table needs to be 'id' only and not table specific
-
There is a problem i face in naming conventions of table columns. I created a table name ‘wp_w2store_countries’ in the database ‘w2store’ having an auto_increment primary key column as ‘country_id’. When i try to add data using form input, it works fine. But when i try to edit the record, the field ‘country_id’ is not bound and mapped since the convention doesn’t allow it, and the record is not updated.
I tried hard and in the end, i compromised to alter the column name to be ‘id’ and now the CRUD operations work fine.
Over writing of WP MVC methods, was not possible in this case and is that the limitation of WP MVC?
If one has multiple number of tables like countries, currencies, zones etc., one may want to name the columns of the table in a unique manner viz., country_id, currency_id, zone_id etc. But this limitation seems to be a bit tiresome and may result in confusion and ambiguity, i guess.
Anyone’s, who can be able to solve this, advice is sought in this regard.
Thank you.
- The topic ‘'Id' coloumn in any table needs to be 'id' only and not table specific’ is closed to new replies.