$name =
$this->connection->
fetchColumn('SELECT name FROM s_emotion WHERE id = :id',
[':id' =>
$emotionId]);
$name =
strtolower($this->slug->
slugify($name));
$filename =
$this->rootDirectory . '/files/downloads/' .
$name .
time() . '.zip';
if ($zip->
open($filename, ZipArchive::CREATE
) !== true
) { throw new Exception(sprintf('Could not create zip file "%s"!',
$filename));
} $emotionData =
$this->transformer->
transform($emotionId, true
);
$preset =
$this->
createHiddenPreset($emotionData);
$preset =
$this->synchronizer->
prepareAssetExport($preset);
$presetData =
json_decode($preset->
getPresetData(), true
);
$syncData =
new ParameterBag($presetData['syncData'
]);
$assets =
$syncData->
get('assets',
[]);
$zip->
addEmptyDir('images'
);
foreach ($assets as &
$path) { $fileContent =
$this->mediaService->
read($path);
if ($fileContent === false
) {