Skip to main content
Version: 4.1

Job Creators

Zip Files

Batch Messenger comes with default Job Creators for common tasks. One of them is the ZipAssetJobCreator. It allows you to create a Zip File from Pimcore Assets.

To create a new Zip File, you can use the ZipAssetJobCreator service like this:

$assets = [
Asset::getById(2),
Asset::getById(3),
Asset::getById(4),
];

$task = $this->jobCreator->createTask(1, true, ...$assets);

You can then query the $task frequently to get the status. The Task also saves the zip File Path that is stored in the coreshop_batch_messenger.zip.storage storage. To get the path, you can use this:

$task->getTaskDataEntry(ZipAssetItemTask::CONTEXT_ZIP_FILE_NAME);