title: how to get access to the methods of the target entity of unidirectional ManyToOne association
body: <p>I am stuck here I execute the query:</p>
  <pre><code>public function findByFile_Ref_Id($query)
  {
      $query = $query['ids'];
  
      $q = $this-&gt;createQueryBuilder('h');
      $result = $q
          -&gt;join('h.file_ref_id', 'k')
          -&gt;add('where', $q-&gt;expr()-&gt;in('k.product_code', $query))
          -&gt;getQuery()
          -&gt;getResult();
  
      return $result;
  }
  </code></pre>
  <p>and I get something like this:</p>
  <blockquote>
  <p>array:5 [▼</p>
  <p>0 =&gt; HikashopFile {#417 ▼</p>
  <p>-file_id: 2207</p>
  <p>-file_path: &quot;1TAHBIO.jpg&quot;</p>
  <p>-file_ref_id: KstoreHikashopProduct {#363 ▼</p>
  <p>+<strong>isInitialized</strong>: true</p>
  <p>-product_id: 6</p>
  <p>-product_name: &quot;Tahina bio&quot;</p>
  <p>-product_description: &quot;<p>La Tahina è una crema di sesamo biologica. Rafforza il sistema immunitario grazie alla presenza di sali e
  vitamine, contiene un elevato contenuto di calcio, ▶&quot;</p>
  <p>-product_quantity: 3</p>
  <p>-product_code: &quot;1TAHBIO&quot; …2 } }</p>
  </blockquote>
  <p>I want to access the methods of that target entity to do some tasks.</p>
  <p>but when I try I get :</p>
  <blockquote>
  <p>Return value of App\Entity\HikashopFile::getFileRefId() must be of the
  type int or null, object returned</p>
  </blockquote>
  <p>or</p>
  <blockquote>
  <p>Attempted to call an undefined method named &quot;getProductName&quot; of class
  &quot;App\Entity\HikashopFile&quot;.</p>
  </blockquote>
  <p>there is clearly something wrong in my code.</p>
  <p>help would be appreciated!</p>