title: Problem of relation called twice on apiplatform with symfony
body: <p>I have two entities: Tag, Post.
  In relation Many to Many</p>
  <p>I have an API route in GET: /api/tags/{id}</p>
  <p>I want to return the posts associated to a tag by the tag.
  But I also want to return the tags associated with the posts objects returned by the Tag.</p>
  <p>This produces an error:</p>
  <p>&quot;The total number of joined relations has exceeded the specified maximum. Raise the limit if necessary with the &quot;api_platform.eager_loading.max_joins&quot; configuration key (<a href="https://api-platform.com/docs/core/performance/#eager-loading" rel="nofollow noreferrer">https://api-platform.com/docs/core/performance/#eager-loading</a>), or limit the maximum serialization depth using the &quot;enable_max_depth&quot; option of the Symfony serializer (<a href="https://symfony.com/doc/current/components/serializer.html#handling-serialization-depth" rel="nofollow noreferrer">https://symfony.com/doc/current/components/serializer.html#handling-serialization-depth</a>).&quot;</p>
  <p>The tag entity :</p>
  <pre><code>#[ApiResource(
  normalizationContext: ['groups' =&gt; ['read:collection:Tag']],
  collectionOperations:['get'],
  paginationEnabled: false,
  itemOperations: [
      'get' =&gt; [
          'normalization_context' =&gt; ['groups' =&gt; [
              'read:item:Tag',
              'read:collection:Tag'
              ]]
          ],
  ]
  )]
  
  class Tag
  {
  /**
   * @ORM\Id
   * @ORM\GeneratedValue
   * @ORM\Column(type=&quot;integer&quot;)
   */
  #[Groups(['read:collection:Post', 'read:item:Category', 'read:collection:Tag'])]
  private $id;
  
  /**
   * @ORM\Column(type=&quot;string&quot;, length=255)
   */
  #[Groups(['read:collection:Post', 'read:item:Category', 'read:collection:Tag'])]
  private $name;
  
  /**
   * @ORM\ManyToMany(targetEntity=Post::class, mappedBy=&quot;tags&quot;)
   */
  #[Groups(['read:item:Tag'])]
  private $posts;
  </code></pre>
  <p>The tag field in the Post entity :</p>
  <pre><code>/**
   * @ORM\ManyToMany(targetEntity=Tag::class, inversedBy=&quot;posts&quot;)
   */
  #[Groups(['read:collection:Post', 'read:item:Category','read:item:Tag'])]
  private $tags;
  </code></pre>
  <p>I tried limiting the maximum serialization depth using the &quot;enable_max_depth&quot; option as indicated in the error message, it does not work.</p>