-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Cannot save sku using ResourceModel saveAttribute function #36084
Comments
Hi @ioweb-gr. Thank you for your report.
Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
For more details, review the Magento Contributor Assistant documentation. Add a comment to assign the issue: To learn more about issue processing workflow, refer to the Code Contributions.
🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket. ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
same #7247 |
But that one refers to addAttributeUpdate and not save attribute so it's different area |
Hello @ioweb-gr I am sure this is not bug and issue can be closed. |
So what is the recommended way to update only one field or static attribute without saving the whole model? Shouldn't there be an equivalent for those fields as well like saveField or something? If not, shouldn't there be a documented way to do this properly and efficiently as it apparently affects all static attributes or fields which are saved in any entity on a table column and not in eav structures. For products specifically, I think that saving a model with 60+ attributes to update and firing all observers and plugins when you need to update only one column is a waste of resources and leaves us with no workaround except for running direct sql queries. It may not be a bug in the way you mentioned it but it is a limitation or lack of documentation, whatever you may call it. In any case this area needs improvement and the issue is reasonable. You could have marked it as dev experience instead of closing in my humble opinion as all closed issues are never processed even if they have validity |
Preconditions and environment
Steps to reproduce
Create a product with SKU test1
Run the following standalone script located in
pub/tools/
folderYou will get an exception
Expected result
The sku is saved properly
Actual result
An exception is thrown
Additional information
I'm in the process of creating an automation for generating product SKUs based on a series and I was tyring to create a cron job that will automatically alter the SKUs to the appropriate format.
However this issue occured and I'm now unable to do it in a fast way and I have to use the ProductRepository to save the whole product instead of just modifying the attribute itself.
That means one extra load for the product and one extra save for the whole product instead of just saving my requested attribute
In my opinion saveAttribute should be able to save the sku as well but it seems it only works for non-static attributes.
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: