Dear all,
I have a very simple table with two columns:
id, varchar(5), primary key, unique
name, varchar(45)
My model extends CodeIgniter's model and I have set $useAutoIncrecement = false;
$useAutoIncrecement = false;$useAutoIncrecement = false;
In the documentation I read:
Quote:If you set $useAutoIncrement to false, then make sure to set your primary key in the database to unique. This way you will make sure that all of Model’s features will still work the same as before.
However I cannot find documentation on then how to set the Primary Key when inserting a new record. The following does not work:
PHP Code:
$data = ['id' => 'UG', name => 'Uganda'];
$myModel->insert($data);
It will insert a new record but id will be 0.
The only solution I have found to put the primary key in the $allowedFields property, however from the docs:
Quote:The $primaryKey field should never be an allowed field.
Is there any solution I am missing, other than allowing the id field or writing custom queries?
Greetings,