Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[FrameworkBundle] Moving Cache-related CompilerPass to Cache component #27770

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

Conversation

Korbeil
Copy link
Contributor

@Korbeil Korbeil commented Jun 29, 2018

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? yes
Deprecations? yes
Tests pass? yes
Fixed tickets
License MIT
Doc PR

Hi, first PR here πŸŽ‰

This is related to #27479 and a first work to move Cache-related CompilerPass out of FrameworkBundle, it allows to decouple part of the FrameworkBundle configuration classes.

Since we didn't choosed a fixed directory organization to manage theses, I actually did same as in Bundles and used DependencyInjection folder. If we do choose to follow my last comment directory organization proposal, I'll move theses CompilerPass to Framework/DependencyInjection/Compiler directory (nothing hard here).

Thanks to @DanieleGBX that helped me checking this PR and gave me some good advices !

Here is a list of all CompilerPass I moved, with related component (I also moved related tests when they were present):

  • Cache - CacheCollectorPass
  • Cache - CachePoolClearerPass
  • Cache - CachePoolPass
  • Cache - CachePoolPrunerPass

@Korbeil Korbeil requested a review from lyrixx as a code owner June 29, 2018 11:06
@Korbeil Korbeil changed the title Moving all component-related CompilerPass to their component [FrameworkBundle] Moving all component-related CompilerPass to their component Jun 29, 2018
@stof
Copy link
Member

stof commented Jun 29, 2018

This requires adding conflict rules with all older versions of the components (or updating the min version in the require key in case of mandatory requirements) in the FrameworkBundle composer.json. Otherwise, we might end up installing an older version of the component, and have it half-configured due to not running the compiler pass.

@chalasr chalasr added this to the next milestone Jun 29, 2018
@chalasr chalasr removed the BC Break label Jun 29, 2018
@Korbeil Korbeil force-pushed the feature/moving-compiler-pass-out-of-framework-bundle branch 2 times, most recently from 0d7635d to 75a38fc Compare June 29, 2018 14:38

$translatorClass = $container->getParameterBag()->resolveValue($container->findDefinition('translator')->getClass());

