public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context)
{
/** @var \eZ\Publish\Core\FieldType\Image\ImageStorage\Gateway $gateway */
$gateway = $this->getGateway($context);
$fieldXmls = $gateway->getXmlForImages($versionInfo->versionNo, $fieldIds);
foreach ($fieldXmls as $fieldId => $xml) {
$storedFiles = $gateway->extractFilesFromXml($xml);
if ($storedFiles === null) {
continue;
}
if ($this->aliasCleaner) {
$this->aliasCleaner->removeAliases($storedFiles['original']);
}
foreach ($storedFiles as $storedFilePath) {
$gateway->removeImageReferences($storedFilePath, $versionInfo->versionNo, $fieldId);
if ($gateway->countImageReferences($storedFilePath) === 0) {
$binaryFile = $this->IOService->loadBinaryFileByUri($storedFilePath);
$this->IOService->deleteBinaryFile($binaryFile);
}
}
}
}