File tree Expand file tree Collapse file tree 3 files changed +26
-27
lines changed Expand file tree Collapse file tree 3 files changed +26
-27
lines changed Original file line number Diff line number Diff line change 8
8
.php_cs.cache
9
9
.php-cs-fixer.cache
10
10
.phpunit.result.cache
11
+ phpunit.xml
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
-
3
- <phpunit xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
- xsi : noNamespaceSchemaLocation =" https://schema.phpunit.de/9.5/phpunit.xsd"
5
- backupGlobals =" false"
6
- colors =" true"
7
- convertErrorsToExceptions =" true"
8
- convertNoticesToExceptions =" true"
9
- convertWarningsToExceptions =" true"
10
- stopOnFailure =" false"
11
- bootstrap =" ./vendor/autoload.php" >
12
- <testsuites >
13
- <testsuite name =" Linio Framework Test Suite" >
14
- <directory suffix =" Test.php" >tests</directory >
15
- </testsuite >
16
- </testsuites >
17
- <filter >
18
- <whitelist addUncoveredFilesFromWhitelist =" true" >
19
- <directory suffix =" .php" >src</directory >
20
- <exclude >
21
- <directory suffix =" .php" >vendor</directory >
22
- </exclude >
23
- </whitelist >
24
- </filter >
25
- <logging >
26
- <log type =" coverage-clover" target =" ./coverage.xml" />
27
- </logging >
2
+ <phpunit xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals =" false" colors =" true" convertErrorsToExceptions =" true" convertNoticesToExceptions =" true" convertWarningsToExceptions =" true" stopOnFailure =" false" bootstrap =" ./vendor/autoload.php" >
3
+ <coverage includeUncoveredFiles =" true" >
4
+ <include >
5
+ <directory suffix =" .php" >src</directory >
6
+ </include >
7
+ <exclude >
8
+ <directory suffix =" .php" >vendor</directory >
9
+ </exclude >
10
+ <report >
11
+ <clover outputFile =" ./coverage.xml" />
12
+ </report >
13
+ </coverage >
14
+ <testsuites >
15
+ <testsuite name =" Linio Framework Test Suite" >
16
+ <directory suffix =" Test.php" >tests</directory >
17
+ </testsuite >
18
+ </testsuites >
19
+ <logging />
28
20
</phpunit >
Original file line number Diff line number Diff line change 15
15
use Symfony \Component \Form \FormBuilderInterface ;
16
16
use Symfony \Component \Form \FormFactory as SymfonyFormFactory ;
17
17
use Symfony \Component \Form \FormInterface ;
18
+ use Symfony \Component \Validator \Mapping \ClassMetadata ;
19
+ use Symfony \Component \Validator \Mapping \GenericMetadata ;
18
20
use Symfony \Component \Validator \Validation ;
19
21
20
22
class FormFactory
@@ -220,7 +222,11 @@ public function createValidator($key, mixed $object)
220
222
}
221
223
222
224
foreach ($ fieldConfiguration ['validation ' ] as $ validatorName => $ options ) {
223
- $ metadata ->addPropertyConstraint ($ key , new $ validatorName ($ options ));
225
+ if ($ metadata instanceof ClassMetadata) {
226
+ $ metadata ->addPropertyConstraint ($ key , new $ validatorName ($ options ));
227
+ } elseif ($ metadata instanceof GenericMetadata) {
228
+ $ metadata ->addConstraint (new $ validatorName ($ options ));
229
+ }
224
230
}
225
231
}
226
232
You can’t perform that action at this time.
0 commit comments