Skip to content

Developer experience: getData should log warnings when an attribute is not loaded #362

@amenk

Description

@amenk

Is is a common issue to try to fetch data from objects like products with $product->getData('attribute') but depending on the source of those objects (for example if they come from an collection) the attribute is not loaded.

I would suggest to at least add a warning

if (!$this->hasData('attribute')) {
   $logger->warning('Trying to access not existing / not loaded attribute');
}

This would improve the developer experience.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions