Skip to main content

Frequently Asked Questions

How are entity data in Shopware deleted when the object in Pimcore has an active switch?

Both unpublishing and deleting objects in Pimcore trigger a deletion in Shopware during the subsequent export. This assumes that the import module does not suppress the delete function (method: 'canBeDeleted').

However, if an active switch is used in Pimcore, it must be evaluated in the export adapter as follows:

<?php

namespace App\Component\Export\Adapter;

use Twocream\ShopwareConnectorBundle\Transformer\Adapter\ArrayAdapter\ArrayAdapterAbstract;

class VideoAdapter extends ArrayAdapterAbstract
{
public static function getPackageName(): string
{
return 'video';
}

public function getTargetClassName(): string
{
return 'Video';
}

protected function prepare($object): array
{
if (!$object->getStateInformation()) {
return [];
}

// ...

return $serializedData;
}
}

As soon as the 'prepare' method returns an empty array, this signals the deletion of the record. The Pimcore ID and Shopware UUID are automatically recorded for deletion in the export task.