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

[Serializer] Do not cache attributes ifattributes in context#25185

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

Conversation

@sroze
Copy link
Contributor

QA
Branch?3.3
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#25108
LicenseMIT
Doc PRø

Caching attributes based on the class works only when these attributes are not overwritten. This disables the cache when they are.

To me, thisextractAttributes method should actually be aAttributeResolver dependency that can be decorated using different caching strategies I'd say but... that's a much bigger refactoring that needs more reflection with@dunglas.

@srozesrozeforce-pushed thebugfix-25108-do-not-cache-attributes-if-in-context branch from98561d4 to303280dCompareNovember 28, 2017 09:26
}

if (isset($this->attributesCache[$class])) {
if (isset($this->attributesCache[$class]) && !isset($context['attributes'])) {
Copy link
Member

@lyrixxlyrixxNov 28, 2017
edited
Loading

Choose a reason for hiding this comment

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

If$context['attributes'] is defined, we will fill the $this->attributesCache[$class] array with useless values.

IMHO, the correct patch is:

if (!isset($context['attributes']}return$this->extractAttributes($object,$format,$context);}

before the cache layer

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Good point, updated.

@nicolas-grekasnicolas-grekas added this to the3.3 milestoneNov 28, 2017
@srozesrozeforce-pushed thebugfix-25108-do-not-cache-attributes-if-in-context branch from303280d to6e87382CompareNovember 28, 2017 12:04
@fabpot
Copy link
Member

Thank you@sroze.

@fabpotfabpot merged commit6e87382 intosymfony:3.3Nov 29, 2017
fabpot added a commit that referenced this pull requestNov 29, 2017
…ntext (sroze)This PR was merged into the 3.3 branch.Discussion----------[Serializer] Do not cache attributes if `attributes` in context| Q             | A| ------------- | ---| Branch?       | 3.3| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#25108| License       | MIT| Doc PR        | øCaching attributes based on the class works only when these attributes are not overwritten. This disables the cache when they are.To me, this `extractAttributes` method should actually be a `AttributeResolver` dependency that can be decorated using different caching strategies I'd say but... that's a much bigger refactoring that needs more reflection with@dunglas.Commits-------6e87382 Do not cache cache attributes if `attributes` is in the context
This was referencedNov 30, 2017
@srozesroze deleted the bugfix-25108-do-not-cache-attributes-if-in-context branchJanuary 15, 2018 10:47
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@lyrixxlyrixxlyrixx approved these changes

+1 more reviewer

@SimperfitSimperfitSimperfit approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

6 participants

@sroze@fabpot@lyrixx@Simperfit@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp