Skip to content

Commit

Permalink
Update implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette committed Jan 21, 2024
1 parent 970161f commit d39955d
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\App;
use UserFrosting\Fortress\RequestSchema\RequestSchemaRepository;
use UserFrosting\Fortress\ServerSideValidator;
use UserFrosting\Fortress\RequestSchema;
use UserFrosting\Fortress\Validator\ServerSideValidator;
use UserFrosting\I18n\Translator;
use UserFrosting\Routes\RouteDefinitionInterface;
use UserFrosting\Sprinkle\Core\Core;
Expand Down Expand Up @@ -61,7 +61,7 @@ class TestRoutes implements RouteDefinitionInterface
public function register(App $app): void
{
$app->get('/test', function (Request $request, Response $response, Translator $translator) {
$schema = new RequestSchemaRepository([
$schema = new RequestSchema([
'email' => [
'validators' => [
'email' => [
Expand All @@ -71,12 +71,12 @@ public function register(App $app): void
],
]);

$validator = new ServerSideValidator($schema, $translator);
$validator->validate([
$validator = new ServerSideValidator($translator);
$error = $validator->validate($schema, [
'email' => 'david',
]);
$e = new ValidationException();
$e->addErrors($validator->errors()); // @phpstan-ignore-line
$e->addErrors($error);

throw $e;
});
Expand Down

0 comments on commit d39955d

Please sign in to comment.