Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpKernel] Fix using entities with the#[Cache()] attribute#48509

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:6.2fromHypeMC:cache-attribute-fix
Dec 6, 2022

Conversation

@HypeMC
Copy link
Member

QA
Branch?6.2
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#48506
LicenseMIT
Doc PR-

The#[Cache()] attribute is suppose to be a replacement for the SensioFrameworkExtraBundle@Cache annotation, but unlike the annotation, it doesn't work when entities are used in expressions. The reason for it is that theCacheAttributeListener is triggered by akernel.controller event, while theEntityValueResolver is called afterwards:

$event =newControllerEvent($this,$controller,$request,$type);
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER);
$controller =$event->getController();
// controller arguments
$arguments =$this->argumentResolver->getArguments($request,$controller,$event->getControllerReflector());
$event =newControllerArgumentsEvent($this,$event,$arguments,$request,$type);
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
$controller =$event->getController();

This PR attempts to solve this problem by changing the event of theCacheAttributeListener tokernel.controller_arguments. Even though this has a BC break the listener was introduced in 6.2 so it might still be early enough to make this change? In any case, I don't have a better idea how to fix this, so I'm open to suggestions.

@fabpot
Copy link
Member

Thank you@HypeMC.

@fabpotfabpot merged commit7d45767 intosymfony:6.2Dec 6, 2022
@HypeMCHypeMC deleted the cache-attribute-fix branchDecember 6, 2022 17:07
@fabpotfabpot mentioned this pull requestDec 6, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

6.2

Development

Successfully merging this pull request may close these issues.

5 participants

@HypeMC@fabpot@nicolas-grekas@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp