You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a Validator we inject the ManagerRegistry dependencie (do the same with the old EntityManagerInterface service), this cause an exception:
Uncaught Exception: RuntimeException PHP Error: ReflectionClass::__construct(): Passing null to parameter #1 ($objectOrClass) of type object|string is deprecated in /home/mpiot/Documents/vermon/vendor/psalm/plugin-symfony/src/Handler/DoctrineRepositoryHandler.php:50
The validator code is:
class NotManufacturingDefectValidator extends ConstraintValidator
{
publicfunction__construct(privateManagerRegistry$registry)
{
}
publicfunctionvalidate($value, Constraint$constraint): void
{
/* @var $constraint NotManufacturingDefect */if (null === $value || '' === $value) {
return;
}
$repository = $this->registry->getManager()->getRepository($value::class);
if (!$repositoryinstanceof HasManufacturingDefectInterface) {
thrownew \InvalidArgumentException(sprintf('@NotManufacturingDefect constraint must be put on a property refering to an entity with a repository that implement %s.', HasManufacturingDefectInterface::class));
}
$hasManufacturingDefect = $repository->hasManufacturingDefect($value);
if (true === $hasManufacturingDefect) {
$this->context->buildViolation($constraint->message)
->addViolation()
;
}
}
}
If I comment the constructor, no Exceptions, then it seems totally due to this specific injection in this place. If I try to inject it a Controller for example it works.
The text was updated successfully, but these errors were encountered:
In a Validator we inject the
ManagerRegistry
dependencie (do the same with the oldEntityManagerInterface
service), this cause an exception:The validator code is:
If I comment the constructor, no Exceptions, then it seems totally due to this specific injection in this place. If I try to inject it a Controller for example it works.
The text was updated successfully, but these errors were encountered: