-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
Add static method ActiveRecord::saveMultiple() #19284
Conversation
What value does it add to the core? This is just the shortcut and you can easily do it in your own app. |
@bizley you can say this about half methods of AR |
I disagree and I would reject this addition but since I'm not a decision maker here I would like to hear opinion of others. |
@bizley disagree with what? For example, look validateMultiple(), doesn't remind you of anything? |
I disagree about "half of methods" but yes, this example is a valid point. |
@bizley what's about getDb(), findBySql(), updateAll(), deleteAll(), find(), getTableSchema(), primaryKey(), attributes(), equals(), isTransactional()? )) |
This type of function should not be inside the core, there are different approaches for handling it, so it should be part of the user's code. |
@terabytesoftw as
for example? |
I don't see any added value, and if one of the models isn't saved, we won't know which one it is. |
if method return false, then you can display form with errors by ActiveForm, see manual example "better" is implement pattern "collection", but Yii2 devs don't do it.. you don't do it..
I cant find any logic in this |
As said before :) Yii 2 is actually in a feature freeze state. And if we do so, we'd need extensive tests for it. |
@schmunk42 i don't try to add new features, I only complete existed features: added method missed in current implementation. adding tests in PR it's not problem. |
In which way is this "missed"? There's no implementation under the name |
@schmunk42 if you can load and validate multiple model, then there must be a way to save them too. The framework should support it completely or not support it at all. https://www.yiiframework.com/doc/guide/2.0/en/input-tabular-input#updating-a-fixed-set-of-records look like "white spot" in model API. |
@schmunk42 it does not explain why loadMultiple/validateMultiple is normal, but not saveMultiple. |
Sorry, but me don't like this enhancement. |
don't understand why they are wrong examples.
they can be part of framework, but in other place (trait, behavior, Model collection)
Is not abstract discuss about whether it's right or wrong way. It's conversation about whether it's right for current implementation: if class have
|
Note that the |
@rustamwin yes captain, but |
@bizley @terabytesoftw @machour @schmunk42 @darkdef Do you have any objections? In Yii2 context and not personal. Let's try give answer: why |
I do have an objection, that I mentioned and you discarded, so I don't know why you're asking again 🤷🏼 |
your objection NOT in Yii2 context and don't give answer on question:
|
Because they were there before the feature freeze ? |
It was wrong to add loadMultiple/validateMultiple to ActiveRecord domain. But now their removal is impossible without bc. My vote is against this change. |
Ok, looks like most of the team is against adding this method so we will not do it. Thank you all for your time and the input. |
We can't do this, it's possible only in next major version @machour the project is frozen when no one wants to support/update it. in current case it's not true. if you don't want change yii2, don't do it, but don't stop others from doing it. @bizley reason to close? |
You are absolutely wrong. The project is on feature-freeze, not because I don't want to change it, but by a team decision: Read Yii 3 instead of Yii 2.1 in the announcement. You are very welcome to submit new features to Yii 3. You are also free to start a discussion about wether or not we un-freeze Yii 2, before bullying people into merging your PRs. You are also free to fork the Yii2 framework and maintain your own fork with your own policy. |
Added to ActiveRecord because unable to create intermediate class StoreableModel between Model and BaseActiveRecord