if (!is_subclass_of($translatorClass, 'Symfony\Component\Translation\TranslatorBagInterface')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could take the opportunity to use TranslatorBagInterface::class

/**
* @author Abdellatif Ait boudad <[email protected]>
*/
class TranslationLoggingPass implements CompilerPassInterface
Copy link
Contributor

Choose a reason for hiding this comment

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

Keeping it named LoggingTranslatorPass would be more consistent with Symfony\Component\Translation\LoggingTranslator

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to be consistant with other CompilerPass that were already in Translation/DependencyInjection, I can move back to the old name if preferred .

@lyrixx
Copy link
Member

lyrixx commented Jul 3, 2018

@Korbeil you also need to remove theses line: https://github.com/symfony/symfony/blob/master/.github/CODEOWNERS#L25-L26

@Korbeil Korbeil force-pushed the feature/moving-compiler-pass-out-of-framework-bundle branch 6 times, most recently from 3e3cbff to 3cf69f8 Compare July 9, 2018 08:02
@Korbeil Korbeil force-pushed the feature/moving-compiler-pass-out-of-framework-bundle branch 2 times, most recently from 3b4e4d7 to 7c57468 Compare July 11, 2018 12:13
@Korbeil
Copy link
Contributor Author

Korbeil commented Jul 11, 2018

After quick talk with @nicolas-grekas I choosed to split this PR for each component

Now this one contains only moved CompilerPass for Cache component.

@Korbeil Korbeil changed the title [FrameworkBundle] Moving all component-related CompilerPass to their component [FrameworkBundle] Moving Cache-related CompilerPass to their component Jul 11, 2018
@Korbeil Korbeil changed the title [FrameworkBundle] Moving Cache-related CompilerPass to their component [FrameworkBundle] Moving Cache-related CompilerPass to Cache component Jul 11, 2018
@Korbeil Korbeil force-pushed the feature/moving-compiler-pass-out-of-framework-bundle branch 3 times, most recently from e619abd to 1c8c114 Compare July 11, 2018 12:34
@Korbeil Korbeil force-pushed the feature/moving-compiler-pass-out-of-framework-bundle branch 2 times, most recently from 3dab36d to 28703e5 Compare August 17, 2018 08:44
@Korbeil Korbeil force-pushed the feature/moving-compiler-pass-out-of-framework-bundle branch from 1bfe564 to 977f17d Compare August 31, 2018 15:39
@Korbeil Korbeil force-pushed the feature/moving-compiler-pass-out-of-framework-bundle branch 2 times, most recently from 530ed5d to ce556cc Compare September 20, 2018 12:02
@Korbeil
Copy link
Contributor Author

Korbeil commented Sep 24, 2018

Hi @nicolas-grekas, anymore work to do here?

@@ -9,15 +9,15 @@
* file that was distributed with this source code.
*/

namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
Copy link
Member

Choose a reason for hiding this comment

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

The old test must be kept and marked as @legacy until the deprecated class is removed (same for all passes moved here)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just reverted old tests, for @legacy you want it on all tests ?
Is it also needed on passes since we have the @deprecated tag ?

Copy link
Member

@nicolas-grekas nicolas-grekas Sep 25, 2018

Choose a reason for hiding this comment

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

it's @group legacy on the test classes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be okay, tell me if I forgot something.

@Korbeil Korbeil force-pushed the feature/moving-compiler-pass-out-of-framework-bundle branch 4 times, most recently from d14b867 to 95f87a5 Compare September 25, 2018 12:09
@@ -58,7 +61,7 @@ public function testCompilePassIsIgnoredIfCommandDoesNotExist()

/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
* @expectedExceptionMessage Class "Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\NotFound" used for service "pool.not-found" cannot be found.
* @expectedExceptionMessage Class "Symfony\Component\Cache\Tests\DependencyInjection\NotFound" used for service "pool.not-found" cannot be found.
Copy link
Member

Choose a reason for hiding this comment

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

should be reverted

Copy link
Contributor Author

@Korbeil Korbeil Sep 25, 2018

Choose a reason for hiding this comment

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

Was checking tests and just saw that, sorry :/

@Korbeil Korbeil force-pushed the feature/moving-compiler-pass-out-of-framework-bundle branch from 95f87a5 to 2a81bdb Compare September 25, 2018 12:17
@Korbeil Korbeil force-pushed the feature/moving-compiler-pass-out-of-framework-bundle branch from 2a81bdb to 53e7040 Compare September 26, 2018 15:26
@fabpot
Copy link
Member

fabpot commented Oct 10, 2018

Thank you @Korbeil.

@fabpot fabpot merged commit 53e7040 into symfony:master Oct 10, 2018
fabpot added a commit that referenced this pull request Oct 10, 2018
… Cache component (Korbeil)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[FrameworkBundle] Moving Cache-related CompilerPass to Cache component

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Hi, first PR here πŸŽ‰

This is related to #27479 and a first work to move Cache-related CompilerPass out of `FrameworkBundle`, it allows to decouple part of the FrameworkBundle configuration classes.

Since we didn't choosed a fixed directory organization to manage theses, I actually did same as in Bundles and used DependencyInjection folder. If we do choose to follow my [last comment directory organization proposal](#27479 (comment)), I'll move theses CompilerPass to `Framework/DependencyInjection/Compiler` directory (nothing hard here).

Thanks to @DanieleGBX that helped me checking this PR and gave me some good advices !

Here is a list of all CompilerPass I moved, with related component (I also moved related tests when they were present):
- **Cache** - CacheCollectorPass
- **Cache** - CachePoolClearerPass
- **Cache** - CachePoolPass
- **Cache** - CachePoolPrunerPass

Commits
-------

53e7040 moving Cache-related compiler pass from FrameworkBundle to Cache component
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
This was referenced Nov 3, 2018
@Korbeil Korbeil deleted the feature/moving-compiler-pass-out-of-framework-bundle branch February 4, 2019 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants