title: You cannot search for the association field, because it is the inverse side of an association. Find methods only work on owning side associations
body: <p>Hey guys im trying to establish a relation between objects of the me same model.</p>
  <p>I have a table <code>Qcm</code>,  a table <code>Equivalent</code> and last table is <code>EquivalentRelation</code>.
  The idea is to have a QCM that can be related to many others QCM.</p>
  <p>My <code>Equivalent</code> model is set up in a way with a variable <code>$qcmId</code> which is the id (int) of the qcm and a Primary Key of my <code>Equivalent</code> model.</p>
  <pre><code>/**
   * @ORM\Entity(repositoryClass=EquivalentRepository::class)
   */
  class Equivalent
  {
  
      /**
       * @ORM\Id()
       * @ORM\Column(type=&quot;integer&quot;)
       */
      public $qcmId;
  
      /**
       * @ORM\ManyToOne(targetEntity=EquivalentRelation::class, inversedBy=&quot;equivalent&quot;)
       */
      private $equivalentRelation;
  
      /**
       * @return mixed
       */
      public function getQcmId()
      {
          return $this-&gt;qcmId;
      }
  
      /**
       * @param mixed $qcmId
       */
      public function setQcmId($qcmId): void
      {
          $this-&gt;qcmId = $qcmId;
      }
  
      public function getEquivalentRelation(): ?EquivalentRelation
      {
          return $this-&gt;equivalentRelation;
      }
  
      public function setEquivalentRelation(?EquivalentRelation $equivalentRelation): self
      {
          $this-&gt;equivalentRelation = $equivalentRelation;
  
          return $this;
      }
  }
  </code></pre>
  <p>My <code>EquivalentRelation</code> model is set up with a <code>$equivalent</code> thats has a relation with my <code>Equivalent</code> model and a <code>$relateId</code> which is relation established with the chosen QCM im associating with.</p>
  <pre><code>/**
   * @ORM\Entity(repositoryClass=EquivalentRelationRepository::class)
   */
  class EquivalentRelation
  {
      /**
       * @ORM\Id
       * @ORM\GeneratedValue
       * @ORM\Column(type=&quot;integer&quot;)
       */
      private $id;
  
      /**
       * @ORM\OneToMany(targetEntity=Equivalent::class, mappedBy=&quot;equivalentRelation&quot;)
       */
      private $equivalent;
  
      /**
       * @ORM\ManyToMany(targetEntity=Qcm::class, inversedBy=&quot;equivalentRelations&quot;)
       */
      private $relatedId;
  
      public function __construct()
      {
          $this-&gt;equivalent = new ArrayCollection();
          $this-&gt;relatedId = new ArrayCollection();
      }
  
      public function getId(): ?int
      {
          return $this-&gt;id;
      }
  
      /**
       * @return Collection|Equivalent[]
       */
      public function getEquivalent(): Collection
      {
          return $this-&gt;equivalent;
      }
  
      public function addEquivalent(Equivalent $equivalent): self
      {
          if (!$this-&gt;equivalent-&gt;contains($equivalent)) {
              $this-&gt;equivalent[] = $equivalent;
              $equivalent-&gt;setEquivalentRelation($this);
          }
  
          return $this;
      }
  
      public function removeEquivalent(Equivalent $equivalent): self
      {
          if ($this-&gt;equivalent-&gt;removeElement($equivalent)) {
              // set the owning side to null (unless already changed)
              if ($equivalent-&gt;getEquivalentRelation() === $this) {
                  $equivalent-&gt;setEquivalentRelation(null);
              }
          }
  
          return $this;
      }
  
      /**
       * @return Collection|Qcm[]
       */
      public function getRelatedId(): Collection
      {
          return $this-&gt;relatedId;
      }
  
      public function addRelatedId(Qcm $relatedId): self
      {
          if (!$this-&gt;relatedId-&gt;contains($relatedId)) {
              $this-&gt;relatedId[] = $relatedId;
          }
  
          return $this;
      }
  
      public function removeRelatedId(Qcm $relatedId): self
      {
          $this-&gt;relatedId-&gt;removeElement($relatedId);
  
          return $this;
      }
  }
  </code></pre>
  <p>The next step was to have a <code>EquivalentType</code> form that would take the chosen QCM (can be multiple) and validate my model with ease. so far that part seems to be working without and issue.</p>
  <pre><code>class EquivalentType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              -&gt;add('relatedId', EntityType::class, [
              'class' =&gt; Qcm::class,
              'choice_label' =&gt; 'id',
              'multiple' =&gt; true,
              'label' =&gt; 'QCM Ref Master',
          ]);
      }
  
      public function configureOptions(OptionsResolver $resolver)
      {
          $resolver-&gt;setDefaults([
              'data_class' =&gt; EquivalentRelation::class
          ]);
      }
  }
  </code></pre>
  <p>After sending my form everything works perfectly,</p>
  <p>Handling the request thru  <code>QcmController</code> :</p>
  <p>Since i have two different model that are related, i create first a new <code>Equivalent</code>.</p>
  <pre><code>$equivalent = new Equivalent();
  $equivalent-&gt;setQcmId($qcm-&gt;getId());
  </code></pre>
  <p>followed by the same thing for EquivalentRelation</p>
  <pre><code>$equivalentrelation = new EquivalentRelation();
  $equivalentrelation-&gt;addEquivalent($equivalent);
  </code></pre>
  <p>When trying to access the <code>EquivalentRelation</code> with equivalent as query parameter to display all the QCM (<code>relatedId</code>) object that are related it it.</p>
  <pre><code>$tester = $equivalentRepository-&gt;findBy(['qcmId' =&gt; $qcm-&gt;getId()]);
  $data =  $equivalentRelationRepository-&gt;findBy(['equivalent' =&gt; $tester]);
  </code></pre>
  <p>here is the controller side of it :</p>
  <pre><code>      $equivalent = new Equivalent();
         $equivalent-&gt;setQcmId($qcm-&gt;getId());
         $equivalentrelation = new EquivalentRelation();
         $equivalentrelation-&gt;addEquivalent($equivalent);
          $equival = $this-&gt;createForm(EquivalentType::class, $equivalentrelation);
          $equival-&gt;handleRequest($request);
  if ($equival-&gt;isSubmitted() &amp;&amp; $equival-&gt;isValid()){
              $entityManager-&gt;persist($equivalent);
              $entityManager-&gt;persist($equivalentrelation);
              $entityManager-&gt;flush();
             return $this-&gt;redirectToRoute('qcm_show', ['id' =&gt; $qcm-&gt;getId()]);
          }
  </code></pre>
  <p>i get this error messages :</p>
  <pre><code>You cannot search for the association field 'App\Entity\EquivalentRelation#equivalent', because it is the inverse side of an association. Find methods only work on owning side associations.
  </code></pre>
  <p>I tried every method, i dont know if something is wrong with my deign or mapping system.</p>