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

UnexpectedValueException: tree metadata #457

Open
hual7 opened this issue Jul 13, 2023 · 7 comments
Open

UnexpectedValueException: tree metadata #457

hual7 opened this issue Jul 13, 2023 · 7 comments
Labels

Comments

@hual7
Copy link

hual7 commented Jul 13, 2023

After upgrading to v1.8.0 I'll get this error – ONLY in production APP_ENV=prod:

[2023-07-12T17:14:15.082831+02:00] request.CRITICAL: Uncaught PHP Exception Gedmo\Exception\UnexpectedValueException: "Tree object class: App\Entity\Account must have tree metadata at this point" at /var/www/html/vendor/gedmo/doctrine-extensions/src/Tree/TreeListener.php line 116 {"exception":"[object] (Gedmo\Exception\UnexpectedValueException(code: 0): Tree object class: App\Entity\Account must have tree metadata at this point at /var/www/html/vendor/gedmo/doctrine-extensions/src/Tree/TreeListener.php:116)"} []

All is working fine when using v1.7.2 in combination with gedmo extension 3.12.0.

@hual7 hual7 added the Bug label Jul 13, 2023
@stof
Copy link
Owner

stof commented Jul 13, 2023

Are you using the extension in a mapped superclass ? If yes, this is likely the same issue than #455 (for a different extension but the bug in gedmo/doctrine-extensions affects all extensions)

@hual7
Copy link
Author

hual7 commented Jul 13, 2023

Are you using the extension in a mapped superclass ? If yes, this is likely the same issue than #455 (for a different extension but the bug in gedmo/doctrine-extensions affects all extensions)

@alexander-schranz
Could you please answer? Thx.

@alexander-schranz
Copy link

@stof
Copy link
Owner

stof commented Jul 13, 2023

@alexander-schranz as for any other bundle, you can use bin/console config:dump stof_doctrine_extensions to dump the available configuration of the bundle. the configuration of the metadata cache is done through metadata_cache_pool

@alexander-schranz
Copy link

alexander-schranz commented Jul 13, 2023

@stof What confuses me more is what value to use, as there is in the doctrine recipe not longer a doctrine metadata cache pool, which I first thought I could just configure that in stof extension. But that was as I thought removed some time ago and only result and system cache for query cache exists now: https://github.com/symfony/recipes/blob/main/doctrine/doctrine-bundle/2.10/config/packages/doctrine.yaml

I debugged now how doctrine is handling it in the bundle it seems like they go on kernel.debug flag here: https://github.com/doctrine/DoctrineBundle/blob/f9d59c90b6f525dfc2a2064a695cb56e0ab40311/DependencyInjection/DoctrineExtension.php#L1055

Seems like its not a cache pool used by doctrine itself for the metadata, atleast it doesn't looke for me like a PSR6 cache pool?

Would it make sense that the stof extension bundle handles the things the same that on kernel.debug: false it register an own metadata cache pool automatically and on true it doesn't?

For current state the system cache pool seems atleast not run into that issue but only should configured in when@prod (our case also stage) as it does not exist on dev:

when@prod:
    stof_doctrine_extensions:
        # fix issue with gedmo/extensions 1.8.0 and stof/doctrine-extensions-bundle: 3.12.0
        # @see https://github.com/stof/StofDoctrineExtensionsBundle/issues/457
        metadata_cache_pool: doctrine.system_cache_pool

For Sulu users:

when@prod: &prod
    stof_doctrine_extensions:
        # fix issue with gedmo/extensions 1.8.0 and stof/doctrine-extensions-bundle: 3.12.0
        # @see https://github.com/stof/StofDoctrineExtensionsBundle/issues/457
        metadata_cache_pool: doctrine.system_cache_pool

when@stage: *prod

@alexander-schranz
Copy link

alexander-schranz commented Jul 18, 2023

Today I did run into an own project also into this issue but in my case the change of the metadata_cache_pool didn't help it the error is a different one now:

[2023-07-18T18:05:57.160555+02:00] php.CRITICAL: Uncaught Error: Failed opening required '/var/website/releases/296/var/cache/website/stage/doctrine/orm/Proxies/__CG__SuluBundleSecurityBundleEntityUser.php'

Seems also be related so to the ResolveTargetListener as that class / Proxy should not exist as it was Replaced by AppDomainModelUser.php 🤔 . Sadly I can not yet reproduce it locally so maybe only happens when no @dev dependencies are here. I will try to do that next after fixing the prod server.

Update: Okay the new error was unrelated to this issue. The old class was still in the SessionStorage of Symfony after cleering the session it did work in my case.

@andriusvo
Copy link

Can confirm this issue

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

4 participants