Skip to content
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

New EAV attributes not found without cleaning cache #4092

Open
SuSiSonnenschein111 opened this issue Jul 11, 2024 · 0 comments
Open

New EAV attributes not found without cleaning cache #4092

SuSiSonnenschein111 opened this issue Jul 11, 2024 · 0 comments
Labels

Comments

@SuSiSonnenschein111
Copy link

SuSiSonnenschein111 commented Jul 11, 2024

Follow up to #4034 (comment) ....

it looks like getDefaultAttributes was blacklisted from tests for some reason

@davidhiendl no, there was nothing blacklisted. The tests never changes since years. (Only the tests have been updated to test against latest releases)

I updated CI to test against latest v20.10.0 release and the "errors" are gone, but not the failed tests.

My conclusion so far ...

  • the "undifiened method getDefaultAttributes() for invoice, creditmemo" came from changed functionallity and has been fixed.
  • the array_keys(null) is related to EAV cache and it is still not fixed ... so the behavoir changed to previous releases.

This error comes only across when you (progrmatically?) create a new attritbute and dont clear EAV cache afterwards.


Actually the tests fails here - after creating new attributes:

        $this->createAttribute($entityTypeCode, $attributeCode, ['type'  => 'text', 'input' => 'text', 'label' => 'Test Attribute']);

        self::assertTrue($this->attributeExists($entityTypeCode, $attributeCode));

Failed asserting that false is true.

See: https://github.com/netz98/n98-magerun/blob/develop/tests/N98/Magento/Command/Eav/Attribute/RemoveCommandTest.php

I did not dig deeper yet, but it seems obvious ... before your PR attributeExists() recognized newly created attributes.

Now, it does not work anymore b/c of caching.

Simplest solution would be to "clean EAV cache" after calling Mage_Eav_Model_Entity_Setup::addAttribute(), but its used in all install/update scripts ... should we do that?

As far as i remember with some changes from @colinmollenhour (hope i am not wrong; cant find the PR) the cache is reinitialized automatically (in some cases?), so this would hurt ...

(PS: this is no n98-magerung problem! It only shows the changed behavoir)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant