-
Notifications
You must be signed in to change notification settings - Fork 9.4k
loadAllAttributes fails for EAV entities #5339
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
Comments
As a temporary measure I've had to exclude my EAV entity from attribute caching via di.xml:
|
I experience the same issue after upgrading to M2.1 edit: |
I'm running Magento EE 2.1.0 and I have the same issue since the upgrade with |
This also has something to do with the mode in which Magento is running. |
Hi, We have the same problem after upgrading to magento CE 2.1.1 |
Same issue for me. Magento CE 2.1.1 and Magento EE 2.1.1 |
@maderlock I managed to get it working on custom entity attributes by reporting this line : https://github.com/magento/magento2/blob/develop/app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php#L827 to my attributes. I think the "raw" EAV attributes are not usable "as is", because when looking at catalog eav attributes, they add a lot of code to get them working. There is this one regarding the Regards |
I have the same issue after upgrading to CE 2.1.1. @jessetaverne temporary fix worked for me, thanks. |
Yes I also fixed this by creating my own attribute model and adding the unsetData at __sleep(): <?php
namespace Example\Module\Model\Entity;
/**
* Class Attribute
* @package Example\Module\Model\Entity
*/
class Attribute extends \Magento\Eav\Model\Entity\Attribute
{
/**
* This fixes https://github.com/magento/magento2/issues/5339
*
* @inheritdoc
*/
public function __sleep()
{
$this->unsetData('entity_type');
return parent::__sleep();
}
} And after that putting this model in the eav_entity_type table (attribute model = "Example\Module\Model\Entity\Attribute" with my custom entity. This solves the issue like @romainruaud said. |
I'm having this same problem in CE 2.1.7 when I extend |
Buggy EAV Attribute Cache mechanism was removed on Magento 2.2.0 branch: 3ae7c19 This is not something that could be backported due to BC constraints, as a workaround you can try just to disable this cache type. |
[TSG-CSL3] For 2.4 (pr14)
Uh oh!
There was an error while loading. Please reload this page.
Preconditions
Magento 2.1.0
Steps to reproduce
Expected result
Actual result
main.CRITICAL: Exception: Serialization of 'Magento\Framework\View\Layout\Element' is not allowed in .../vendor/magento/module-eav/Model/Entity/AttributeCache.php:116
Stack trace:
#0 .../vendor/magento/module-eav/Model/Entity/AttributeCache.php(116): serialize(Array)
#1 .../vendor/magento/module-eav/Model/Entity/AttributeLoader.php(98): Magento\Eav\Model\Entity\AttributeCache->saveAttributes('my_eav_attr', Array)
#2 .../vendor/magento/module-eav/Model/Entity/AbstractEntity.php(510): Magento\Eav\Model\Entity\AttributeLoader->loadAllAttributes(Object(MyModule\MyEAVType\Model\ResourceModel\Tile\Interceptor), NULL)
#3 .../var/generation/MyModule/MyEAVType/Model/ResourceModel/Tile/Interceptor.php(193): Magento\Eav\Model\Entity\AbstractEntity->loadAllAttributes(NULL)
#4 .../vendor/magento/module-eav/Model/Entity/Collection/AbstractCollection.php(484): MyModule\MyEAVType\Model\ResourceModel\MyEAVType\Interceptor->loadAllAttributes()
#5 .../app/code/MyModule/MyEAVType/view/frontend/templates/myblock.phtml(6): Magento\Eav\Model\Entity\Collection\AbstractCollection->addAttributeToSelect('*')
Debugging in the attribute cache, it appears that serialisation of the static attributes is failing, although it's fine for the non-static attributes.
I've seen a suggestion that this is not an issue if I specify exactly which attributes I want, which is true, but the point of using EAV is that at compile time I will not always know the complete set of attributes I need.
The text was updated successfully, but these errors were encountered: