Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 519ba3c

Browse filesBrowse files
committed
Merge remote-tracking branch 'origin/4.3'
* origin/4.3: deprecate calling createChildContext without the format parameter [EventDispatcher] Fix interface name used in error messages [FrameworkBundle] Add cache configuration for PropertyInfo Update dependencies in the main component Drop useless executable bit [Doctrine][PropertyInfo] Detect if the ID is writeable Add transport in subscriber's phpdoc [Validator] Autovalidation: skip readonly props [DI] default to service id - *not* FQCN - when building tagged locators [Cache] Log a more readable error message when saving into cache fails Update WorkflowEvents.php [Messenger] On failure retry, make message appear received from original sender [Messenger] remove send_and_handle option which can be achieved with SyncTransport Fixing tests - passing pdo is not wrapped for some reason in dbal Changing how RoutableMessageBus fallback bus works [Serializer] Fix BC break: DEPTH_KEY_PATTERN must be public [FrameworkBundle] Fixed issue when a parameter container a '%' Fix the interface incompatibility of EventDispatchers [TwigBundle] fixed Mailer integration in Twig [Form] Add intl/choice_translation_locale option to TimezoneType
2 parents b563fe6 + c5772ae commit 519ba3c
Copy full SHA for 519ba3c

File tree

61 files changed

+886
-302
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

61 files changed

+886
-302
lines changed

‎composer.json

Copy file name to clipboardExpand all lines: composer.json
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"require": {
1919
"php": "^7.1.3",
2020
"ext-xml": "*",
21-
"doctrine/collections": "~1.0",
2221
"doctrine/event-manager": "~1.0",
2322
"doctrine/persistence": "~1.0",
2423
"fig/link-util": "^1.0",
@@ -27,7 +26,6 @@
2726
"psr/container": "^1.0",
2827
"psr/link": "^1.0",
2928
"psr/log": "~1.0",
30-
"psr/simple-cache": "^1.0",
3129
"symfony/contracts": "^1.1",
3230
"symfony/polyfill-ctype": "~1.8",
3331
"symfony/polyfill-intl-icu": "~1.0",
@@ -38,6 +36,7 @@
3836
},
3937
"replace": {
4038
"symfony/asset": "self.version",
39+
"symfony/amazon-mailer": "self.version",
4140
"symfony/browser-kit": "self.version",
4241
"symfony/cache": "self.version",
4342
"symfony/config": "self.version",
@@ -55,17 +54,22 @@
5554
"symfony/finder": "self.version",
5655
"symfony/form": "self.version",
5756
"symfony/framework-bundle": "self.version",
57+
"symfony/google-mailer": "self.version",
5858
"symfony/http-client": "self.version",
5959
"symfony/http-foundation": "self.version",
6060
"symfony/http-kernel": "self.version",
6161
"symfony/inflector": "self.version",
6262
"symfony/intl": "self.version",
6363
"symfony/ldap": "self.version",
6464
"symfony/lock": "self.version",
65+
"symfony/mailchimp-mailer": "self.version",
66+
"symfony/mailer": "self.version",
67+
"symfony/mailgun-mailer": "self.version",
6568
"symfony/messenger": "self.version",
6669
"symfony/mime": "self.version",
6770
"symfony/monolog-bridge": "self.version",
6871
"symfony/options-resolver": "self.version",
72+
"symfony/postmark-mailer": "self.version",
6973
"symfony/process": "self.version",
7074
"symfony/property-access": "self.version",
7175
"symfony/property-info": "self.version",
@@ -77,6 +81,7 @@
7781
"symfony/security-guard": "self.version",
7882
"symfony/security-http": "self.version",
7983
"symfony/security-bundle": "self.version",
84+
"symfony/sendgrid-mailer": "self.version",
8085
"symfony/serializer": "self.version",
8186
"symfony/stopwatch": "self.version",
8287
"symfony/templating": "self.version",
@@ -96,6 +101,7 @@
96101
"cache/integration-tests": "dev-master",
97102
"doctrine/annotations": "~1.0",
98103
"doctrine/cache": "~1.6",
104+
"doctrine/collections": "~1.0",
99105
"doctrine/data-fixtures": "1.0.*",
100106
"doctrine/dbal": "~2.4",
101107
"doctrine/orm": "~2.4,>=2.4.5",
@@ -107,6 +113,7 @@
107113
"ocramius/proxy-manager": "~0.4|~1.0|~2.0",
108114
"predis/predis": "~1.1",
109115
"psr/http-client": "^1.0",
116+
"psr/simple-cache": "^1.0",
110117
"egulias/email-validator": "~1.2,>=1.2.8|~2.0",
111118
"symfony/phpunit-bridge": "~3.4|~4.0",
112119
"symfony/security-acl": "~2.8|~3.0",

‎src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
+40-13Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
use Doctrine\Common\Persistence\Mapping\MappingException;
1616
use Doctrine\DBAL\Types\Type as DBALType;
1717
use Doctrine\ORM\EntityManagerInterface;
18+
use Doctrine\ORM\Mapping\ClassMetadata;
1819
use Doctrine\ORM\Mapping\ClassMetadataInfo;
1920
use Doctrine\ORM\Mapping\MappingException as OrmMappingException;
21+
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
2022
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
2123
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
2224
use Symfony\Component\PropertyInfo\Type;
@@ -26,7 +28,7 @@
2628
*
2729
* @author Kévin Dunglas <dunglas@gmail.com>
2830
*/
29-
class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeExtractorInterface
31+
class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeExtractorInterface, PropertyAccessExtractorInterface
3032
{
3133
private $entityManager;
3234
private $classMetadataFactory;
@@ -51,12 +53,8 @@ public function __construct($entityManager)
5153
*/
5254
public function getProperties($class, array $context = [])
5355
{
54-
try {
55-
$metadata = $this->entityManager ? $this->entityManager->getClassMetadata($class) : $this->classMetadataFactory->getMetadataFor($class);
56-
} catch (MappingException $exception) {
57-
return;
58-
} catch (OrmMappingException $exception) {
59-
return;
56+
if (null === $metadata = $this->getMetadata($class)) {
57+
return null;
6058
}
6159

6260
$properties = array_merge($metadata->getFieldNames(), $metadata->getAssociationNames());
@@ -77,12 +75,8 @@ public function getProperties($class, array $context = [])
7775
*/
7876
public function getTypes($class, $property, array $context = [])
7977
{
80-
try {
81-
$metadata = $this->entityManager ? $this->entityManager->getClassMetadata($class) : $this->classMetadataFactory->getMetadataFor($class);
82-
} catch (MappingException $exception) {
83-
return;
84-
} catch (OrmMappingException $exception) {
85-
return;
78+
if (null === $metadata = $this->getMetadata($class)) {
79+
return null;
8680
}
8781

8882
if ($metadata->hasAssociation($property)) {
@@ -176,6 +170,39 @@ public function getTypes($class, $property, array $context = [])
176170
}
177171
}
178172

173+
/**
174+
* {@inheritdoc}
175+
*/
176+
public function isReadable($class, $property, array $context = [])
177+
{
178+
return null;
179+
}
180+
181+
/**
182+
* {@inheritdoc}
183+
*/
184+
public function isWritable($class, $property, array $context = [])
185+
{
186+
if (
187+
null === ($metadata = $this->getMetadata($class))
188+
|| ClassMetadata::GENERATOR_TYPE_NONE === $metadata->generatorType
189+
|| !\in_array($property, $metadata->getIdentifierFieldNames(), true)
190+
) {
191+
return null;
192+
}
193+
194+
return false;
195+
}
196+
197+
private function getMetadata(string $class): ?ClassMetadata
198+
{
199+
try {
200+
return $this->entityManager ? $this->entityManager->getClassMetadata($class) : $this->classMetadataFactory->getMetadataFor($class);
201+
} catch (MappingException | OrmMappingException $exception) {
202+
return null;
203+
}
204+
}
205+
179206
/**
180207
* Determines whether an association is nullable.
181208
*

‎src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Doctrine\ORM\Tools\Setup;
1717
use PHPUnit\Framework\TestCase;
1818
use Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor;
19+
use Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineGeneratedValue;
1920
use Symfony\Component\PropertyInfo\Type;
2021

2122
/**
@@ -223,4 +224,13 @@ private function doTestGetTypesCatchException(bool $legacy)
223224
{
224225
$this->assertNull($this->createExtractor($legacy)->getTypes('Not\Exist', 'baz'));
225226
}
227+
228+
public function testGeneratedValueNotWritable()
229+
{
230+
$extractor = $this->createExtractor();
231+
$this->assertFalse($extractor->isWritable(DoctrineGeneratedValue::class, 'id'));
232+
$this->assertNull($extractor->isReadable(DoctrineGeneratedValue::class, 'id'));
233+
$this->assertNull($extractor->isWritable(DoctrineGeneratedValue::class, 'foo'));
234+
$this->assertNull($extractor->isReadable(DoctrineGeneratedValue::class, 'foo'));
235+
}
226236
}
+37Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures;
13+
14+
use Doctrine\ORM\Mapping\Column;
15+
use Doctrine\ORM\Mapping\Entity;
16+
use Doctrine\ORM\Mapping\GeneratedValue;
17+
use Doctrine\ORM\Mapping\Id;
18+
19+
/**
20+
* @author Kévin Dunglas <dunglas@gmail.com>
21+
*
22+
* @Entity
23+
*/
24+
class DoctrineGeneratedValue
25+
{
26+
/**
27+
* @Id
28+
* @GeneratedValue(strategy="AUTO")
29+
* @Column(type="integer")
30+
*/
31+
public $id;
32+
33+
/**
34+
* @Column
35+
*/
36+
public $foo;
37+
}

‎src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ CHANGELOG
2222
`framework.messenger.default_serializer`, which holds the string service
2323
id and `framework.messenger.symfony_serializer`, which configures the
2424
options if you're using Symfony's serializer.
25+
* [BC Break] Removed the `framework.messenger.routing.send_and_handle` configuration.
26+
Instead of setting it to true, configure a `SyncTransport` and route messages to it.
2527
* Added information about deprecated aliases in `debug:autowiring`
2628
* Added php ini session options `sid_length` and `sid_bits_per_character`
2729
to the `session` section of the configuration

‎src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,12 @@ protected function getContainerBuilder()
224224
if (!$kernel->isDebug() || !(new ConfigCache($kernel->getContainer()->getParameter('debug.container.dump'), true))->isFresh()) {
225225
$buildContainer = \Closure::bind(function () { return $this->buildContainer(); }, $kernel, \get_class($kernel));
226226
$container = $buildContainer();
227+
$container->getCompilerPassConfig()->setRemovingPasses([]);
228+
$container->compile();
227229
} else {
228230
(new XmlFileLoader($container = new ContainerBuilder(), new FileLocator()))->load($kernel->getContainer()->getParameter('debug.container.dump'));
229-
$container->setParameter('container.build_hash', $hash = ContainerBuilder::hash(__METHOD__));
230-
$container->setParameter('container.build_id', hash('crc32', $hash.time()));
231231
}
232232

233-
$container->getCompilerPassConfig()->setRemovingPasses([]);
234-
$container->compile();
235-
236233
return $this->containerBuilder = $container;
237234
}
238235

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
+23-3Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,21 +322,41 @@ public static function getClassDescription(string $class, string &$resolvedClass
322322

323323
private function getContainerEnvVars(ContainerBuilder $container): array
324324
{
325+
if (!$container->hasParameter('debug.container.dump')) {
326+
return [];
327+
}
328+
329+
if (!is_file($container->getParameter('debug.container.dump'))) {
330+
return [];
331+
}
332+
333+
$file = file_get_contents($container->getParameter('debug.container.dump'));
334+
preg_match_all('{%env\(((?:\w++:)*+\w++)\)%}', $file, $envVars);
335+
$envVars = array_unique($envVars[1]);
336+
337+
$bag = $container->getParameterBag();
338+
$getDefaultParameter = function (string $name) {
339+
return parent::get($name);
340+
};
341+
$getDefaultParameter = $getDefaultParameter->bindTo($bag, \get_class($bag));
342+
325343
$getEnvReflection = new \ReflectionMethod($container, 'getEnv');
326344
$getEnvReflection->setAccessible(true);
345+
327346
$envs = [];
328-
foreach (array_keys($container->getEnvCounters()) as $env) {
347+
348+
foreach ($envVars as $env) {
329349
$processor = 'string';
330350
if (false !== $i = strrpos($name = $env, ':')) {
331351
$name = substr($env, $i + 1);
332352
$processor = substr($env, 0, $i);
333353
}
334-
$defaultValue = ($hasDefault = $container->hasParameter("env($name)")) ? $container->getParameter("env($name)") : null;
354+
$defaultValue = ($hasDefault = $container->hasParameter("env($name)")) ? $getDefaultParameter("env($name)") : null;
335355
if (false === ($runtimeValue = $_ENV[$name] ?? $_SERVER[$name] ?? getenv($name))) {
336356
$runtimeValue = null;
337357
}
338358
$processedValue = ($hasRuntime = null !== $runtimeValue) || $hasDefault ? $getEnvReflection->invoke($container, $env) : null;
339-
$envs[$name.$processor] = [
359+
$envs["$name$processor"] = [
340360
'name' => $name,
341361
'processor' => $processor,
342362
'default_available' => $hasDefault,

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,6 @@ private function addMessengerSection(ArrayNodeDefinition $rootNode)
11251125
if (!\is_int($k)) {
11261126
$newConfig[$k] = [
11271127
'senders' => $v['senders'] ?? (\is_array($v) ? array_values($v) : [$v]),
1128-
'send_and_handle' => $v['send_and_handle'] ?? false,
11291128
];
11301129
} else {
11311130
$newConfig[$v['message-class']]['senders'] = array_map(
@@ -1134,7 +1133,6 @@ function ($a) {
11341133
},
11351134
array_values($v['sender'])
11361135
);
1137-
$newConfig[$v['message-class']]['send-and-handle'] = $v['send-and-handle'] ?? false;
11381136
}
11391137
}
11401138

@@ -1147,7 +1145,6 @@ function ($a) {
11471145
->requiresAtLeastOneElement()
11481146
->prototype('scalar')->end()
11491147
->end()
1150-
->booleanNode('send_and_handle')->defaultFalse()->end()
11511148
->end()
11521149
->end()
11531150
->end()

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+7-16Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
use Symfony\Component\Serializer\Encoder\DecoderInterface;
100100
use Symfony\Component\Serializer\Encoder\EncoderInterface;
101101
use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata;
102-
use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory;
103102
use Symfony\Component\Serializer\Normalizer\ConstraintViolationListNormalizer;
104103
use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer;
105104
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
@@ -1505,18 +1504,8 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
15051504
$chainLoader->replaceArgument(0, $serializerLoaders);
15061505
$container->getDefinition('serializer.mapping.cache_warmer')->replaceArgument(0, $serializerLoaders);
15071506

1508-
if (!$container->getParameter('kernel.debug')) {
1509-
$cacheMetadataFactory = new Definition(
1510-
CacheClassMetadataFactory::class,
1511-
[
1512-
new Reference('serializer.mapping.cache_class_metadata_factory.inner'),
1513-
new Reference('serializer.mapping.cache.symfony'),
1514-
]
1515-
);
1516-
$cacheMetadataFactory->setPublic(false);
1517-
$cacheMetadataFactory->setDecoratedService('serializer.mapping.class_metadata_factory');
1518-
1519-
$container->setDefinition('serializer.mapping.cache_class_metadata_factory', $cacheMetadataFactory);
1507+
if ($container->getParameter('kernel.debug')) {
1508+
$container->removeDefinition('serializer.mapping.cache_class_metadata_factory');
15201509
}
15211510

15221511
if (isset($config['name_converter']) && $config['name_converter']) {
@@ -1551,6 +1540,10 @@ private function registerPropertyInfoConfiguration(ContainerBuilder $container,
15511540
$definition->addTag('property_info.description_extractor', ['priority' => -1000]);
15521541
$definition->addTag('property_info.type_extractor', ['priority' => -1001]);
15531542
}
1543+
1544+
if ($container->getParameter('kernel.debug')) {
1545+
$container->removeDefinition('property_info.cache');
1546+
}
15541547
}
15551548

15561549
private function registerLockConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
@@ -1659,6 +1652,7 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
16591652
'before' => [
16601653
['id' => 'add_bus_name_stamp_middleware'],
16611654
['id' => 'dispatch_after_current_bus'],
1655+
['id' => 'failed_message_processing_middleware'],
16621656
],
16631657
'after' => [
16641658
['id' => 'send_message'],
@@ -1744,7 +1738,6 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
17441738
}
17451739

17461740
$messageToSendersMapping = [];
1747-
$messagesToSendAndHandle = [];
17481741
foreach ($config['routing'] as $message => $messageConfiguration) {
17491742
if ('*' !== $message && !class_exists($message) && !interface_exists($message, false)) {
17501743
throw new LogicException(sprintf('Invalid Messenger routing configuration: class or interface "%s" not found.', $message));
@@ -1758,7 +1751,6 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
17581751
}
17591752

17601753
$messageToSendersMapping[$message] = $messageConfiguration['senders'];
1761-
$messagesToSendAndHandle[$message] = $messageConfiguration['send_and_handle'];
17621754
}
17631755

17641756
$senderReferences = [];
@@ -1769,7 +1761,6 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
17691761
$container->getDefinition('messenger.senders_locator')
17701762
->replaceArgument(0, $messageToSendersMapping)
17711763
->replaceArgument(1, ServiceLocatorTagPass::register($container, $senderReferences))
1772-
->replaceArgument(2, $messagesToSendAndHandle)
17731764
;
17741765

17751766
$container->getDefinition('messenger.retry_strategy_locator')

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
<tag name="cache.pool" />
3737
</service>
3838

39+
<service id="cache.property_info" parent="cache.system" public="false">
40+
<tag name="cache.pool" />
41+
</service>
42+
3943
<service id="cache.messenger.restart_workers_signal" parent="cache.app" public="false">
4044
<tag name="cache.pool" />
4145
</service>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.