Skip to content

Deprecating FormatCacheClearerCompilerPass #8037

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

Open
wants to merge 1 commit into
base: 2.6
Choose a base branch
from

Conversation

mamazu
Copy link
Contributor

@mamazu mamazu commented Jul 4, 2025

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? yes
Fixed tickets -
Related issues/PRs #7402
License MIT
Documentation PR sulu/sulu-docs#

What's in this PR?

Deprecating the FormatCacheClearerCompilerPass and auto registering all classes that implement the CacheClearCompilerPass interface.

Why?

Symfony already implements this feature. Why not use it?

Example Usage

<service id="sulu_media.format_cache_clearer" class="Sulu\Bundle\MediaBundle\Media\FormatCache\FormatCacheClearer">
    <argument type="tagged_iterator" tag="sulu_media.format_cache" index-by="alias" />
</service>

@mamazu mamazu added Technical Debt Impacts code quality, no or just small impact on end developers and users DX Affecting the end developer labels Jul 4, 2025
Comment on lines +26 to +33
/**
* @param iterable<string, FormatCacheInterface> $caches
*/
public function __construct(iterable $caches = [])
{
$this->caches = [...$caches];
}

Copy link
Member

Choose a reason for hiding this comment

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

This is always an empty array on this branch or I'm missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this is correct because otherwise it would have the cache clearer twice once from the constructor and once from the add calls. In 3.0 this will be non empty.

@mamazu mamazu force-pushed the tagged_iterator_format_cache_clearer branch from 40fffe0 to ab94f93 Compare July 7, 2025 18:46
@alexander-schranz
Copy link
Member

alexander-schranz commented Jul 8, 2025

Would deprecate the add method also, but only as phpdoc as it still called in core.

@mamazu mamazu force-pushed the tagged_iterator_format_cache_clearer branch from ab94f93 to 9d6045f Compare July 8, 2025 11:41
@mamazu
Copy link
Contributor Author

mamazu commented Jul 8, 2025

@alexander-schranz Done, should I also apply these changes to the other PRs that deprecate compiler passes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Affecting the end developer Technical Debt Impacts code quality, no or just small impact on end developers and users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants