8000 bug #13305 [FrameworkBundle] fixed missing information in some descri… · symfony/symfony@b5c2600 · GitHub
[go: up one dir, main page]

Skip to content

Commit b5c2600

Browse files
committed
bug #13305 [FrameworkBundle] fixed missing information in some descriptors (fabpot)
This PR was merged into the 2.5 branch. Discussion ---------- [FrameworkBundle] fixed missing information in some descriptors | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits ------- 530af5c [FrameworkBundle] fixed missing information in some descriptors
2 parents b3a55fe + 530af5c commit b5c2600

25 files changed

+175
-27
lines changed

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,15 @@ protected function getRouteData(Route $route)
169169

170170
return array(
171171
'path' => $route->getPath(),
172+
'pathRegex' => $route->compile()->getRegex(),
172173
'host' => '' !== $route->getHost() ? $route->getHost() : 'ANY',
174+
'hostRegex' => '' !== $route->getHost() ? $route->compile()->getHostRegex() : '',
173175
'scheme' => $route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY',
174176
'method' => $route->getMethods() ? implode('|', $route->getMethods()) : 'ANY',
175177
'class' => get_class($route),
176178
'defaults' => $route->getDefaults(),
177179
'requirements' => $requirements ?: 'NO CUSTOM',
178180
'options' => $route->getOptions(),
179-
'pathRegex' => $route->compile()->getRegex(),
180181
);
181182
}
182183

@@ -193,9 +194,24 @@ private function getContainerDefinitionData(Definition $definition, $omitTags =
193194
'scope' => $definition->getScope(),
194195
'public' => $definition->isPublic(),
195196
'synthetic' => $definition->isSynthetic(),
197+
'lazy' => $definition->isLazy(),
198+
'synchronized' => $definition->isSynchronized(),
199+
'abstract' => $definition->isSynchronized(),
196200
'file' => $definition->getFile(),
197201
);
198202

203+
if ($definition->getFactoryClass()) {
204+
$data['factory_class'] = $definition->getFactoryClass();
205+
}
206+
207+
if ($definition->getFactoryService()) {
208+
$data['factory_service'] = $definition->getFactoryService();
209+
}
210+
211+
if ($definition->getFactoryMethod()) {
212+
$data['factory_method'] = $definition->getFactoryMethod();
213+
}
214+
199215
if (!$omitTags) {
200216
$data['tags'] = array();
201217
if (count($definition->getTags())) {

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ protected function describeRoute(Route $route, array $options = array())
4949
unset($requirements['_scheme'], $requirements['_method']);
5050

5151
$output = '- Path: '.$route->getPath()
52+
."\n".'- Path Regex: '.$route->compile()->getRegex()
5253
."\n".'- Host: '.('' !== $route->getHost() ? $route->getHost() : 'ANY')
54+
."\n".'- Host Regex: '.('' !== $route->getHost() ? $route->compile()->getHostRegex() : '')
5355
."\n".'- Scheme: '.($route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY')
5456
."\n".'- Method: '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')
5557
."\n".'- Class: '.get_class($route)
5658
."\n".'- Defaults: '.$this->formatRouterConfig($route->getDefaults())
5759
."\n".'- Requirements: '.$this->formatRouterConfig($requirements) ?: 'NONE'
58-
."\n".'- Options: '.$this->formatRouterConfig($route->getOptions())
59-
."\n".'- Path-Regex: '.$route->compile()->getRegex();
60+
."\n".'- Options: '.$this->formatRouterConfig($route->getOptions());
6061

6162
$this->write(isset($options['name'])
6263
? $options['name']."\n".str_repeat('-', strlen($options['name']))."\n\n".$output
@@ -176,12 +177,27 @@ protected function describeContainerDefinition(Definition $definition, array $op
176177
$output = '- Class: `'.$definition->getClass().'`'
177178
."\n".'- Scope: `'.$definition->getScope().'`'
178179
."\n".'- Public: '.($definition->isPublic() ? 'yes' : 'no')
179-
."\n".'- Synthetic: '.($definition->isSynthetic() ? 'yes' : 'no');
180+
."\n".'- Synthetic: '.($definition->isSynthetic() ? 'yes' : 'no&# F438 39;)
181+
."\n".'- Lazy: '.($definition->isLazy() ? 'yes' : 'no')
182+
."\n".'- Synchronized: '.($definition->isSynchronized() ? 'yes' : 'no')
183+
."\n".'- Abstract: '.($definition->isAbstract() ? 'yes' : 'no');
180184

181185
if ($definition->getFile()) {
182186
$output .= "\n".'- File: `'.$definition->getFile().'`';
183187
}
184188

189+
if ($definition->getFactoryClass()) {
190+
$output .= "\n".'- Factory Class: `'.$definition->getFactoryClass().'`';
191+
}
192+
193+
if ($definition->getFactoryService()) {
194+
$output .= "\n".'- Factory Service: `'.$definition->getFactoryService().'`';
195+
}
196+
197+
if ($definition->getFactoryMethod()) {
198+
$output .= "\n".'- Factory Method: `'.$definition->getFactoryMethod().'`';
199+
}
200+
185201
if (!(isset($options['omit_tags']) && $options['omit_tags'])) {
186202
foreach ($definition->getTags() as $tagName => $tagData) {
187203
foreach ($tagData as $parameters) {

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,22 @@ protected function describeRoute(Route $route, array $options = array())
7272
// fixme: values were originally written as raw
7373
$description = array(
7474
'<comment>Path</comment> '.$route->getPath(),
75+
'<comment>Path Regex</comment> '.$route->compile()->getRegex(),
7576
'<comment>Host</comment> '.('' !== $route->getHost() ? $route->getHost() : 'ANY'),
77+
'<comment>Host Regex</comment> '.('' !== $route->getHost() ? $route->compile()->getHostRegex() : ''),
7678
'<comment>Scheme</comment> '.($route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY'),
7779
'<comment>Method</comment> '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY'),
7880
'<comment>Class</comment> '.get_class($route),
7981
'<comment>Defaults</comment> '.$this->formatRouterConfig($route->getDefaults()),
8082
'<comment>Requirements</comment> '.$this->formatRouterConfig($requirements) ?: 'NO CUSTOM',
8183
'<comment>Options</comment> '.$this->formatRouterConfig($route->getOptions()),
82-
'<comment>Path-Regex</comment> '.$route->compile()->getRegex(),
8384
);
8485

8586
if (isset($options['name'])) {
8687
array_unshift($description, '<comment>Name</comment> '.$options['name']);
8788
array_unshift($description, $this->formatSection('router', sprintf('Route "%s"', $options['name'])));
8889
}
8990

90-
if (null !== $route->compile()->getHostRegex()) {
91-
$description[] = '<comment>Host-Regex</comment> '.$route->compile()->getHostRegex();
92-
}
93-
9491
$this->writeText(implode("\n", $description)."\n", $options);
9592
}
9693

@@ -263,7 +260,25 @@ protected function describeContainerDefinition(Definition $definition, array $op
263260
$description[] = sprintf('<comment>Scope</comment> %s', $definition->getScope());
264261
$description[] = sprintf('<comment>Public</comment> %s', $definition->isPublic() ? 'yes' : 'no');
265262
$description[] = sprintf('<comment>Synthetic</comment> %s', $definition->isSynthetic() ? 'yes' : 'no');
266-
$description[] = sprintf('<comment>Required File</comment> %s', $definition->getFile() ? $definition->getFile() : '-');
263+
$description[] = sprintf('<comment>Lazy</comment> %s', $definition->isLazy() ? 'yes' : 'no');
264+
$description[] = sprintf('<comment>Synchronized</comment> %s', $definition->isSynchronized() ? 'yes' : 'no');
265+
$description[] = sprintf('<comment>Abstract</comment> %s', $definition->isAbstract() ? 'yes' : 'no');
266+
267+
if ($definition->getFile()) {
268+
$description[] = sprintf('<comment>Required File</comment> %s', $definition->getFile() ? $definition->getFile() : '-');
269+
}
270+
271+
if ($definition->getFactoryClass()) {
272+
$description[] = sprintf('<comment>Factory Class</comment> %s', $definition->getFactoryClass());
273+
}
274+
275+
if ($definition->getFactoryService()) {
276+
$description[] = sprintf('<comment>Factory Service</comment> %s', $definition->getFactoryService());
277+
}
278+
279+
if ($definition->getFactoryMethod()) {
280+
$description[] = sprintf('<comment>Factory Method</comment> %s', $definition->getFactoryMethod());
281+
}
267282

268283
$this->writeText(implode("\n", $description)."\n", $options);
269284
}

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
"scope": "container",
66
"public": true,
77
"synthetic": false,
8+
"lazy": true,
9+
"synchronized": true,
10+
"abstract": true,
811
"file": null,
12+
"factory_class": "Full\\Qualified\\FactoryClass",
13+
"factory_method": "get",
914
"tags": [
1015

1116
]

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ definition_1
1111
- Scope: `container`
1212
- Public: yes
1313
- Synthetic: no
14+
- Lazy: yes
15+
- Synchronized: yes
16+
- Abstract: yes
17+
- Factory Class: `Full\Qualified\FactoryClass`
18+
- Factory Method: `get`
1419
1520
1621
Aliases

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
"scope": "container",
66
"public": true,
77
"synthetic": false,
8+
"lazy": true,
9+
"synchronized": true,
10+
"abstract": true,
811
"file": null,
12+
"factory_class": "Full\\Qualified\\FactoryClass",
13+
"factory_method": "get",
914
"tags": [
1015

1116
]
@@ -15,7 +20,12 @@
1520
"scope": "container",
1621
"public": false,
1722
"synthetic": true,
23+
"lazy": false,
24+
"synchronized": false,
25+
"abstract": false,
1826
"file": "\/path\/to\/file",
27+
"factory_service": "factory.service",
28+
"factory_method": "get",
1929
"tags": [
2030
{
2131
"name": "tag1",

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ definition_1
1111
- Scope: `container`
1212
- Public: yes
1313
- Synthetic: no
14+
- Lazy: yes
15+
- Synchronized: yes
16+
- Abstract: yes
17+
- Factory Class: `Full\Qualified\FactoryClass`
18+
- Factory Method: `get`
1419
1520
definition_2
1621
~~~~~~~~~~~~
@@ -19,7 +24,12 @@ definition_2
1924
- Scope: `container`
2025
- Public: no
2126
- Synthetic: yes
27+
- Lazy: no
28+
- Synchronized: no
29+
- Abstract: no
2230
- File: `/path/to/file`
31+
- Factory Service: `factory.service`
32+
- Factory Method: `get`
2333
- Tag: `tag1`
2434
- Attr1: val1
2535
- Attr2: val2

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
"scope": "container",
66
"public": false,
77
"synthetic": true,
8+
"lazy": false,
9+
"synchronized": false,
10+
"abstract": false,
811
"file": "\/path\/to\/file",
12+
"factory_service": "factory.service",
13+
"factory_method": "get",
914
"tags": [
1015
{
1116
"name": "tag1",

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ definition_2
1111
- Scope: `container`
1212
- Public: no
1313
- Synthetic: yes
14+
- Lazy: no
15+
- Synchronized: no
16+
- Abstract: no
1417
- File: `/path/to/file`
18+
- Factory Service: `factory.service`
19+
- Factory Method: `get`
1520
- Tag: `tag1`
1621
- Attr1: val1
1722
- Attr2: val2

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
"scope": "container",
66
"public": false,
77
"synthetic": true,
8-
"file": "\/path\/to\/file"
8+
"lazy": false,
9+
"synchronized": false,
10+
"abstract": false,
11+
"file": "\/path\/to\/file",
12+
"factory_service": "factory.service",
13+
"factory_method": "get"
914
}
1015
],
1116
"tag2": [
@@ -14,7 +19,12 @@
1419
"scope": "container",
1520
"public": false,
1621
"synthetic": true,
17-
"file": "\/path\/to\/file"
22+
"lazy": false,
23+
"synchronized": false,
24+
"abstract": false,
25+
"file": "\/path\/to\/file",
26+
"factory_service": "factory.service",
27+
"factory_method": "get"
1828
}
1929
]
2030
}

0 commit comments

Comments
 (0)
0