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 c702c47

Browse filesBrowse files
committed
Merge branch '5.1' into 5.2
* 5.1: [Security] Replace message data in JSON security error response [DI] Skip deprecated definitions in CheckTypeDeclarationsPass [Messenger][AmazonSqs] Fix auto-setup for fifo queue [DoctrineBridge] Take into account that indexBy="person_id" could be a db column name, for a referenced entity
2 parents 5ba4925 + f2c5f25 commit c702c47
Copy full SHA for c702c47

File tree

10 files changed

+73
-5
lines changed
Filter options

10 files changed

+73
-5
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ public function getTypes(string $class, string $property, array $context = [])
104104
/** @var ClassMetadataInfo $subMetadata */
105105
$indexProperty = $subMetadata->getSingleAssociationReferencedJoinColumnName($fieldName);
106106
$subMetadata = $this->entityManager ? $this->entityManager->getClassMetadata($associationMapping['targetEntity']) : $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
107-
$typeOfField = $subMetadata->getTypeOfField($indexProperty);
107+
108+
//Not a property, maybe a column name?
109+
if (null === ($typeOfField = $subMetadata->getTypeOfField($indexProperty))) {
110+
$fieldName = $subMetadata->getFieldForColumn($indexProperty);
111+
$typeOfField = $subMetadata->getTypeOfField($fieldName);
112+
}
108113
}
109114
}
110115

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public function testGetProperties()
7171
'indexedByDt',
7272
'indexedByCustomType',
7373
'indexedBuz',
74+
'dummyGeneratedValueList',
7475
]);
7576

7677
$this->assertEquals(
@@ -198,6 +199,14 @@ public function typesProvider()
198199
new Type(Type::BUILTIN_TYPE_STRING),
199200
new Type(Type::BUILTIN_TYPE_OBJECT, false, DoctrineRelation::class)
200201
)]],
202+
['dummyGeneratedValueList', [new Type(
203+
Type::BUILTIN_TYPE_OBJECT,
204+
false,
205+
'Doctrine\Common\Collections\Collection',
206+
true,
207+
new Type(Type::BUILTIN_TYPE_INT),
208+
new Type(Type::BUILTIN_TYPE_OBJECT, false, DoctrineRelation::class)
209+
)]],
201210
['json', null],
202211
];
203212

‎src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,9 @@ class DoctrineDummy
142142
* @Column(type="json", nullable=true)
143143
*/
144144
private $json;
145+
146+
/**
147+
* @OneToMany(targetEntity="DoctrineRelation", mappedBy="dummyRelation", indexBy="gen_value_col_id", orphanRemoval=true)
148+
*/
149+
protected $dummyGeneratedValueList;
145150
}

‎src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineGeneratedValue.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineGeneratedValue.php
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Doctrine\ORM\Mapping\Entity;
1616
use Doctrine\ORM\Mapping\GeneratedValue;
1717
use Doctrine\ORM\Mapping\Id;
18+
use Doctrine\ORM\Mapping\OneToMany;
1819

1920
/**
2021
* @author Kévin Dunglas <dunglas@gmail.com>
@@ -34,4 +35,15 @@ class DoctrineGeneratedValue
3435
* @Column
3536
*/
3637
public $foo;
38+
39+
/**
40+
* @var int
41+
* @Column(type="integer", name="gen_value_col_id")
42+
*/
43+
public $valueId;
44+
45+
/**
46+
* @OneToMany(targetEntity="DoctrineRelation", mappedBy="generatedValueRelation", indexBy="rguid_column", orphanRemoval=true)
47+
*/
48+
protected $relationList;
3749
}

‎src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineRelation.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineRelation.php
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Doctrine\ORM\Mapping\Entity;
1616
use Doctrine\ORM\Mapping\Id;
1717
use Doctrine\ORM\Mapping\ManyToOne;
18+
use Doctrine\ORM\Mapping\JoinColumn;
1819

1920
/**
2021
* @Entity
@@ -60,4 +61,15 @@ class DoctrineRelation
6061
* @ManyToOne(targetEntity="DoctrineDummy", inversedBy="indexedBuz")
6162
*/
6263
protected $buzField;
64+
65+
/**
66+
* @ManyToOne(targetEntity="DoctrineDummy", inversedBy="dummyGeneratedValueList")
67+
*/
68+
private $dummyRelation;
69+
70+
/**
71+
* @ManyToOne(targetEntity="DoctrineGeneratedValue", inversedBy="relationList")
72+
* @JoinColumn(name="gen_value_col_id", referencedColumnName="gen_value_col_id")
73+
*/
74+
private $generatedValueRelation;
6375
}

‎src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected function processValue($value, $isRoot = false)
8484
return $value;
8585
}
8686

87-
if (!$value instanceof Definition || $value->hasErrors()) {
87+
if (!$value instanceof Definition || $value->hasErrors() || $value->isDeprecated()) {
8888
return parent::processValue($value, $isRoot);
8989
}
9090

‎src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarMethodCall;
2525
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarOptionalArgument;
2626
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarOptionalArgumentNotNull;
27+
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\Deprecated;
2728
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\Foo;
2829
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\FooObject;
2930
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\UnionConstructor;
@@ -720,6 +721,19 @@ public function testProcessSkipSkippedIds()
720721
$this->addToAssertionCount(1);
721722
}
722723

724+
public function testProcessSkipsDeprecatedDefinitions()
725+
{
726+
$container = new ContainerBuilder();
727+
$container
728+
->register('foobar', Deprecated::class)
729+
->setDeprecated(true)
730+
;
731+
732+
(new CheckTypeDeclarationsPass(true))->process($container);
733+
734+
$this->addToAssertionCount(1);
735+
}
736+
723737
public function testProcessHandleClosureForCallable()
724738
{
725739
$closureDefinition = new Definition(\Closure::class);
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass;
4+
5+
trigger_deprecation('foo/bar', '1.2.3', 'Deprecated class.');
6+
7+
class Deprecated
8+
{
9+
}

‎src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/Connection.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/Connection.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,9 @@ public function setup(): void
270270
$parameters = ['QueueName' => $this->configuration['queue_name']];
271271

272272
if (self::isFifoQueue($this->configuration['queue_name'])) {
273-
$parameters['FifoQueue'] = true;
273+
$parameters['Attributes'] = [
274+
'FifoQueue' => 'true',
275+
];
274276
}
275277

276278
$this->client->createQueue($parameters);

‎src/Symfony/Component/Security/Http/Firewall/UsernamePasswordJsonAuthenticationListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Firewall/UsernamePasswordJsonAuthenticationListener.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,10 @@ private function onFailure(Request $request, AuthenticationException $failed): R
188188
}
189189

190190
if (!$this->failureHandler) {
191-
$errorMessage = $failed->getMessageKey();
192-
193191
if (null !== $this->translator) {
194192
$errorMessage = $this->translator->trans($failed->getMessageKey(), $failed->getMessageData(), 'security');
193+
} else {
194+
$errorMessage = strtr($failed->getMessageKey(), $failed->getMessageData());
195195
}
196196

197197
return new JsonResponse(['error' => $errorMessage], 401);

0 commit comments

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