Skip to content

[Validator] Added missing error codes and turned codes into UUIDs #12388

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

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0642911
[FrameworkBundle] Add a doctrine cache service definition for validat…
jakzal Apr 21, 2015
b93bcc1
Fixed colspan issues with multiple render() calls
jaytaph Jun 14, 2015
f42c777
[Form] moved data trimming logic of TrimListener into StringUtil
issei-m Jun 20, 2015
3151614
feature #14660 [Form] moved data trimming logic of TrimListener into …
webmozart Jun 22, 2015
9f86195
feature #14991 [Console][Table] allow multiple render() calls. (jaytaph)
fabpot Jun 22, 2015
dd7583d
feature #14429 [FrameworkBundle] Add a doctrine cache service definit…
fabpot Jun 23, 2015
f360758
[Debug] Allow throwing from __toString() with `return trigger_error($…
nicolas-grekas Jun 22, 2015
6c4a676
Add "shared" flag and deprecate scopes concept
dosten Jun 15, 2015
50e752b
feature #14984 [DependencyInjection] Deprecate scope concept (dosten)
fabpot Jun 24, 2015
b7030cc
Make service not shared when prototype scope is set
wouterj Jun 24, 2015
bd66434
minor #15091 [2.8] Make service not shared when prototype scope is se…
Tobion Jun 24, 2015
93e69e4
feature #15076 [Debug] Allow throwing from __toString() with `return …
nicolas-grekas Jun 25, 2015
d144dbb
[DependencyInjection] improve deprecation messages
xabbuh Jun 26, 2015
03e96d2
minor #15113 [2.8][DependencyInjection] improve deprecation messages …
fabpot Jun 27, 2015
1583fad
add option to force web server startup
xabbuh Jun 28, 2015
1df4ebe
added remove option to ignoreExtraKeys
Apr 6, 2015
674b124
feature #14238 [config] added remove option to ignoreExtraKeys (twifty)
fabpot Jun 28, 2015
268210b
fixed CS
fabpot Jun 28, 2015
ffed0ce
feature #15134 [FrameworkBundle] add option to force web server start…
fabpot Jun 30, 2015
96cce38
Warmup twig templates in non-standard paths (closes #12507)
kbond May 27, 2015
cad16ac
feature #14764 [TwigBundle] Warmup twig templates in non-standard pat…
fabpot Jun 30, 2015
cb9c069
[Validator] Added missing error codes and turned codes into UUIDs
webmozart Nov 3, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions UPGRADE-2.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,74 @@ Translator
$messages = array_replace_recursive($catalogue->all(), $messages);
}
```

DependencyInjection
-------------------

* The concept of scopes were deprecated, the deprecated methods are:

- `Symfony\Component\DependencyInjection\ContainerBuilder::getScopes()`
- `Symfony\Component\DependencyInjection\ContainerBuilder::getScopeChildren()`
- `Symfony\Component\DependencyInjection\ContainerInterface::enterScope()`
- `Symfony\Component\DependencyInjection\ContainerInterface::leaveScope()`
- `Symfony\Component\DependencyInjection\ContainerInterface::addScope()`
- `Symfony\Component\DependencyInjection\ContainerInterface::hasScope()`
- `Symfony\Component\DependencyInjection\ContainerInterface::isScopeActive()`
- `Symfony\Component\DependencyInjection\Definition::setScope()`
- `Symfony\Component\DependencyInjection\Definition::getScope()`
- `Symfony\Component\DependencyInjection\Reference::isStrict()`

Also, the `$scope` and `$strict` parameters of `Symfony\Component\DependencyInjection\ContainerInterface::set()` and `Symfony\Component\DependencyInjection\Reference` respectively were deprecated.

* A new `shared` flag has been added to the service definition
in replacement of the `prototype` scope.

Before:

```php
use Symfony\Component\DependencyInjection\ContainerBuilder;

$container = new ContainerBuilder();
$container
->register('foo', 'stdClass')
->setScope(ContainerBuilder::SCOPE_PROTOTYPE)
;
```

```yml
services:
foo:
class: stdClass
scope: prototype
```

```xml
<services>
<service id="foo" class="stdClass" scope="prototype" />
</services>
```

After:

```php
use Symfony\Component\DependencyInjection\ContainerBuilder;

