title: Execute plain SQL query in Extbase repository
body: <p>I am trying to execute a query in Extbase repository, but it is not return any result.</p>
  
  <p>This is my syntax and if anybody knows the problem, please help.</p>
  
  <p>In repository file;</p>
  
  <pre><code>public function getImages( $uidOfCE, $pid ) {
  
      $query = $this-&gt;createQuery(); 
      $query-&gt;statement('SELECT sf.identifier,sfm.title,sfr.description 
          FROM tt_content AS tc 
          LEFT JOIN sys_file_reference sfr ON sfr.`uid_foreign` = tc.uid 
          LEFT JOIN sys_file AS sf ON sf.`uid` = sfr.uid_local 
          LEFT JOIN sys_file_metadata AS sfm ON sfm.`file` = sf.uid 
          WHERE tc.uid = '.$uidOfCE.' 
          AND tc.pid='.$pid.' 
          AND tc.list_type = "myimage_gallery" 
          AND sfr.`deleted` = 0 AND sfr.`hidden`= 0  
          AND tc.`deleted` = 0 AND tc.`hidden`= 0  AND  tc.sys_language_uid ='.$GLOBALS['TSFE']-&gt;sys_language_uid.' 
          AND sfr.fieldname = "tx_myext_images" AND sfr.tablenames = "tt_content"');
  
      return $query-&gt;execute();
  }
  </code></pre>
  
  <p>In controller:</p>
  
  <pre><code>$myimagegalleries = $this-&gt;myimagegalleryRepository-&gt;getImages(
  $uidOfCE, $this-&gt;cObj-&gt;data['pid'] );
  </code></pre>
  
  <p>Is it possible to create custom queries in extbase repository?</p>