Bridge with symfony/validator

Refer to the official documentation on Symfony’s website.

This bridge provides a ways to skip invalid items in batch job execution.

Skip invalid item processor

This item processor will validate each item, and throws an exception if at least one violation is raised.
The exception is caught by ItemJob, causing the item to be skipped.
<?php

declare(strict_types=1);

use Symfony\Component\Validator\Validator\ValidatorInterface;
use Yokai\Batch\Bridge\Symfony\Validator\SkipInvalidItemProcessor;

/** @var ValidatorInterface $validator */

new SkipInvalidItemProcessor(
    validator: $validator,
    contraints: null, // optionally the constraint(s) to validate against
    groups: null, // optionally the validation groups to validate
);