-
Notifications
You must be signed in to change notification settings - Fork 160
Do not use getResource()->save()
in Model
#187
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
Labels
Comments
@lbajsarowicz what should be the severity for this case? |
@milindsingh I'm really sorry, but I have no idea :-( |
@milindsingh it should be |
lenaorobei
added a commit
that referenced
this issue
Aug 17, 2020
Added sniff for deprecated model methods. #187
magento-devops-reposync-svc
pushed a commit
that referenced
this issue
Jun 15, 2022
…to-coding-standard-387 [Imported] Allow empty constructor function blocks when using property promotion
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rule
getResource()
use is deprecated and Resource Model should be injected with DI to the Model class.Reason
Most of the Mageto 2 tutorials and stackoverflow answers:
provide
getResource()->save($object)
as recommended way to persist data changes on model - from model itself. As use ofgetResource()
is deprecated, and ResourceModel should be initialized using Dependency Injection, we should introduce inspection for PHP CS to avoid usinggetResource()
in models and setup scripts.Implementation
The text was updated successfully, but these errors were encountered: