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

[DX][FrameworkBundle] Show private aliases in debug:container#22385

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

Merged
fabpot merged 1 commit intosymfony:masterfromchalasr:debug-container-privates
May 3, 2017

Conversation

@chalasr
Copy link
Member

@chalasrchalasr commentedApr 11, 2017
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#16388Haehnchen/idea-php-symfony2-plugin#618
LicenseMIT
Doc PRn/a

By building and compiling the container withoutTYPE_REMOVING passes, private aliases are available (shown when--show-private is passed). The ContainerBuilderDebugDumpPass now makes use of the ConfigCache component, removing the need for clearing the cache to get the debug:container output up to date (in sync with latest config).

Config

services:AppBundle\Foo:public:falsefoo_consumer1:class:AppBundle\Fooarguments:[ '@AppBundle\Foo' ]foo_consumer2:class:AppBundle\Fooarguments:[ '@AppBundle\Foo' ]foo_alias:alias:AppBundle\Foofoo_private_alias:public:falsealias:AppBundle\Foo

Before

before

After

after

ro0NL, enleur, maidmaid, theofidry, tjaari, and apfelbox reacted with thumbs up emojilinaori, ogizanagi, yceruto, theofidry, and enleur reacted with hooray emoji
@chalasrchalasrforce-pushed thedebug-container-privates branch fromd5615bf tod18ba64CompareApril 11, 2017 21:44
@chalasrchalasr changed the title[FrameworkBundle] Show private aliases in debug:container[DX][FrameworkBundle] Show private aliases in debug:containerApr 11, 2017
@chalasrchalasrforce-pushed thedebug-container-privates branch 5 times, most recently from4581894 to7d744e0CompareApril 12, 2017 09:35
@chalasr
Copy link
MemberAuthor

Change documented and functionally tested.

@chalasrchalasrforce-pushed thedebug-container-privates branch 2 times, most recently from374f779 toa065014CompareApril 12, 2017 09:40
@nicolas-grekasnicolas-grekas added this to the3.4 milestoneApr 13, 2017
@chalasr
Copy link
MemberAuthor

I can't imagine any existing feature impacted by this change. Also, the fixed ticket is 2 years old and it seems everyone agree this would be useful, it makes things simpler.

That said , I would love to get this in 3.3.

@chalasr
Copy link
MemberAuthor

Added some screenshots to the PR body.

@javiereguiluzjaviereguiluz added the DXDX = Developer eXperience (anything that improves the experience of using Symfony) labelApr 14, 2017
Copy link
Member

@javiereguiluzjaviereguiluz left a comment

Choose a reason for hiding this comment

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

I can't review this proposal technically, but from the DX point of view is perfect! Thanks@chalasr.


