When I try to inject a Doctrine repository (as ServiceEntityRepository) in a custom Normalizer I have this error Maximum function nesting level of '256' reached, aborting!
My customer normalizer:
class GroupNormalizer implements NormalizerInterface
{
/**
* @var GroupRepository
*/
private $groupRepository;
public function __construct(GroupRepository $groupRepository)
{
$this->groupRepository = $groupRepository;
}
public function normalize($object, $format = null, array $context = [])
...
And the repository:
class GroupRepository extends ServiceEntityRepository
{
public function __construct(RegistryInterface $registry)
{
parent::__construct($registry, Group::class);
}
I am using Symfony 3.4.
Do you have any idea to avoid this error?
Edit