-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Display original definition for aliases in debug:container #21129
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,13 +62,13 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio | |
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function describeContainerService($service, array $options = array()) | ||
protected function describeContainerService($service, array $options = array(), ContainerBuilder $builder = null) | ||
{ | ||
if (!isset($options['id'])) { | ||
throw new \InvalidArgumentException('An "id" option must be provided.'); | ||
} | ||
|
||
$this->writeDocument($this->getContainerServiceDocument($service, $options['id'])); | ||
$this->writeDocument($this->getContainerServiceDocument($service, $options['id'], $builder)); | ||
} | ||
|
||
/** | ||
|
@@ -90,9 +90,18 @@ protected function describeContainerDefinition(Definition $definition, array $op | |
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function describeContainerAlias(Alias $alias, array $options = array()) | ||
protected function describeContainerAlias(Alias $alias, array $options = array(), ContainerBuilder $builder = null) | ||
{ | ||
$this->writeDocument($this->getContainerAliasDocument($alias, isset($options['id']) ? $options['id'] : null)); | ||
$dom = new \DOMDocument('1.0', 'UTF-8'); | ||
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, isset($options['id']) ? $options['id'] : null)->childNodes->item(0), true)); | ||
|
||
if (!$builder) { | ||
return $this->writeDocument($dom); | ||
} | ||
|
||
$dom->appendChild($dom->importNode($this->getContainerDefinitionDocument($builder->getDefinition((string) $alias), (string) $alias)->childNodes->item(0), true)); | ||
|
||
$this->writeDocument($dom); | ||
} | ||
|
||
/** | ||
|
@@ -261,17 +270,21 @@ private function getContainerTagsDocument(ContainerBuilder $builder, $showPrivat | |
} | ||
|
||
/** | ||
* @param mixed $service | ||
* @param string $id | ||
* @param mixed $service | ||
* @param string $id | ||
* @param ContainerBuilder|null $builder | ||
* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
* @return \DOMDocument | ||
*/ | ||
private function getContainerServiceDocument($service, $id) | ||
private function getContainerServiceDocument($service, $id, ContainerBuilder $builder = null) | ||
{ | ||
$dom = new \DOMDocument('1.0', 'UTF-8'); | ||
|
||
if ($service instanceof Alias) { | ||
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($service, $id)->childNodes->item(0), true)); | ||
if ($builder) { | ||
$dom->appendChild($dom->importNode($this->getContainerDefinitionDocument($builder->getDefinition((string) $service), (string) $service)->childNodes->item(0), true)); | ||
} | ||
} elseif ($service instanceof Definition) { | ||
$dom->appendChild($dom->importNode($this->getContainerDefinitionDocument($service, $id)->childNodes->item(0), true)); | ||
} else { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_1.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
{ | ||
"service": "service_1", | ||
"public": true | ||
}, | ||
{ | ||
"class": "Full\\Qualified\\Class1", | ||
"public": true, | ||
"synthetic": false, | ||
"lazy": true, | ||
"shared": true, | ||
"abstract": true, | ||
"autowire": false, | ||
"autowiring_types": [], | ||
"file": null, | ||
"factory_class": "Full\\Qualified\\FactoryClass", | ||
"factory_method": "get", | ||
"tags": [] | ||
} | ||
] |
18 changes: 18 additions & 0 deletions
18
...ony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_1.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
alias_1 | ||
~~~~~~~ | ||
|
||
- Service: `service_1` | ||
- Public: yes | ||
|
||
service_1 | ||
~~~~~~~~~ | ||
|
||
- Class: `Full\Qualified\Class1` | ||
- Public: yes | ||
- Synthetic: no | ||
10000 td> | - Lazy: yes | |
- Shared: yes | ||
- Abstract: yes | ||
- Autowired: no | ||
- Factory Class: `Full\Qualified\FactoryClass` | ||
- Factory Method: `get` |
21 changes: 21 additions & 0 deletions
21
src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_1.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[39;49m // [39;49mThis service is an alias for the service [32mservice_1[39m | ||
|
||
[33mInformation for Service "[39m[32mservice_1[39m[33m"[39m | ||
[33m===================================[39m | ||
|
||
------------------ ----------------------------- | ||
[32m Option [39m [32m Value [39m | ||
------------------ ----------------------------- | ||
Service ID service_1 | ||
Class Full\Qualified\Class1 | ||
Tags - | ||
Public yes | ||
Synthetic no | ||
Lazy yes | ||
Shared yes | ||
Abstract yes | ||
Autowired no | ||
Autowiring Types - | ||
Factory Class Full\Qualified\FactoryClass | ||
Factory Method get | ||
------------------ ----------------------------- |
5 changes: 5 additions & 0 deletions
5
src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_1.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<alias id="alias_1" service="service_1" public="true"/> | ||
<definition id="service_1" class="Full\Qualified\Class1" public="true" synthetic="false" lazy="true" shared="true" abstract="true" autowired="false" file=""> | ||
<factory class="Full\Qualified\FactoryClass" method="get"/> | ||
</definition> |
41 changes: 41 additions & 0 deletions
41
src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[ | ||
{ | ||
"service": "service_2", | ||
"public": false | ||
}, | ||
{ | ||
"class": "Full\\Qualified\\Class2", | ||
"public": false, | ||
"synthetic": true, | ||
"lazy": false, | ||
"shared": true, | ||
"abstract": false, | ||
"autowire": false, | ||
"autowiring_types": [], | ||
"file": "\/path\/to\/file", | ||
"factory_service": "factory.service", | ||
"factory_method": "get", | ||
"calls": [ | ||
"setMailer" | ||
], | ||
"tags": [ | ||
{ | ||
"name": "tag1", | ||
"parameters": { | ||
"attr1": "val1", | ||
"attr2": "val2" | ||
} | ||
}, | ||
{ | ||
"name": "tag1", | ||
"parameters": { | ||
"attr3": "val3" | ||
} | ||
}, | ||
{ | ||
"name": "tag2", | ||
"parameters": [] | ||
} | ||
] | ||
} | ||
] |
26 changes: 26 additions & 0 deletions
26
...ony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
alias_2 | ||
~~~~~~~ | ||
|
||
- Service: `service_2` | ||
- Public: no | ||
|
||
service_2 | ||
~~~~~~~~~ | ||
|
||
- Class: `Full\Qualified\Class2` | ||
- Public: no | ||
- Synthetic: yes | ||
- Lazy: no | ||
- Shared: yes | ||
- Abstract: no | ||
- Autowired: no | ||
- File: `/path/to/file` | ||
- Factory Service: `factory.service` | ||
- Factory Method: `get` | ||
- Call: `setMailer` | ||
- Tag: `tag1` | ||
- Attr1: val1 | ||
- Attr2: val2 | ||
- Tag: `tag1` | ||
- Attr3: val3 | ||
- Tag: `tag2` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PHPDoc must be updated (new arg)