eZ\Publish\Core\FieldType\Image\ImageStorage\Gateway\LegacyStorage::removeImageReferences PHP Method

removeImageReferences() public method

Removes all references from $fieldId to a path that starts with $path.
public removeImageReferences ( string $uri, integer $versionNo, mixed $fieldId )
$uri string File IO uri (not legacy)
$versionNo integer
$fieldId mixed
    public function removeImageReferences($uri, $versionNo, $fieldId)
    {
        $path = $this->redecorator->redecorateFromSource($uri);
        if (!$this->canRemoveImageReference($path, $versionNo, $fieldId)) {
            return;
        }
        $connection = $this->getConnection();
        $deleteQuery = $connection->createDeleteQuery();
        $deleteQuery->deleteFrom($connection->quoteTable('ezimagefile'))->where($deleteQuery->expr->lAnd($deleteQuery->expr->eq($connection->quoteColumn('contentobject_attribute_id'), $deleteQuery->bindValue($fieldId, null, \PDO::PARAM_INT)), $deleteQuery->expr->like($connection->quoteColumn('filepath'), $deleteQuery->bindValue($path . '%'))));
        $statement = $deleteQuery->prepare();
        $statement->execute();
    }