Skip to content

Commit

Permalink
Merge branch '3.4' into 4.4
Browse files Browse the repository at this point in the history
* 3.4:
  Fix versions
  [Security/Http] Allow setting cookie security settings for delete_cookies
  [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
  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
  • Loading branch information
nicolas-grekas committed Mar 30, 2020
2 parents 3960c9c + 5d4d018 commit 2bf1de9
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Resources/translations/validators.ar.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,14 @@
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<target>يجب أن يكون عدد العناصر في هذه المجموعة مضاعف {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>يجب أن تستوفي هذه القيمة واحدة من القيود التالية:</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<target>يجب أن يفي كل عنصر من عناصر هذه المجموعة بمجموعة القيود الخاصة به.</target>
</trans-unit>
</body>
</file>
</xliff>
8 changes: 8 additions & 0 deletions Resources/translations/validators.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,14 @@
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<target>Die Anzahl an Elementen in dieser Sammlung sollte ein Vielfaches von {{ compared_value }} sein.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Dieser Wert sollte eine der folgenden Bedingungen erfüllen:</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<target>Jedes Element dieser Sammlung sollte seine eigene Menge an Bedingungen erfüllen.</target>
</trans-unit>
</body>
</file>
</xliff>
8 changes: 8 additions & 0 deletions Resources/translations/validators.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,14 @@
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<target>Le nombre d'éléments de cette collection doit être un multiple de {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Cette valeur doit satisfaire à au moins une des contraintes suivantes :</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<target>Chaque élément de cette collection doit satisfaire à son propre jeu de contraintes.</target>
</trans-unit>
</body>
</file>
</xliff>
16 changes: 16 additions & 0 deletions Resources/translations/validators.hu.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,22 @@
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Ennek az értéknek {{ min }} és {{ max }} között kell lennie.</target>
</trans-unit>
<trans-unit id="95">
<source>This value is not a valid hostname.</source>
<target>Ez az érték nem egy érvényes állomásnév (hosztnév).</target>
</trans-unit>
<trans-unit id="96">
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<target>A gyűjteményben lévő elemek számának oszthatónak kell lennie a következővel: {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Ennek az értéknek meg kell felelni legalább egynek a következő feltételek közül:</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<target>A gyűjtemény minden elemének meg kell felelni a saját feltételeinek.</target>
</trans-unit>
</body>
</file>
</xliff>
16 changes: 16 additions & 0 deletions Resources/translations/validators.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,22 @@
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Questo valore dovrebbe essere compreso tra {{ min }} e {{ max }}.</target>
</trans-unit>
<trans-unit id="95">
<source>This value is not a valid hostname.</source>
<target>Questo valore non è un nome di host valido.</target>
</trans-unit>
<trans-unit id="96">
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<target>Il numero di elementi in questa collezione dovrebbe essere un multiplo di {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Questo valore dovrebbe soddisfare almeno uno dei vincoli seguenti:</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<target>Ciascun elemento di questa collezione dovrebbe soddisfare il suo insieme di vincoli.</target>
</trans-unit>
</body>
</file>
</xliff>
16 changes: 16 additions & 0 deletions Resources/translations/validators.lt.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,22 @@
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>Ši reikšmė turi būti tarp {{ min }} ir {{ max }}.</target>
</trans-unit>
<trans-unit id="95">
<source>This value is not a valid hostname.</source>
<target>Ši reikšmė nėra tinkamas svetainės adresas.</target>
</trans-unit>
<trans-unit id="96">
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<target>Šio sąrašo elementų skaičius turėtų būti skaičiaus {{ compared_value }} kartotinis.</target>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<target>Ši reikšmė turėtų atitikti bent vieną iš šių nurodymų:</target>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<target>Kiekvienas šio sąrašo elementas turi atitikti savo nurodymų rinkinį.</target>
</trans-unit>
</body>
</file>
</xliff>
8 changes: 8 additions & 0 deletions Resources/translations/validators.vi.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,14 @@
<source>The number of elements in this collection should be a multiple of {{ compared_value }}.</source>
<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>
</trans-unit>
<trans-unit id="97">
<source>This value should satisfy at least one of the following constraints:</source>
<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>
</trans-unit>
<trans-unit id="98">
<source>Each element of this collection should satisfy its own set of constraints.</source>
<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>
</trans-unit>
</body>
</file>
</xliff>
21 changes: 21 additions & 0 deletions Tests/Validator/AbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,4 +698,25 @@ public function testNestedObjectIsValidatedIfGroupInValidConstraintIsValidated()

$this->assertCount(2, $violations);
}

public function testNestedObjectIsValidatedInMultipleGroupsIfGroupInValidConstraintIsValidated()
{
$entity = new Entity();
$entity->firstName = null;

$reference = new Reference();
$reference->value = null;

$entity->childA = $reference;

$this->metadata->addPropertyConstraint('firstName', new NotBlank());
$this->metadata->addPropertyConstraint('childA', new Valid(['groups' => ['group1', 'group2']]));

$this->referenceMetadata->addPropertyConstraint('value', new NotBlank(['groups' => 'group1']));
$this->referenceMetadata->addPropertyConstraint('value', new NotNull(['groups' => 'group2']));

$violations = $this->validator->validate($entity, null, ['Default', 'group1', 'group2']);

$this->assertCount(3, $violations);
}
}
6 changes: 4 additions & 2 deletions Validator/RecursiveContextualValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Composite;
use Symfony\Component\Validator\Constraints\GroupSequence;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\ConstraintValidatorFactoryInterface;
use Symfony\Component\Validator\Context\ExecutionContext;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
Expand Down Expand Up @@ -720,8 +721,9 @@ private function validateInGroup($value, ?string $cacheKey, MetadataInterface $m
// that constraints belong to multiple validated groups
if (null !== $cacheKey) {
$constraintHash = spl_object_hash($constraint);

if ($constraint instanceof Composite) {
// instanceof Valid: In case of using a Valid constraint with many groups
// it makes a reference object get validated by each group
if ($constraint instanceof Composite || $constraint instanceof Valid) {
$constraintHash .= $group;
}

Expand Down

0 comments on commit 2bf1de9

Please sign in to comment.