diff --git a/src/Inject/AbstractRequestMethod.php b/src/Inject/AbstractRequestMethod.php index ce9b14a..5f222af 100644 --- a/src/Inject/AbstractRequestMethod.php +++ b/src/Inject/AbstractRequestMethod.php @@ -15,9 +15,8 @@ abstract class AbstractRequestMethod /** * @param string $path - * @param string $formValidate */ - public function __construct(readonly public string $path, public string $formValidate = '') + public function __construct(readonly public string $path) { } @@ -41,30 +40,6 @@ abstract class AbstractRequestMethod $middlewareManager->set($class::class, $method, $instance->middleware); } - - if ($this->formValidate !== '') { - $middlewareManager->set($class::class, $method, ValidatorMiddleware::class, [$this->getFormRule()]); - } } - - /** - * @return Validator|null - * @throws ReflectionException - */ - public function getFormRule(): ?Validator - { - $validator = new Validator(); - $reflect = \Kiri::getDi()->getReflectionClass($this->formValidate); - $model = $reflect->newInstanceWithoutConstructor(); - foreach ($reflect->getProperties() as $property) { - foreach ($property->getAttributes() as $attribute) { - $rule = $attribute->newInstance(); - if ($rule instanceof ValidatorInterface) { - $validator->addRule($property->getName(), $model, $rule); - } - } - } - return $validator; - } }