$query =
$this->connection->
createQueryBuilder();
$query->
select($this->fieldHelper->
getDownloadFields());
$query->
from('s_articles_downloads', 'download'
) ->
leftJoin('download', 's_articles_downloads_attributes', 'downloadAttribute', 'downloadAttribute.downloadID = download.id'
) ->
innerJoin('download', 's_media', 'media', 'media.path = download.filename'
) ->
where('download.articleID IN (:ids)'
) ->
setParameter(':ids',
$ids, Connection::PARAM_INT_ARRAY
);
$this->fieldHelper->
addDownloadTranslation($query,
$context);
$data =
$query->
execute()->
fetchAll(PDO::FETCH_ASSOC
);
$downloads =
[];
foreach ($data as $row) { $key =
$row['__download_articleID'
];
$downloads[$key][] =
$this->downloadHydrator->
hydrate($row);
} $result =
[];