-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
RFE: ActiveRecord::upsert #74
Comments
Since 2.0 isn't accepting enhancements anymore, moved to Yii 3. If we'll decide to implement Active Record, we'll consider it. |
Hello, My take on that since I just had the issue : If the primary key is specified on the object, Active Record should be able to understand it's an upsert, if it doesn't, it's a classic insert(); Thank you |
@omsi668 that won't always work. Especially if the primary key is not auto-generated. |
Well that's why it should depend on weather you declare the primary key or not in the code? |
You're right. It should not. |
This should work not only for the primary key, but for any unique key. |
\yii\db\Command has very usefull method "upsert", but ActiceRecord has no same feature.
In some situation, when additing full set of attributes in model, for example upon importing data, the typical scenario is not suitable:
Because this method requires a lot of extra SELECT to work. It will be good to have upsert method:
What steps will reproduce the problem?
no problems, just a feature request :)
The text was updated successfully, but these errors were encountered: