Skip to content

Commit

Permalink
feature #27551 [FrameworkBundle] show public/private for aliases in d…
Browse files Browse the repository at this point in the history
…ebug:container command (OskarStark)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[FrameworkBundle] show public/private for aliases in debug:container command

| Q             | A
| ------------- | ---
| Branch?       |  master
| Bug fix?      | no
| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets |    <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | not needed <!-- required for new features -->

It could be helpful to see the public/private status for aliases in `debug:container` command.

Otherwise you need to dive into the code to get the information, because the result only shows the options of the aliased service.

## Look & Feel for public alias
![screenshot 2018-06-08 09 25 50](https://user-images.githubusercontent.com/995707/41144664-f3b50766-6afd-11e8-92d0-ca30513a1afc.png)

_text has slightly changed_

## Look & Feel for private alias
![screenshot 2018-06-08 09 23 31](https://user-images.githubusercontent.com/995707/41144593-b354aad2-6afd-11e8-8ab1-f9196e567f67.png)

_text has slightly changed_

//cc @nicolas-grekas

Commits
-------

1df7742 [FrameworkBundle] show public/private for aliases in debug:container command
  • Loading branch information
nicolas-grekas committed Jun 19, 2018
2 parents c6b3135 + 1df7742 commit c694804
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
Expand Up @@ -352,7 +352,11 @@ protected function describeContainerDefinition(Definition $definition, array $op
*/
protected function describeContainerAlias(Alias $alias, array $options = array(), ContainerBuilder $builder = null)
{
$options['output']->comment(sprintf('This service is an alias for the service <info>%s</info>', (string) $alias));
if ($alias->isPublic()) {
$options['output']->comment(sprintf('This service is a <info>public</info> alias for the service <info>%s</info>', (string) $alias));
} else {
$options['output']->comment(sprintf('This service is a <comment>private</comment> alias for the service <info>%s</info>', (string) $alias));
}

if (!$builder) {
return;
Expand Down
@@ -1,3 +1,3 @@

 // This service is an alias for the service service_1
 // This service is a public alias for the service service_1

@@ -1,3 +1,3 @@

 // This service is an alias for the service .service_2
 // This service is a private alias for the service .service_2

@@ -1,4 +1,4 @@
 // This service is an alias for the service service_1
 // This service is a public alias for the service service_1

Information for Service "service_1"
===================================
Expand Down
@@ -1,4 +1,4 @@
 // This service is an alias for the service .service_2
 // This service is a private alias for the service .service_2

Information for Service ".service_2"
====================================
Expand Down

0 comments on commit c694804

Please sign in to comment.