-
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
save() method trying to insert instead of update #1770
Comments
Have you tried debugging it in the Model's save() command yet? I can't recreate your app for test purposes, and we have tests around that which seems to save fine. If you can debug on your end and determine if something actually is a bug at the framework level then I can actually help. There's only 2 things I can think of that might be going wrong at the framework level: Either It's not including tra_id when it converts it from an entity to an array, or the value of tra_id you're passing in evaluates as empty. But what you have here isn't really a bug report, it's an ask for help, which should be asked on the forums. If you can confirm it's a bug with the framework, please let us know. |
There was a bug in in
if tra_id didn't change then it wasnt avaibale in properties which were returned by toRawArray . |
@lonnieezell : test what you are pointing out are not the best example for this case; they are created only for \stdClass or arrays ; there are no test which are utilizing entity toRawArray method. |
Hm. Thought I had something in place that would always include the primary key. Will check that. Thanks for debugging further. |
I guess, the issue is fixed with #1829. |
It is grabbing the primary key when using entities and toRawArray, and this test proves it's working I believe. |
This is model
Entity:
And TestCommand (spark)
and its output:
I am wondering why save is trying to produce INSERT instead of UPDATE .. WHERE tra_id = 121 ?
The text was updated successfully, but these errors were encountered: