$builder =
$this->
get('models'
)->
createQueryBuilder();
$downloads =
$builder->
select(['downloads', 'attribute'
]) ->
from(Download::
class, 'downloads'
) ->
leftJoin('downloads.attribute', 'attribute'
) ->
where('downloads.articleId = ?1'
) ->
setParameter(1,
$articleId) ->
getQuery() ->
getArrayResult();
foreach ($downloads as $data) { $download =
new Download();
$download->
fromArray($data);
$download->
setArticle($product);
$this->
get('models'
)->
persist($download);
} $this->
get('models'
)->
flush();
} /**
* Internal helper function to duplicate the image configuration from the passed product
* to the new product.
*
* @param int $articleId
* @param int $newArticleId
*/