-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$primaryKey forcefully 'needs' to be auto_increment #2133
Comments
The reason for this is when you Provider the Primary key the Save Method
tries to perform an Update. So the Model Should Provide an Option to
specifiy if the primary key is Auto inctementing.
Fernando P <notifications@github.com> schrieb am Di. 13. Aug. 2019 um 00:26:
… *Describe the bug*
The primary key of my table is a combination of numbers and letters.
Using or not validation, a new record will not be saved to DB using
Entities' save()
*CodeIgniter 4 version*
CodeIgniter Version: | 4.0.0-beta.4
*Affected module(s)*
Couldn't figure it out.
*Expected behavior, and steps to reproduce if appropriate*
A new record should be saved provided I include the primary key value.
Validation rules take care of it being a unique value.
$numero's format is ##-#####/## (12-34567/89)
https://pastebin.com/embed_js/Dz6JFnmk
*Context*
- OS: Ubuntu 18.04.2 LTS
- Web server Apache/2.4.29 (Ubuntu)
- PHP version 7.2.19
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2133?email_source=notifications&email_token=ADENSBTDEKDXNW3BBXXFWQLQEHPR7A5CNFSM4ILFQMOKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HE2LORA>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADENSBV3ZUQSI6ITPNVEUITQEHPR7ANCNFSM4ILFQMOA>
.
|
But, I do have a primaryKey to check if record exists or not. So save() method should be able to figure it out. |
That's the nature of If you need to force an insert (e.g. when your primary key doesn't exist) use |
Sorry, that's not how the convenience function of save is meant to work, as @MGatner pointed out. Using |
Describe the bug
The primary key of my table is a combination of numbers and letters.
Using or not validation, a new record will not be saved to DB using Entities' save()
CodeIgniter 4 version
CodeIgniter Version: | 4.0.0-beta.4
Affected module(s)
Couldn't figure it out.
Expected behavior, and steps to reproduce if appropriate
A new record should be saved provided I include the primary key value.
Validation rules take care of it being a unique value.
$numero
's format is##-#####/##
(12-34567/89)https://pastebin.com/embed_js/Dz6JFnmk
Context
The text was updated successfully, but these errors were encountered: