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

Gedmo Extension Tree not longer working with 2.3 Version #1305

Closed
alexander-schranz opened this issue Mar 22, 2021 · 9 comments
Closed

Gedmo Extension Tree not longer working with 2.3 Version #1305

alexander-schranz opened this issue Mar 22, 2021 · 9 comments

Comments

@alexander-schranz
Copy link
Contributor

alexander-schranz commented Mar 22, 2021

I updated in our project only doctrine/doctrine-bundle from 2.2.3 to 2.3.0.

After the update I'm getting the following when the cache:clear is called:

In TreeListener.php line 71:
Tree object class: Sulu\Bundle\MediaBundle\Entity\Collection must have tree metadata at this point

Stack Trace
Exception trace:
  at /private/tmp/sulu-develop.localhost/vendor/gedmo/doctrine-extensions/src/Tree/TreeListener.php:71
 Gedmo\Tree\TreeListener->getStrategy() at /private/tmp/sulu-develop.localhost/vendor/gedmo/doctrine-extensions/src/Tree/Entity/Repository/NestedTreeRepository.php:891
 Gedmo\Tree\Entity\Repository\NestedTreeRepository->validate() at /private/tmp/sulu-develop.localhost/vendor/gedmo/doctrine-extensions/src/Tree/Entity/Repository/AbstractTreeRepository.php:53
 Gedmo\Tree\Entity\Repository\AbstractTreeRepository->__construct() at /private/tmp/sulu-develop.localhost/vendor/doctrine/doctrine-bundle/Repository/ContainerRepositoryFactory.php:79
 Doctrine\Bundle\DoctrineBundle\Repository\ContainerRepositoryFactory->getOrCreateRepository() at /private/tmp/sulu-develop.localhost/vendor/doctrine/doctrine-bundle/Repository/ContainerRepositoryFactory.php:65
 Doctrine\Bundle\DoctrineBundle\Repository\ContainerRepositoryFactory->getRepository() at /private/tmp/sulu-develop.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:758
 Doctrine\ORM\EntityManager->getRepository() at /private/tmp/sulu-develop.localhost/var/cache/website/prod/ContainerVYSWbWN/EntityManager_9a5be93.php:153
 ContainerVYSWbWN\EntityManager_9a5be93->getRepository() at /private/tmp/sulu-develop.localhost/var/cache/website/prod/ContainerVYSWbWN/App_KernelProdContainer.php:2196
 ContainerVYSWbWN\App_KernelProdContainer->getSuluMedia_CollectionRepositoryService() at /private/tmp/sulu-develop.localhost/var/cache/website/prod/ContainerVYSWbWN/App_KernelProdContainer.php:2314
 ContainerVYSWbWN\App_KernelProdContainer->getSuluMedia_MediaManagerService() at /private/tmp/sulu-develop.localhost/var/cache/website/prod/ContainerVYSWbWN/App_KernelProdContainer.php:958
 ContainerVYSWbWN\App_KernelProdContainer->get_Container_Private_TwigService() at /private/tmp/sulu-develop.localhost/vendor/symfony/dependency-injection/Container.php:441
 Symfony\Component\DependencyInjection\Container->getService() at /private/tmp/sulu-develop.localhost/vendor/symfony/dependency-injection/Argument/ServiceLocator.php:42
 Symfony\Component\DependencyInjection\Argument\ServiceLocator->get() at /private/tmp/sulu-develop.localhost/vendor/symfony/twig-bundle/CacheWarmer/TemplateCacheWarmer.php:46
 Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheWarmer->warmUp() at /private/tmp/sulu-develop.localhost/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php:98
 Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() at /private/tmp/sulu-develop.localhost/vendor/symfony/framework-bundle/Command/CacheClearCommand.php:243
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() at /private/tmp/sulu-develop.localhost/vendor/symfony/framework-bundle/Command/CacheClearCommand.php:155
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() at /private/tmp/sulu-develop.localhost/vendor/symfony/console/Command/Command.php:256
 Symfony\Component\Console\Command\Command->run() at /private/tmp/sulu-develop.localhost/vendor/symfony/console/Application.php:989
 Symfony\Component\Console\Application->doRunCommand() at /private/tmp/sulu-develop.localhost/vendor/symfony/framework-bundle/Console/Application.php:96
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /private/tmp/sulu-develop.localhost/vendor/symfony/console/Application.php:290
 Symfony\Component\Console\Application->doRun() at /private/tmp/sulu-develop.localhost/vendor/symfony/framework-bundle/Console/Application.php:82
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /private/tmp/sulu-develop.localhost/vendor/symfony/console/Application.php:166
 Symfony\Component\Console\Application->run() at /private/tmp/sulu-develop.localhost/bin/console.php:51
 include() at /private/tmp/sulu-develop.localhost/bin/websiteconsole:7

