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

Skip to content

[TwigBundle][FrameworkBundle] Remove the internals from debug autowiring #25011

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

Simperfit
Copy link
Contributor

@Simperfit Simperfit commented Nov 18, 2017

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

#SymfonyConHackday2017
@nicolas-grekas @weaverryan @fabpot @stof It should be OK to review and to merge.

@nicolas-grekas
Copy link
Member

Test don't pass yet :)
Wondering two things:

  • does ConsoleCommandPass prefer a specific naming scheme?
  • running debug:autowiring on a 3.4 standard edition, I get this list. Looks like there could me more FQCN ids removed (not only on symfony/symfony, would you mind cleaning them also?)
  Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener                 
  Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener                  
  Sensio\Bundle\FrameworkExtraBundle\EventListener\IsGrantedListener                  
  Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener             
  Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener                   
  Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener                   
  Sensio\Bundle\FrameworkExtraBundle\Request\ArgumentNameConverter                    
  Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DateTimeParamConverter    
  Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter    
  Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterManager     
  Sensio\Bundle\FrameworkExtraBundle\Routing\AnnotatedRouteControllerLoader           
  Sensio\Bundle\FrameworkExtraBundle\Security\ExpressionLanguage                      
  Sensio\Bundle\FrameworkExtraBundle\Templating\TemplateGuesser                       
  Symfony\Bridge\Twig\Command\DebugCommand                                            
  Symfony\Bundle\FrameworkBundle\Command\AboutCommand                                 
  Symfony\Bundle\FrameworkBundle\Command\AssetsInstallCommand                         
  Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand                            
  Symfony\Bundle\FrameworkBundle\Command\CachePoolClearCommand                        
  Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand                        
  Symfony\Bundle\FrameworkBundle\Command\CacheWarmupCommand                           
  Symfony\Bundle\FrameworkBundle\Command\ConfigDebugCommand                           
  Symfony\Bundle\FrameworkBundle\Command\ConfigDumpReferenceCommand                   
  Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand                        
  Symfony\Bundle\FrameworkBundle\Command\DebugAutowiringCommand                       
  Symfony\Bundle\FrameworkBundle\Command\EventDispatcherDebugCommand                  
  Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand                           
  Symfony\Bundle\FrameworkBundle\Command\RouterMatchCommand                           
  Symfony\Bundle\FrameworkBundle\Command\XliffLintCommand                             
  Symfony\Bundle\FrameworkBundle\Command\YamlLintCommand                              
  Symfony\Bundle\FrameworkBundle\Controller\RedirectController                        
  Symfony\Bundle\FrameworkBundle\Controller\TemplateController                        
  Symfony\Bundle\SecurityBundle\Command\UserPasswordEncoderCommand                    
  Symfony\Bundle\TwigBundle\Command\LintCommand                                       
  Symfony\Component\Config\Resource\SelfCheckingResourceChecker                       
  Symfony\Component\DependencyInjection\Config\ContainerParametersResourceChecker     
  Symfony\Component\ExpressionLanguage\ExpressionLanguage                             
  Symfony\Component\Form\Command\DebugCommand                                         
  Symfony\Component\Routing\Loader\AnnotationDirectoryLoader                          
  Symfony\Component\Routing\Loader\AnnotationFileLoader                               

@Simperfit Simperfit force-pushed the hotfix/the-debug-autowiring-command-is-confusing branch 4 times, most recently from 4991228 to bc7c0f0 Compare November 18, 2017 12:31
<tag name="console.command" command="lint:yaml" />
</service>

<service id="Symfony\Component\Form\Command\DebugCommand">
<service id="console.debug_command" class="Symfony\Component\Form\Command\DebugCommand">
Copy link
Member

@nicolas-grekas nicolas-grekas Nov 18, 2017

Choose a reason for hiding this comment

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

suffix "command" here, but not on the other ones, should it be always here?

@@ -314,7 +313,7 @@ public function testWorkflowServicesCanBeEnabled()
$container = $this->createContainerFromFile('workflows_enabled');

$this->assertTrue($container->has(Registry::class));
$this->assertTrue($container->hasDefinition(WorkflowDumpCommand::class));
$this->assertTrue($container->hasDefinition('console.workflow_dump'));
Copy link
Member

@nicolas-grekas nicolas-grekas Nov 18, 2017

Choose a reason for hiding this comment

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

console.command.workflow_dump? other convention?

Copy link
Contributor

Choose a reason for hiding this comment

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

console.command.<underscored_name> 👍

@@ -112,13 +112,13 @@
<argument>%kernel.debug%</argument>
</service>

<service id="Symfony\Bundle\FrameworkBundle\Controller\RedirectController" public="true">
<service id="framework.controller.redirect" class="Symfony\Bundle\FrameworkBundle\Controller\RedirectController" public="true">
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to keep this and the next one, not for autowiring, but to ease routing

@Simperfit Simperfit force-pushed the hotfix/the-debug-autowiring-command-is-confusing branch from bc7c0f0 to 7aab8a9 Compare November 19, 2017 07:52
@Simperfit
Copy link
Contributor Author

The review has been taken into account.

<tag name="console.command" command="lint:yaml" />
</service>

