8000 CacheCollectorPass does not work anymore when the cache is decorated · Issue #38055 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

CacheCollectorPass does not work anymore when the cache is decorated #38055

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
shyim opened this issue Sep 4, 2020 · 0 comments
Closed

CacheCollectorPass does not work anymore when the cache is decorated #38055

shyim opened this issue Sep 4, 2020 · 0 comments

Comments

@shyim
Copy link
Contributor
shyim commented Sep 4, 2020

Symfony version(s) affected: 4.4.13 (introduced with 4.4.8)

Description
We have defined in the framework.yaml an own cache pool. We are also decorating that cache.pool. After this the
\Symfony\Component\Cache\DependencyInjection\CacheCollectorPass is throwing an ServiceNotFoundException. It seems so that the definition name changes while decorating.

How to reproduce

  • Create a new cache pool in framework.yaml
  • Decorate it
  • Container cannot be created anymore due missing definition

Possible Solution
Check in addToCollector is it an alias or an actual definition

Additional context

@shyim shyim added the Bug label Sep 4, 2020
@fabpot fabpot closed this as completed Sep 4, 2020
fabpot added a commit that referenced this issue Sep 4, 2020
…(shyim)

This PR was merged into the 4.4 branch.

Discussion
----------

[Cache] Fix CacheCollectorPass with decorated cache pools

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #38055
| License       | MIT
| Doc PR        |

The `getDefinition` call in `addToCollector` does not work when the service is decorated. Also instances will be added with the decoration name. This looks weird in the profiler. I have changed it to prefer the attribute name.

Before:
![image](https://user-images.githubusercontent.com/6224096/92225243-3be27c00-eea3-11ea-8bd5-2ae69212e658.png)

After: (`\Shopware\Storefront\Framework\Cache\CacheDecorator` did go into `cache.object`)
![image](https://user-images.githubusercontent.com/6224096/92225284-47ce3e00-eea3-11ea-885f-cdba95b89302.png)

Commits
-------

9734427 Fix CacheCollectorPass with decorated cache pools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0