This commit is contained in:
2023-12-15 19:28:39 +08:00
parent 6b4fa2af63
commit 4f148fbdbf
+13 -10
View File
@@ -45,17 +45,20 @@ class BindForm implements InjectParameterInterface
$object = $validator->setFormData($reflect->newInstanceWithoutConstructor());
foreach ($reflect->getProperties() as $property) {
$ignoring = $property->getAttributes(Ignoring::class);
if (count($ignoring) == 0) {
$binding = $property->getAttributes(Binding::class);
if (count($binding) == 1) {
$attribute = current($binding);
$rule = inject($attribute->newInstance());
if ($rule instanceof RequestFilterInterface) {
$validator->addRule($property->getName(), $rule->dispatch($object, $property->getName()));
}
$validator->setAlias($attribute->getName(), $rule->field);
}
if (count($ignoring) > 0) {
continue;
}
$binding = $property->getAttributes(Binding::class);
if (count($binding) == 1) {
$attribute = current($binding);
$rule = inject($attribute->newInstance());
if ($rule instanceof RequestFilterInterface) {
$validator->addRule($property->getName(), $rule->dispatch($object, $property->getName()));
}
$validator->setAlias($attribute->getName(), $rule->field);
}
$typeProxy = $this->_typeValidator($property);
$validator->addRule($property->getName(), [$typeProxy, false]);
}