<service id="Symfony\Component\Form\Command\DebugCommand">
<service id="console.command.debug" class="Symfony\Component\Form\Command\DebugCommand">
Copy link
Contributor

Choose a reason for hiding this comment

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

console.command.form_debug id say

Copy link
Member

Choose a reason for hiding this comment

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

agreed

@@ -314,7 +313,7 @@ public function testWorkflowServicesCanBeEnabled()
$container = $this->createContainerFromFile('workflows_enabled');

$this->assertTrue($container->has(Registry::class));
$this->assertTrue($container->hasDefinition(WorkflowDumpCommand::class));
$this->assertTrue($container->hasDefinition('console.workflow_dump'));
Copy link
Contributor

Choose a reason for hiding this comment

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

console.command.<underscored_name> 👍

@@ -7,13 +7,13 @@
<services>
<defaults public="false" />

<service id="Symfony\Bridge\Twig\Command\DebugCommand">
<service id="twig.debug_command" class="Symfony\Bridge\Twig\Command\DebugCommand">
Copy link
Contributor

Choose a reason for hiding this comment

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

twig.commmand.*?

Copy link
Member

Choose a reason for hiding this comment

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

would make sense for consistency.

@@ -7,101 +7,101 @@
<services>
<defaults public="false" />

<service id="console.error_listener" class="Symfony\Component\Console\EventListener\ErrorListener">
<service id="console.command.error_listener" class="Symfony\Component\Console\EventListener\ErrorListener">
Copy link
Member

Choose a reason for hiding this comment

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

renamig is not good. This service is not a command

<tag name="console.command" command="lint:yaml" />
</service>

<service id="Symfony\Component\Form\Command\DebugCommand">
<service id="console.command.debug" class="Symfony\Component\Form\Command\DebugCommand">
Copy link
Member

Choose a reason for hiding this comment

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

agreed

<argument type="service" id="translation.writer" />
<argument type="service" id="translation.reader" />
<argument type="service" id="translation.extractor" />
<argument>%kernel.default_locale%</argument>
<tag name="console.command" command="translation:update" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand">
<service id='console.workflow_dump' class="Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand">
Copy link
Member

Choose a reason for hiding this comment

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

missing .command for consistency

@@ -7,13 +7,13 @@
<services>
<defaults public="false" />

<service id="Symfony\Bridge\Twig\Command\DebugCommand">
<service id="twig.debug_command" class="Symfony\Bridge\Twig\Command\DebugCommand">
Copy link
Member

Choose a reason for hiding this comment

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

would make sense for consistency.

@chalasr
Copy link
Member

chalasr commented Nov 19, 2017

does ConsoleCommandPass prefer a specific naming scheme?

@nicolas-grekas if that's what you wonder, AddConsoleCommandPass should process correctly no matter the service id

@Simperfit Simperfit force-pushed the hotfix/the-debug-autowiring-command-is-confusing branch from 7aab8a9 to ec069ef Compare November 20, 2017 07:10
@Simperfit
Copy link
Contributor Author

done @stof

<argument type="service" id="translation.writer" />
<argument type="service" id="translation.reader" />
<argument type="service" id="translation.extractor" />
<argument>%kernel.default_locale%</argument>
<tag name="console.command" command="translation:update" />
</service>

<service id="Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand">
<service id='console.command.workflow_dump' class="Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand">
Copy link
Member

Choose a reason for hiding this comment

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

double quote

@Simperfit Simperfit force-pushed the hotfix/the-debug-autowiring-command-is-confusing branch from ec069ef to e2ecf05 Compare November 20, 2017 09:13
@Simperfit Simperfit force-pushed the hotfix/the-debug-autowiring-command-is-confusing branch from e2ecf05 to 491839b Compare November 20, 2017 09:25
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Nov 20, 2017

There are two remaining services when testing this with the standard edition:

  • Symfony\Component\Routing\Loader\AnnotationDirectoryLoader
  • Symfony\Component\Routing\Loader\AnnotationFileLoader

looking more precisely with @Simperfit, we discovered that these classes are actually registered twice: first with a class as id, second with a regular id. Needs to be understood and fixed.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

(the remaining two services are declared by SensioFrameworkExtraBundle)

@nicolas-grekas
Copy link
Member

Thank you @Simperfit.

@nicolas-grekas nicolas-grekas merged commit 491839b into symfony:3.4 Nov 20, 2017
nicolas-grekas added a commit that referenced this pull request Nov 20, 2017
…debug autowiring (Simperfit)

This PR was merged into the 3.4 branch.

Discussion
----------

[TwigBundle][FrameworkBundle] Remove the internals from debug autowiring

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? |no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #24986
| License       | MIT
| Doc PR        |

#SymfonyConHackday2017
@nicolas-grekas @weaverryan @fabpot @stof It should be OK to review and to merge.

Commits
-------

491839b [TwigBundle][FrameworkBundle] Remove the internals from debug autowiring
nicolas-grekas added a commit that referenced this pull request Dec 8, 2017
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] Fix debug:form command definition

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

Sadly these changes were forgotten in #25011 and the `debug:form` command does not work properly right now :(

Commits
-------

97fdf31 Fix debug:form definition
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.

7 participants