I also tried the #1304 PR but seems like this does not fix it, still the same error.

Not sure yet which cause the issue, happy for every hint.

PS: After debugging it in more details with git bisect it has todo with the changes in #1284 by @nicolas-grekas.

Reproduceable Repository

composer create-project sulu/skeleton
bin/websiteconsole cache:clear
@ostrolucky
Copy link
Member

ostrolucky commented Mar 22, 2021

Fix in #1304 doesn't work on it's own, but together with fix in makerbundle. Similarly, to utilize it, Gedmo would have to be updated. I don't recommend doing that at the moment though, #1304 has not been properly reviewed yet and will likely change.

@alexander-schranz
Copy link
Contributor Author

@ostrolucky In our case there is no makerbundle installed. The TreeListener is part of the gedmo doctrine extensions used over the StofExtensionBundle.

@ostrolucky
Copy link
Member

That's why I didn't say makerbundle needs to be changed, but gedmo. Point being, fix doesn't work on its own, both sides need to be chanegd.

@stof
Copy link
Member

stof commented Mar 22, 2021

The Gedmo extensions are doing some "magic" to build their own mapping driver to read from the same source than the doctrine mapping: https://github.com/doctrine-extensions/DoctrineExtensions/blob/7c0d5aeab0f840d2a18a18c3dc10b0117c597a42/src/Mapping/ExtensionMetadataFactory.php#L138
This is because it stores its own mapping in the doctrine mapping files (when using XML or Yaml) rather than in its own files.

This logic will need to be updated to be aware of the new MappingDriver of the bundle (and indeed, having access to the inner driver would unlock that).

@alexander-schranz
Copy link
Contributor Author

Thx for the fast responses here, really appricate this 🙏

@ostrolucky really sorry for my blindness did read the answer to fast 🙈
@stof I tried to checkotu the #1304 and tried to add a break at the ExtensonMetadataFactory but it seems like the getDriver is not called before the error appears. Any hint what else need to be adjusted then the ExtensionMetadataFactory::getDriver method?

@stof
Copy link
Member

stof commented Mar 22, 2021

@alexander-schranz be careful about the caching layer. It might be the reason why getDriver is not called.

lchrusciel added a commit to Sylius/Sylius that referenced this issue Mar 22, 2021
… 2.3.0 (pamil)

This PR was merged into the 1.8 branch.

Discussion
----------

See doctrine/DoctrineBundle#1305.

Commits
-------

61848c9 Fix the build by conflicting with doctrine/doctrine-bundle 2.3.0
@alexander-schranz
Copy link
Contributor Author

@stof I cleared the whole var/cache dir and also used the doctrine metadata clear command still the ExtensionMetadataFactory::getDriver method of was never called. Not sure if there is another place we need to have a look at, or there if another cache I did not keep in mind, my brain is little bit full today and needs now a break 🙈 . Would be great if somebody else could maybe give it a try to check what we need to change on the gedmo extension to get this work again.

@ostrolucky
Copy link
Member

Please report issue on https://github.com/doctrine-extensions/DoctrineExtensions instead

@alexander-schranz
Copy link
Contributor Author

@ostrolucky Okay did create the issue there: doctrine-extensions/DoctrineExtensions#2210

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

No branches or pull requests

3 participants