function Unique::__construct
Parameters
array<string,mixed>|null $options:
string[]|null $groups:
string[]|string|null $fields Defines the key or keys in the collection that should be checked for uniqueness (defaults to null, which ensure uniqueness for all keys):
Overrides Constraint::__construct
File
-
vendor/
symfony/ validator/ Constraints/ Unique.php, line 43
Class
- Unique
- Validates that all the elements of the given collection are unique.
Namespace
Symfony\Component\Validator\ConstraintsCode
public function __construct(?array $options = null, ?string $message = null, ?callable $normalizer = null, ?array $groups = null, mixed $payload = null, array|string|null $fields = null, ?string $errorPath = null) {
parent::__construct($options, $groups, $payload);
$this->message = $message ?? $this->message;
$this->normalizer = $normalizer ?? $this->normalizer;
$this->fields = $fields ?? $this->fields;
$this->errorPath = $errorPath ?? $this->errorPath;
if (null !== $this->normalizer && !\is_callable($this->normalizer)) {
throw new InvalidArgumentException(\sprintf('The "normalizer" option must be a valid callable ("%s" given).', get_debug_type($this->normalizer)));
}
}