Skip to content

[FrameworkBundle] cache:clear fails with doctrine annotations #40353

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

Closed
jrushlow opened this issue Mar 3, 2021 · 3 comments · Fixed by #40444
Closed

[FrameworkBundle] cache:clear fails with doctrine annotations #40353

jrushlow opened this issue Mar 3, 2021 · 3 comments · Fixed by #40444

Comments

@jrushlow
Copy link
Contributor

jrushlow commented Mar 3, 2021

Symfony version(s) affected: 5.x

Description
Command fails due to

Class "Doctrine\Common\Cache\CacheProvider" not found while loading "".

How to reproduce
In a minimal Symfony 5.x app with dev dependencies either run bin/console cache:clear || composer require doctrine/annotations (triggers auto scripts in recipe)

Possible Solution
Unknown

Additional context
Bug discovered in MakerBundles dev CI on PHP 7.4 && 8. Appears to be related to doctrine/annotations#404

@Nyholm
Copy link
Member

Nyholm commented Mar 4, 2021

This must be because if #40338

You don't have doctrine/annotations installed, right?

@Nyholm
Copy link
Member

Nyholm commented Mar 4, 2021

Hm.. I've tested with and without doctrine/annotations. I fail to reproduce this issue. Can you help me on this repo https://github.com/Nyholm/sf-issue-40353?

@jrushlow
Copy link
Contributor Author

jrushlow commented Mar 5, 2021

Hm.. I've tested with and without doctrine/annotations. I fail to reproduce this issue. Can you help me on this repo

Sure thing! reproducing this is a difficult because of how we do the tests over in maker. I'll shoot up a pr to that repo with the conditions that cause the error.

@fabpot fabpot closed this as completed Mar 12, 2021
fabpot added a commit that referenced this issue Mar 12, 2021
…ctrine/annotations:^1.13 (Nyholm)

This PR was squashed before being merged into the 5.3-dev branch.

Discussion
----------

[FrameworkBundle] AnnotationsCacheWarmer should support doctrine/annotations:^1.13

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #40353
| License       | MIT
| Doc PR        |

The `AnnotationsCacheWarmer` is creating a cached a `new CachedReader` in the `doWarmUp()`. But this will fail if doctrine/cache is not installed. In #40338 I added the `kernel.cache_warmer` tag on `annotations.cache_warmer` service even though the doctrine/cache is not installed.

This PR will make sure `AnnotationsCacheWarmer` is using the `PsrCacheReader` when available.

This bug was not found in the tests because doctrine/cache is always installed.

----------

Big golden star to @jrushlow because you test dev-master.

Commits
-------

fb1cc72 [FrameworkBundle] AnnotationsCacheWarmer should support doctrine/annotations:^1.13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants