Skip to content

Commit fc459a3

Browse files
Merge branch '4.4' into 5.0
* 4.4: Fix versions [Security/Http] Allow setting cookie security settings for delete_cookies [DI] fix generating TypedReference from PriorityTaggedServiceTrait [FrameworkBundle] revert to legacy wiring of the session when circular refs are detected bumped Symfony version to 3.4.40 updated VERSION for 3.4.39 update CONTRIBUTORS for 3.4.39 updated CHANGELOG for 3.4.39 [DomCrawler] Fix BC break in assertions breaking Panther [BrowserKit] fixed missing post request parameters in file uploads update Italian translation [Validator] Add missing Hungarian translations [Validator] Add the missing translations for the Arabic (ar) locale [Validator] Add missing vietnamese translations [Console] Fix OutputStream for PHP 7.4 add German translations bug #36157 [Validator] Assert Valid with many groups [Validator] Add missing Lithuanian translations Fixed some typos Add french "at least" constraint translations
2 parents b6a7fde + 2bf1de9 commit fc459a3

9 files changed

+105
-2
lines changed

Resources/translations/validators.ar.xlf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,14 @@
374374
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
375375
<target>يجب أن يكون عدد العناصر في هذه المجموعة مضاعف {{ compared_value }}.</target>
376376
</trans-unit>
377+
<trans-unit id="97">
378+
<source>This value should satisfy at least one of the following constraints:</source>
379+
<target>يجب أن تستوفي هذه القيمة واحدة من القيود التالية:</target>
380+
</trans-unit>
381+
<trans-unit id="98">
382+
<source>Each element of this collection should satisfy its own set of constraints.</source>
383+
<target>يجب أن يفي كل عنصر من عناصر هذه المجموعة بمجموعة القيود الخاصة به.</target>
384+
</trans-unit>
377385
</body>
378386
</file>
379387
</xliff>

Resources/translations/validators.de.xlf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,14 @@
374374
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
375375
<target>Die Anzahl an Elementen in dieser Sammlung sollte ein Vielfaches von {{ compared_value }} sein.</target>
376376
</trans-unit>
377+
<trans-unit id="97">
378+
<source>This value should satisfy at least one of the following constraints:</source>
379+
<target>Dieser Wert sollte eine der folgenden Bedingungen erfüllen:</target>
380+
</trans-unit>
381+
<trans-unit id="98">
382+
<source>Each element of this collection should satisfy its own set of constraints.</source>
383+
<target>Jedes Element dieser Sammlung sollte seine eigene Menge an Bedingungen erfüllen.</target>
384+
</trans-unit>
377385
</body>
378386
</file>
379387
</xliff>

Resources/translations/validators.fr.xlf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,14 @@
374374
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
375375
<target>Le nombre d'éléments de cette collection doit être un multiple de {{ compared_value }}.</target>
376376
</trans-unit>
377+
<trans-unit id="97">
378+
<source>This value should satisfy at least one of the following constraints:</source>
379+
<target>Cette valeur doit satisfaire à au moins une des contraintes suivantes :</target>
380+
</trans-unit>
381+
<trans-unit id="98">
382+
<source>Each element of this collection should satisfy its own set of constraints.</source>
383+
<target>Chaque élément de cette collection doit satisfaire à son propre jeu de contraintes.</target>
384+
</trans-unit>
377385
</body>
378386
</file>
379387
</xliff>

Resources/translations/validators.hu.xlf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,22 @@
366366
<source>This value should be between {{ min }} and {{ max }}.</source>
367367
<target>Ennek az értéknek {{ min }} és {{ max }} között kell lennie.</target>
368368
</trans-unit>
369+
<trans-unit id="95">
370+
<source>This value is not a valid hostname.</source>
371+
<target>Ez az érték nem egy érvényes állomásnév (hosztnév).</target>
372+
</trans-unit>
373+
<trans-unit id="96">
374+
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
375+
<target>A gyűjteményben lévő elemek számának oszthatónak kell lennie a következővel: {{ compared_value }}.</target>
376+
</trans-unit>
377+
<trans-unit id="97">
378+
<source>This value should satisfy at least one of the following constraints:</source>
379+
<target>Ennek az értéknek meg kell felelni legalább egynek a következő feltételek közül:</target>
380+
</trans-unit>
381+
<trans-unit id="98">
382+
<source>Each element of this collection should satisfy its own set of constraints.</source>
383+
<target>A gyűjtemény minden elemének meg kell felelni a saját feltételeinek.</target>
384+
</trans-unit>
369385
</body>
370386
</file>
371387
</xliff>

Resources/translations/validators.it.xlf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,22 @@
366366
<source>This value should be between {{ min }} and {{ max }}.</source>
367367
<target>Questo valore dovrebbe essere compreso tra {{ min }} e {{ max }}.</target>
368368
</trans-unit>
369+
<trans-unit id="95">
370+
<source>This value is not a valid hostname.</source>
371+
<target>Questo valore non è un nome di host valido.</target>
372+
</trans-unit>
373+
<trans-unit id="96">
374+
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
375+
<target>Il numero di elementi in questa collezione dovrebbe essere un multiplo di {{ compared_value }}.</target>
376+
</trans-unit>
377+
<trans-unit id="97">
378+
<source>This value should satisfy at least one of the following constraints:</source>
379+
<target>Questo valore dovrebbe soddisfare almeno uno dei vincoli seguenti:</target>
380+
</trans-unit>
381+
<trans-unit id="98">
382+
<source>Each element of this collection should satisfy its own set of constraints.</source>
383+
<target>Ciascun elemento di questa collezione dovrebbe soddisfare il suo insieme di vincoli.</target>
384+
</trans-unit>
369385
</body>
370386
</file>
371387
</xliff>

Resources/translations/validators.lt.xlf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,22 @@
366366
<source>This value should be between {{ min }} and {{ max }}.</source>
367367
<target>Ši reikšmė turi būti tarp {{ min }} ir {{ max }}.</target>
368368
</trans-unit>
369+
<trans-unit id="95">
370+
<source>This value is not a valid hostname.</source>
371+
<target>Ši reikšmė nėra tinkamas svetainės adresas.</target>
372+
</trans-unit>
373+
<trans-unit id="96">
374+
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
375+
<target>Šio sąrašo elementų skaičius turėtų būti skaičiaus {{ compared_value }} kartotinis.</target>
376+
</trans-unit>
377+
<trans-unit id="97">
378+
<source>This value should satisfy at least one of the following constraints:</source>
379+
<target>Ši reikšmė turėtų atitikti bent vieną iš šių nurodymų:</target>
380+
</trans-unit>
381+
<trans-unit id="98">
382+
<source>Each element of this collection should satisfy its own set of constraints.</source>
383+
<target>Kiekvienas šio sąrašo elementas turi atitikti savo nurodymų rinkinį.</target>
384+
</trans-unit>
369385
</body>
370386
</file>
371387
</xliff>

Resources/translations/validators.vi.xlf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,14 @@
374374
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
375375
<target>Số lượng các phần tử trong bộ sưu tập này nên là bội số của {{ compared_value }}.</target>
376376
</trans-unit>
377+
<trans-unit id="97">
378+
<source>This value should satisfy at least one of the following constraints:</source>
379+
<target>Giá trị này nên thỏa mãn ít nhất một trong những ràng buộc sau:</target>
380+
</trans-unit>
381+
<trans-unit id="98">
382+
<source>Each element of this collection should satisfy its own set of constraints.</source>
383+
<target>Mỗi phần tử trong bộ sưu tập này nên thỏa mãn những ràng buộc của nó.</target>
384+
</trans-unit>
377385
</body>
378386
</file>
379387
</xliff>

Tests/Validator/AbstractTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,4 +698,25 @@ public function testNestedObjectIsValidatedIfGroupInValidConstraintIsValidated()
698698

699699
$this->assertCount(2, $violations);
700700
}
701+
702+
public function testNestedObjectIsValidatedInMultipleGroupsIfGroupInValidConstraintIsValidated()
703+
{
704+
$entity = new Entity();
705+
$entity->firstName = null;
706+
707+
$reference = new Reference();
708+
$reference->value = null;
709+
710+
$entity->childA = $reference;
711+
712+
$this->metadata->addPropertyConstraint('firstName', new NotBlank());
713+
$this->metadata->addPropertyConstraint('childA', new Valid(['groups' => ['group1', 'group2']]));
714+
715+
$this->referenceMetadata->addPropertyConstraint('value', new NotBlank(['groups' => 'group1']));
716+
$this->referenceMetadata->addPropertyConstraint('value', new NotNull(['groups' => 'group2']));
717+
718+
$violations = $this->validator->validate($entity, null, ['Default', 'group1', 'group2']);
719+
720+
$this->assertCount(3, $violations);
721+
}
701722
}

Validator/RecursiveContextualValidator.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Validator\Constraint;
1515
use Symfony\Component\Validator\Constraints\Composite;
1616
use Symfony\Component\Validator\Constraints\GroupSequence;
17+
use Symfony\Component\Validator\Constraints\Valid;
1718
use Symfony\Component\Validator\ConstraintValidatorFactoryInterface;
1819
use Symfony\Component\Validator\Context\ExecutionContext;
1920
use Symfony\Component\Validator\Context\ExecutionContextInterface;
@@ -710,8 +711,9 @@ private function validateInGroup($value, ?string $cacheKey, MetadataInterface $m
710711
// that constraints belong to multiple validated groups
711712
if (null !== $cacheKey) {
712713
$constraintHash = spl_object_hash($constraint);
713-
714-
if ($constraint instanceof Composite) {
714+
// instanceof Valid: In case of using a Valid constraint with many groups
715+
// it makes a reference object get validated by each group
716+
if ($constraint instanceof Composite || $constraint instanceof Valid) {
715717
$constraintHash .= $group;
716718
}
717719

0 commit comments

Comments
 (0)