Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[FrameworkBundle] Add support for doctrine/annotations:1.13 || 2.0 #40338

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

Merged
merged 1 commit into from
Mar 3, 2021

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Mar 1, 2021

Q A
Branch? 5.x
Bug fix? no
New feature? yes
Deprecations? yes
Tickets
License MIT
Doc PR

This PR will deprecate passing any other values that "none", "php_array" and "file" to framework.annotation.cache. It will also support doctrine/annotations:^1.13 || ^2.0. It will use the PSR-6 cache if possible.

@carsonbot carsonbot changed the title [Fwb] Add support for doctrine/annotations:1.13 || 2.0 [FrameworkBundle] Add support for doctrine/annotations:1.13 || 2.0 Mar 1, 2021
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we do without the config option? I don't feel like this should be configurable. It's impossible to explain in a way that makes sense...

@Nyholm
Copy link
Member Author

Nyholm commented Mar 2, 2021

Without a config option the user cannot specify their own psr6 cache service.

@Nyholm
Copy link
Member Author

Nyholm commented Mar 2, 2021

I removed the option, If the user provides a custom service, I'll check if it is PSR6 compatible or not.

The only "weird" thing now is, if the user is using doctrine/annotations:1.10 (old version) and trying to use a PSR6 cache, they will get an error like "Second argument to X class must be a DoctrineCache, you provided Y.

I could add an extra check for this, but then I also need to check if user that has specified a custom class that implements both doctrine cache and PSR6.. Should I add this extra logic for this edge case?

@Nyholm
Copy link
Member Author

Nyholm commented Mar 2, 2021

Should I add this extra logic for this edge case?

I added a check for all edge cases =)

@derrabus
Copy link
Member

derrabus commented Mar 2, 2021

The only "weird" thing now is, if the user is using doctrine/annotations:1.10 (old version) and trying to use a PSR6 cache

On the 5.x branch, I think we can bump to 1.13 as soon as it's released. Routing already requires 1.12 and I'm about to bump the requirement for the serializer as well.

@Nyholm
Copy link
Member Author

Nyholm commented Mar 2, 2021

On the 5.x branch, I think we can bump to 1.13 as soon as it's released. Routing already requires 1.12 and I'm about to bump the requirement for the serializer as well.

That will not make a difference. Doctrine/annotations is just a dev requirement. I need to add a “conflict”

@derrabus
Copy link
Member

derrabus commented Mar 2, 2021

I need to add a “conflict”

Exactly, see #40266.

@Nyholm
Copy link
Member Author

Nyholm commented Mar 2, 2021

I think we can bump to 1.13 as soon as it's released.

Sure, but that would make things a bit simpler.

@Nyholm
Copy link
Member Author

Nyholm commented Mar 2, 2021

Wohoo. Im just waiting for appveyor. The other builds are super green.

@nicolas-grekas nicolas-grekas added this to the 5.x milestone Mar 2, 2021
@Nyholm
Copy link
Member Author

Nyholm commented Mar 2, 2021

Thank you. I have applied the changes.

@Nyholm
Copy link
Member Author

Nyholm commented Mar 2, 2021

What?! 6/6 is green now. =)

@chalasr chalasr force-pushed the cacne-annotations branch from 2913edf to 91e844b Compare March 3, 2021 14:31
@chalasr
Copy link
Member

chalasr commented Mar 3, 2021

Thank you Tobias.

@chalasr chalasr merged commit fdabaf2 into symfony:5.x Mar 3, 2021
@Nyholm
Copy link
Member Author

Nyholm commented Mar 4, 2021

Thank you for merging and for the reviews.

@Nyholm Nyholm deleted the cacne-annotations branch March 4, 2021 07:42
fabpot added a commit that referenced this pull request 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
@fabpot fabpot mentioned this pull request Apr 18, 2021
@Tobion
Copy link
Contributor

Tobion commented Jul 12, 2021

The documentation hasn't been updated for this. I've opened symfony/symfony-docs#15505

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

Successfully merging this pull request may close these issues.

8 participants