$container = new ContainerBuilder();
$container
->register('foo', 'stdClass')
->setShared(false)
;
```

```yml
services:
foo:
class: stdClass
shared: false
```

```xml
<services>
<service id="foo" class="stdClass" shared="false" />
</services>
```
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ public function getProxyFactoryCode(Definition $definition, $id)
{
$instantiation = 'return';

if (ContainerInterface::SCOPE_CONTAINER === $definition->getScope()) {
if ($definition->isShared() && ContainerInterface::SCOPE_CONTAINER === $definition->getScope(false)) {
$instantiation .= " \$this->services['$id'] =";
} elseif (ContainerInterface::SCOPE_PROTOTYPE !== $scope = $definition->getScope()) {
} elseif ($definition->isShared() && ContainerInterface::SCOPE_PROTOTYPE !== $scope = $definition->getScope(false)) {
$instantiation .= " \$this->services['$id'] = \$this->scopedServices['$scope']['$id'] =";
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/ProxyManager/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"require": {
"php": ">=5.3.9",
"symfony/dependency-injection": "~2.3|~3.0.0",
"symfony/dependency-injection": "~2.8|~3.0.0",
"ocramius/proxy-manager": "~0.4|~1.0"
},
"require-dev": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ protected function configure()
new InputOption('port', 'p', InputOption::VALUE_REQUIRED, 'Address port number', '8000'),
new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root', null),
new InputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'),
new InputOption('force', 'f', InputOption::VALUE_NONE, 'Force web server startup'),
))
->setName('server:start')
->setDescription('Starts PHP built-in web server in the background')
Expand Down Expand Up @@ -110,8 +111,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
$address = $address.':'.$input->getOption('port');
}

if ($this->isOtherServerProcessRunning($address)) {
if (!$input->getOption('force') && $this->isOtherServerProcessRunning($address)) {
$output->writeln(sprintf('<error>A process is already listening on http://%s.</error>', $address));
$output->writeln(sprintf('<error>Use the --force option if the server process terminated unexpectedly to start a new web server process.</error>'));

return 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,16 @@ private function getContainerDefinitionData(Definition $definition, $omitTags =
{
$data = array(
'class' => (string) $definition->getClass(),
'scope' => $definition->getScope(),
'scope' => $definition->getScope(false),
'public' => $definition->isPublic(),
'synthetic' => $definition->isSynthetic(),
'lazy' => $definition->isLazy(),
);

if (method_exists($definition, 'isShared')) {
$data['shared'] = $definition->isShared();
}

if (method_exists($definition, 'isSynchronized')) {
$data['synchronized'] = $definition->isSynchronized(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,16 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
protected function describeContainerDefinition(Definition $definition, array $options = array())
{
$output = '- Class: `'.$definition->getClass().'`'
."\n".'- Scope: `'.$definition->getScope().'`'
."\n".'- Scope: `'.$definition->getScope(false).'`'
."\n".'- Public: '.($definition->isPublic() ? 'yes' : 'no')
."\n".'- Synthetic: '.($definition->isSynthetic() ? 'yes' : 'no')
."\n".'- Lazy: '.($definition->isLazy() ? 'yes' : 'no')
;

if (method_exists($definition, 'isShared')) {
$output .= "\n".'- Shared: '.($definition->isShared() ? 'yes' : 'no');
}

if (method_exists($definition, 'isSynchronized')) {
$output .= "\n".'- Synchronized: '.($definition->isSynchronized(false) ? 'yes' : 'no');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
$serviceIds = isset($options['tag']) && $options['tag'] ? array_keys($builder->findTaggedServiceIds($options['tag'])) : $builder->getServiceIds();
$maxTags = array();

foreach ($serviceIds as $key => $serviceId) {
foreach ($serviceIds as $key => $serviceId) {
$definition = $this->resolveServiceDefinition($builder, $serviceId);
if ($definition instanceof Definition) {
// filter out private services unless shown explicitly
Expand Down Expand Up @@ -261,10 +261,13 @@ protected function describeContainerDefinition(Definition $definition, array $op
$description[] = '<comment>Tags</comment> -';
}

$description[] = sprintf('<comment>Scope</comment> %s', $definition->getScope());
$description[] = sprintf('<comment>Scope</comment> %s', $definition->getScope(false));
$description[] = sprintf('<comment>Public</comment> %s', $definition->isPublic() ? 'yes' : 'no');
$description[] = sprintf('<comment>Synthetic</comment> %s', $definition->isSynthetic() ? 'yes' : 'no');
$description[] = sprintf('<comment>Lazy</comment> %s', $definition->isLazy() ? 'yes' : 'no');
if (method_exists($definition, 'isShared')) {
$description[] = sprintf('<comment>Shared</comment> %s', $definition->isShared() ? 'yes' : 'no');
}
if (method_exists($definition, 'isSynchronized')) {
$description[] = sprintf('<comment>Synchronized</comment> %s', $definition->isSynchronized(false) ? 'yes' : 'no');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,13 @@ private function getContainerDefinitionDocument(Definition $definition, $id = nu
}
}

$serviceXML->setAttribute('scope', $definition->getScope());
$serviceXML->setAttribute('scope', $definition->getScope(false));
$serviceXML->setAttribute('public', $definition->isPublic() ? 'true' : 'false');
$serviceXML->setAttribute('synthetic', $definition->isSynthetic() ? 'true' : 'false');
$serviceXML->setAttribute('lazy', $definition->isLazy() ? 'true' : 'false');
if (method_exists($definition, 'isShared')) {
$serviceXML->setAttribute('shared', $definition->isShared() ? 'true' : 'false');
}
if (method_exists($definition, 'isSynchronized')) {
$serviceXML->setAttribute('synchronized', $definition->isSynchronized(false) ? 'true' : 'false');
}
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Bundle/FrameworkBundle/Resources/config/test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
</parameters>

<services>
<service id="test.client" class="%test.client.class%" scope="prototype">
<service id="test.client" class="%test.client.class%" shared="false">
<argument type="service" id="kernel" />
<argument>%test.client.parameters%</argument>
<argument type="service" id="test.client.history" />
<argument type="service" id="test.client.cookiejar" />
</service>

<service id="test.client.history" class="%test.client.history.class%" scope="prototype" />
<service id="test.client.history" class="%test.client.history.class%" shared="false" />

<service id="test.client.cookiejar" class="%test.client.cookiejar.class%" scope="prototype" />
<service id="test.client.cookiejar" class="%test.client.cookiejar.class%" shared="false" />

<service id="test.session.listener" class="%test.session.listener.class%">
<argument type="service" id="service_container" />
Expand Down
10 changes: 10 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@
<argument>%validator.mapping.cache.prefix%</argument>
</service>

<service id="validator.mapping.cache.doctrine.apc" class="Symfony\Component\Validator\Mapping\Cache\DoctrineCache" public="false">
<argument type="service">
<service class="Doctrine\Common\Cache\ApcCache">
<call method="setNamespace">
<argument>%validator.mapping.cache.prefix%</argument>
</call>
</service>
</argument>
</service>

<service id="validator.validator_factory" class="%validator.validator_factory.class%" public="false">
<argument type="service" id="service_container" />
<argument type="collection" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"public": true,
"synthetic": false,
"lazy": true,
"shared": true,
"synchronized": false,
"abstract": true,
"file": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ definition_1
- Public: yes
- Synthetic: no
- Lazy: yes
- Shared: yes
- Synchronized: no
- Abstract: yes
- Factory Class: `Full\Qualified\FactoryClass`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<container>
<alias id="alias_1" service="service_1" public="true"/>
<alias id="alias_2" service="service_2" public="false"/>
<definition id="definition_1" class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" synchronized="false" abstract="true" file="">
<definition id="definition_1" class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" shared="true" synchronized="false" abstract="true" file="">
<factory class="Full\Qualified\FactoryClass" method="get"/>
</definition>
<service id="service_container" class="Symfony\Component\DependencyInjection\ContainerBuilder"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"public": true,
"synthetic": false,
"lazy": true,
"shared": true,
"synchronized": false,
"abstract": true,
"file": null,
Expand All @@ -21,6 +22,7 @@
"public": false,
"synthetic": true,
"lazy": false,
"shared": true,
"synchronized": false,
"abstract": false,
"file": "\/path\/to\/file",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ definition_1
- Public: yes
- Synthetic: no
- Lazy: yes
- Shared: yes
- Synchronized: no
- Abstract: yes
- Factory Class: `Full\Qualified\FactoryClass`
Expand All @@ -25,6 +26,7 @@ definition_2
- Public: no
- Synthetic: yes
- Lazy: no
- Shared: yes
- Synchronized: no
- Abstract: no
- File: `/path/to/file`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<container>
<alias id="alias_1" service="service_1" public="true"/>
<alias id="alias_2" service="service_2" public="false"/>
<definition id="definition_1" class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" synchronized="false" abstract="true" file="">
<definition id="definition_1" class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" shared="true" synchronized="false" abstract="true" file="">
<factory class="Full\Qualified\FactoryClass" method="get"/>
</definition>
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" synchronized="false" abstract="false" file="/path/to/file">
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" shared="true" synchronized="false" abstract="false" file="/path/to/file">
<factory service="factory.service" method="get"/>
<tags>
<tag name="tag1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"public": false,
"synthetic": true,
"lazy": false,
"shared": true,
"synchronized": false,
"abstract": false,
"file": "\/path\/to\/file",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ definition_2
- Public: no
- Synthetic: yes
- Lazy: no
- Shared: yes
- Synchronized: no
- Abstract: no
- File: `/path/to/file`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<container>
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" synchronized="false" abstract="false" file="/path/to/file">
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" shared="true" synchronized="false" abstract="false" file="/path/to/file">
<factory service="factory.service" method="get"/>
<tags>
<tag name="tag1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"public": false,
"synthetic": true,
"lazy": false,
"shared": true,
"synchronized": false,
"abstract": false,
"file": "\/path\/to\/file",
Expand All @@ -20,6 +21,7 @@
"public": false,
"synthetic": true,
"lazy": false,
"shared": true,
"synchronized": false,
"abstract": false,
"file": "\/path\/to\/file",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ definition_2
- Public: no
- Synthetic: yes
- Lazy: no
- Shared: yes
- Synchronized: no
- Abstract: no
- File: `/path/to/file`
Expand All @@ -30,6 +31,7 @@ definition_2
- Public: no
- Synthetic: yes
- Lazy: no
- Shared: yes
- Synchronized: no
- Abstract: no
- File: `/path/to/file`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<container>
<tag name="tag1">
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" synchronized="false" abstract="false" file="/path/to/file">
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" shared="true" synchronized="false" abstract="false" file="/path/to/file">
<factory service="factory.service" method="get"/>
</definition>
</tag>
<tag name="tag2">
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" synchronized="false" abstract="false" file="/path/to/file">
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" shared="true" synchronized="false" abstract="false" file="/path/to/file">
<factory service="factory.service" method="get"/>
</definition>
</tag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"public": true,
"synthetic": false,
"lazy": true,
"shared": true,
"synchronized": false,
"abstract": true,
"file": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Public: yes
- Synthetic: no
- Lazy: yes
- Shared: yes
- Synchronized: no
- Abstract: yes
- Factory Class: `Full\Qualified\FactoryClass`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<comment>Public</comment> yes
<comment>Synthetic</comment> no
<comment>Lazy</comment> yes
<comment>Shared</comment> yes
<comment>Synchronized</comment> no
<comment>Abstract</comment> yes
<comment>Factory Class</comment> Full\Qualified\FactoryClass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<definition class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" synchronized="false" abstract="true" file="">
<definition class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" shared="true" synchronized="false" abstract="true" file="">
<factory class="Full\Qualified\FactoryClass" method="get"/>
</definition>
Loading