8000 Better Dutch translation of some validator messages. by hvt · Pull Request #2 · symfony/validator · GitHub
[go: up one dir, main page]

Skip to content

Better Dutch translation of some validator messages. #2

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 10000
wants to merge 1 commit into from
Closed

Better Dutch translation of some validator messages. #2

wants to merge 1 commit into from

Conversation

hvt
Copy link
Contributor
@hvt hvt commented Jun 20, 2012

No description provided.

@fabpot
Copy link
Member
fabpot commented Jul 1, 2012

Can you open a PR on symfony/symfony as this repository is read-only? Thanks.

@fabpot fabpot closed this Jul 2, 2012
symfony-splitter pushed a commit that referenced this pull request Sep 4, 2018
This PR was merged into the 4.2-dev branch.

Discussion
----------

Mark ExceptionInterfaces throwable #2

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This has been reverted in beta of 4.1 because of lack of support in prophecy, which has been fixed since then (incl. release). Can be merged again.

References:
symfony/symfony#26702
symfony/symfony#27420
symfony/symfony#27419
phpspec/prophecy#412

ping @dunglas @ciaranmcnulty @dkarlovi @Wirone @teohhanhui @stof @nicolas-grekas @ondrejmirtes

Commits
-------

17c3675226 Mark ExceptionInterfaces throwable
symfony-splitter pushed a commit that referenced this pull request Mar 9, 2024
…ys (Brajk19)

This PR was squashed before being merged into the 6.4 branch.

Discussion
----------

[Validator] UniqueValidator - normalize before reducing keys

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

In symfony/symfony#42403 checking for uniqueness of certain collection keys was enabled. Method `UniqueValidator::reduceElementKeys` removes all keys which are not specified.
Problem is that this happens before normalization, which in my opinion is not great because that method accepts array argument and if i have some object (DTO), TypeError will be thrown.

Example:

```php
class ParentDTO
{
    /**
     * `@var` ChildDTO[]
     */
    #[Assert\Unique(
        normalizer: [ChildDTO::class, 'normalize']
        fields: 'id'
    )]
    public array $children;
}
```

```php
class ChildDTO
{
    public string $id;
    public string $name;

    public static function normalize(self $obj): array
    {
        return [
            'id' => $obj->id,
            'name' => $obj->name
        ];
    }
}
```

Because normalization will happen after `reduceElementKeys` this will be thrown:
`TypeError: Symfony\Component\Validator\Constraints\UniqueValidator::reduceElementKeys(): Argument #2 ($element) must be of type array, ...\ChildDTO given, called in .../UniqueValidator.php on line 48`

If `$element = $normalizer($element);` is executed before `reduceElementKeys` it would enable using Assert\Unique with array of objects when correctly normalized

Commits
-------

77df90b959 [Validator] UniqueValidator - normalize before reducing keys
symfony-splitter pushed a commit that referenced this pull request Oct 11, 2024
* 7.1:
  do not mix named and positional arguments in data provider definitions
  session names must not be empty
  add missing properties
  fix Contracts directory name in PHPUnit configuration
  [Validator][CidrValidator] Fix error message for `OutOfRangeNetmask` validation
  Passing null to parameter #2 ($subject) of type string is deprecated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0