-
-
Notifications
You must be signed in to change notification settings - Fork 436
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
EAV Config Cache followup: select non-existent attribute exception #3038
EAV Config Cache followup: select non-existent attribute exception #3038
Conversation
@@ -438,6 +438,10 @@ public function addAttributeToSelect($attribute, $joinType = false) | |||
} else { | |||
$attrInstance = Mage::getSingleton('eav/config') | |||
->getAttribute($this->getEntity()->getType(), $attribute); | |||
// failure to resolve an attribute from the eav config implies it does not exist | |||
if (empty($attrInstance)) { | |||
return $this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldnt we log situations like this? Typo in the attribute name is a bug, a deweloper would like to know about
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not necessarily a bug, it could just be a deleted attribute that was referenced somewhere. But perhaps throw an exception in developer mode and log it in production mode. Let me know what you prefer and I defer to you and make the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, nothing, or only a log when dev mode is enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't care, if an attribute disappears there will be an errors in some template or some other code without the need to do anything here, although maybe it would be a bit cleaner
This PR fixes an exception that is trigger when a collection selects a non-existent attribute because
getAttribute()
no longer returns an empty model for non-existent attributes.Related Pull Requests
#2993
Manual testing scenarios (*)