Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Cache] Fix decoration of TagAware adapters in dev#22960
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| { | ||
| $event =$this->start(__FUNCTION__,$tags); | ||
| try { | ||
| return$event->result =$this->pool->invalidateTags($tags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
should it throw when the pool doesn't implement TagAwareAdapterInterface itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I still hesitate, callinginvalidateTags() on it would gives the same error as when calling it on the inner directly, right?
jvasseur commentedMay 30, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Shouldn't we have a separate |
chalasr commentedMay 30, 2017
|
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍
| /** | ||
| * @author Robin Chalas <robin.chalas@gmail.com> | ||
| */ | ||
| class TraceableTagAwareAdapterimplements TagAwareAdapterInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Wouldn't it make sense for this class to extend theTraceableAdapter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Instead of adding a trait? That would require to open the$pool property but I've no strong preference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Else we will need to updateCacheDataCollector as itsaddInstance() method is type hinted withTraceableAdapter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I agree with@xabbuh. I don't really understand the trait purpose appart from allowing us to make it@internal whileTraceableAdapater is already released as "public".
Using inheritance and adding the protectedTraceableAdapter::getPool() method looks a better option to me for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
updated
a780213 to9103167Compare| publicfunction__construct(TagAwareAdapterInterface$pool) | ||
| { | ||
| parent::__construct($pool); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
the constructor is not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
it is: it adds a type hint constraint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
oh indeed
| class TraceableAdapterimplements AdapterInterface | ||
| { | ||
| private$pool; | ||
| /** @internal */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
let's remove that (and the one on the start method)
they are part of the internal api/respo of the class
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍
nicolas-grekas commentedMay 31, 2017
Thank you@chalasr. |
This PR was merged into the 3.3 branch.Discussion----------[Cache] Fix decoration of TagAware adapters in dev| Q | A| ------------- | ---| Branch? | 3.3| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#22956| License | MIT| Doc PR | n/aCommits-------28e615a Fix decorating TagAware adapters in dev
…(chalasr)This PR was merged into the 3.3 branch.Discussion----------[Cache] Fix decoration of TagAware adapters in dev| Q | A| ------------- | ---| Branch? | 3.3| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |symfony#22956| License | MIT| Doc PR | n/aCommits-------28e615a Fix decorating TagAware adapters in dev
tifabien commentedJun 1, 2017
@chalasr, I just pulled the 3.3.x-dev branch and tried your fix. It seems the $definition->getClass() in src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CacheCollectorPass.php:47 always returns null so we always register the TraceableAdapter::class. |
chalasr commentedJun 1, 2017
@tifabien ok I'm looking at it |
chalasr commentedJun 1, 2017
This PR was merged into the 3.3 branch.Discussion----------[FrameworkBundle] Fix CacheCollectorPass priority| Q | A| ------------- | ---| Branch? | 3.3| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets || License | MIT| Doc PR |#22960 (comment)It was run before optimization, so child definitions were not resolved yet.Commits-------28b253a Fix CacheCollectorPass priority
Uh oh!
There was an error while loading.Please reload this page.