if (!is_file($cachedFile =$this->getContainer()->getParameter('debug.container.dump'))) {
thrownew \LogicException('Debug information about the container could not be found. Please clear the cache and try again.');
if (is_file($cachedFile =$this->getContainer()->getParameter('debug.container.dump'))) {
Copy link
Member

Choose a reason for hiding this comment

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

AFAIK,debug.container.dump was only added by the compiler pass you deprecated. So this looks suspicious to me

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This parameter isn't added by the pass, but loaded from therehttps://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml#L8. Do you think it's time to remove it?

if (!$this->getApplication()->getKernel()->isDebug()) {
$kernel =$this->getApplication()->getKernel();

if (!$kernel->isDebug()) {
Copy link
Member

Choose a reason for hiding this comment

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

do we actually need to keep this restriction ? Previously, it was because you the compiler pass was only dumping the file in debug mode. But you don't rely on this file anymore.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

If we're sure there is nothing wrong to get these informations available in non debug mode, I would be glad to remove this check.

$container->compile();
$filesystem =newFilesystem();
try {
$filesystem->dumpFile($cachedFile, (newXmlDumper($container))->dump());
Copy link
Member

Choose a reason for hiding this comment

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

why dumping it ? If the goal is to use a cache to make next calls to the command faster, you must use the ConfigCache component to invalidate the cache when the container changes. Otherwise, the command will give outdated data once you edit the container.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

The goal is indeed to make the next call faster, as it is currently. About invalidation, it seems to work naturally when clearing the cache, maybe due to the fact this dump is named%kernel.cache_dir%/%kernel.container_class%.xml? Not sure if it's worth dumping it at all, I think it's relevant to don't need to clear the cache for getting debug informations. WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

except that in dev, Inever clear the cache fuly (except when running a composer command doing it for me), as cache files are refreshed individually when needed in debug mode (which is the main feature of the debug mode)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

updated to use config cache, removed thedebug.container.dump parameter also

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

parameter removal and compiler pass deprecation reverted, it now leverages the debug mode properly which isn't the case currently. It would be great if you could have a look

@chalasrchalasrforce-pushed thedebug-container-privates branch 2 times, most recently from43d9aae tobadb0dcCompareApril 14, 2017 14:05
$container =$buildContainer();
$container->getCompilerPassConfig()->setRemovingPasses(array());
$container->compile();
$cache->write((newXmlDumper($container))->dump(),array(newFileResource($cacheDir.'/'.$containerClass.'.php')));
Copy link
Member

Choose a reason for hiding this comment

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

you should rather register the ContainerBuilder resources here rather than a FileResource for the compiled container

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

done

@chalasrchalasrforce-pushed thedebug-container-privates branch 2 times, most recently from57596c0 to84b1a47CompareApril 14, 2017 14:12
@nicolas-grekas
Copy link
Member

I may have read too quickly, but doesn't this remove an XML file that maybe of use to some tier tools? Eg the phpstorm SF plugin and the likes?

@chalasrchalasrforce-pushed thedebug-container-privates branch 2 times, most recently from1cad653 to57db321CompareApril 14, 2017 15:28
@chalasr
Copy link
MemberAuthor

chalasr commentedApr 14, 2017
edited
Loading

@nicolas-grekas You're right, the phpstorm plugin relies on.
I managed to make this work using the container dumped by theContainerBuilderDebugDumpPass, this does not deprecate it anymore. It should even improve the features of the phpstorm plugin.

@Haehnchen
Copy link
Contributor

Haehnchen commentedApr 14, 2017
edited
Loading

PhpStorm Plugin point of view. as i see this PR just extends the xml files, so i am able to resolveHaehnchen/idea-php-symfony2-plugin#618 on my side

chalasr reacted with thumbs up emoji

@chalasrchalasrforce-pushed thedebug-container-privates branch from8dde8ae to5810d77CompareApril 14, 2017 17:46
@nicolas-grekas
Copy link
Member

👍

@chalasrchalasrforce-pushed thedebug-container-privates branch 2 times, most recently fromc0d418d to051b200CompareApril 14, 2017 17:50
@nicolas-grekas
Copy link
Member

ping @symfony/deciders
OK to merge this one for 3.3 as requested?

Nek- reacted with heart emoji

@chalasrchalasrforce-pushed thedebug-container-privates branch 7 times, most recently from051b200 to6746c06CompareApril 20, 2017 21:14
@chalasrchalasrforce-pushed thedebug-container-privates branch from6746c06 to883723eCompareApril 20, 2017 22:49
@chalasr
Copy link
MemberAuthor

PR rebased.

@weaverryan
Copy link
Member

👍 (and 👍 for 3.3 for me, it's really a bug fix)

@chalasr
Copy link
MemberAuthor

I think we are good here.

@chalasr
Copy link
MemberAuthor

Can we reconsider the milestone here? A lot of services can be made private in 3.3, it would be too bad to miss them.

ogizanagi and weaverryan reacted with thumbs up emoji

@weaverryan
Copy link
Member

I also think we should reconsider this a bug fix for 3.3. "Types" are much more important in 3.3... but there's no way to get a list of them. And currently we can't even usedebug:container because almost all of the types aliases are private and don't show up currently.

When I rundebug:container --show-private and filter for ids that are class names, I get exactly4. With this PR I get 36.

Would it be possible to bump this to 3.3 as a bug fix?

@fabpot
Copy link
Member

Thank you@chalasr.

chalasr, weaverryan, and apfelbox reacted with hooray emoji

@fabpotfabpot merged commit883723e intosymfony:masterMay 3, 2017
fabpot added a commit that referenced this pull requestMay 3, 2017
…ntainer (chalasr)This PR was merged into the 3.3-dev branch.Discussion----------[DX][FrameworkBundle] Show private aliases in debug:container| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#16388Haehnchen/idea-php-symfony2-plugin#618| License       | MIT| Doc PR        | n/aBy building and compiling the container without `TYPE_REMOVING` passes, private aliases are available (shown when `--show-private` is passed). The ContainerBuilderDebugDumpPass now makes use of the ConfigCache component, removing the need for clearing the cache to get the debug:container output up to date (in sync with latest config).Config-------```yamlservices:    AppBundle\Foo:        public: false    foo_consumer1:        class: AppBundle\Foo        arguments: [ '@appbundle\Foo' ]    foo_consumer2:        class: AppBundle\Foo        arguments: [ '@appbundle\Foo' ]    foo_alias:        alias: AppBundle\Foo    foo_private_alias:        public: false        alias: AppBundle\Foo```Before-------![before](http://image.prntscr.com/image/2a69485a4a764316a90260b4e3dfc2a2.png)After------![after](http://image.prntscr.com/image/ea42daa0e5c94841a28dd256450dc8ef.png)Commits-------883723e Show private aliases in debug:container
@chalasrchalasr deleted the debug-container-privates branchMay 3, 2017 19:27
fabpot added a commit that referenced this pull requestMay 4, 2017
This PR was squashed before being merged into the 3.3-dev branch (closes#22624).Discussion----------debug:container --types (classes/interfaces)| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | none, but needed insymfony/symfony-docs#7807| License       | MIT| Doc PR        | n/aIn Symfony 3.3, the *type* (i.e. class/interface) is the most important thing about a service. But, we don't have a way for the user to know *what* types are available. This builds on top of `debug:container` to make `debug:container --types`:<img width="1272" alt="screen shot 2017-05-03 at 3 42 37 pm" src="https://cloud.githubusercontent.com/assets/121003/25678671/8bebacaa-3018-11e7-9cf6-b7654e2cae88.png">I think we need this for 3.3, so I've made the diff as *small* as possible. We could make improvements for 3.4, but just *having* this is the most important. I could even remove `format` support to make the diff smaller.~~This depends on#22385, which fixes a "bug" where private services aren't really shown.~~Thanks!Commits-------25a39c2 debug:container --types (classes/interfaces)
@fabpotfabpot mentioned this pull requestMay 17, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof requested changes

@javiereguiluzjaviereguiluzjaviereguiluz approved these changes

Assignees

No one assigned

Labels

DeprecationDXDX = Developer eXperience (anything that improves the experience of using Symfony)FeatureFrameworkBundleStatus: Needs Review

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

8 participants

@chalasr@nicolas-grekas@Haehnchen@weaverryan@fabpot@javiereguiluz@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp