'Circular reference has been detected' error when serializing many-to-many-associated objects
It looks like something wrong with config.You have to enable serialization groups annotation:
# app/config/config.ymlframework:# ...serializer: enable_annotations: true
And proper use statement has to be present in ContactGroup entity class
use Symfony\Component\Serializer\Annotation\Groups;
$normalizers->setCircularReferenceHandler(function ($object) { return $object->getId(); });
Just add it after you make the instance of your objectNormalizer ;