Description
I have to implement dynamic validation. Think I have done it by the books, but it seems that the invoke function of my GroupsGenerator is not called.
How to reproduce
The GroupsGenerator:
<?php
namespace App\Validator;
use ApiPlatform\Core\Bridge\Symfony\Validator\ValidationGroupsGeneratorInterface;
use App\Entity\Lead;
use App\Entity\PartnerWebsite;
use Symfony\Component\Security\Core\Security;
final class LeadGroupsGenerator implements ValidationGroupsGeneratorInterface
{
private Security $security;
public function __construct(Security $security)
{
$this->security = $security;
}
public function __invoke($object): array
{
var_dump($this->security->getUser() instanceof PartnerWebsite);die();
assert($object instanceof Lead);
return $this->security->getUser() instanceof PartnerWebsite ? ['PartnerWebsite'] : ['Lead'];
}
}
API Platform version(s) affected: 2.6.3
Description
I have to implement dynamic validation. Think I have done it by the books, but it seems that the invoke function of my GroupsGenerator is not called.
How to reproduce
The GroupsGenerator:
From my xml configuration:
The Generator is registered, but __invike function is not called: