Skip to main content
Version: 2025.11

Determine storage directories using a directory resolver

Overview

The bundle offers the possibility to determine the storage directories of assets, JSON files and .done files using a service.

Default resolver

By default, the DefaultDirectoryResolver is used. This resolver just passes on the configured directories without creating any additional subdirectories.

Create custom resolver

Note

Resolvers can be retrieved by their identifier using the following collection class: Twocream\ShopwareConnectorBundle\Service\DirectoryResolver\DirectoryResolverCollector

Interface

A DirectoryResolver must implement the interface Twocream\ShopwareConnectorBundle\Service\DirectoryResolver\DirectoryResolverInterface.

Methodes

The resolver must implement the following methods:

DefinitionArgumentsDescription
public static function getIdentifier(): stringNo argumentsReturns the resolver's unique identifier (This is the value used in the configuration)
public function resolveJsonDirectory(?string $exportJob = null, ?array $targetConfiguration = null): string$exportJob: The job ID of the current export
$targetConfiguration: The YAML configuration of the export target as an array
Returns the storage directory for the JSON files, this is always relative to the configured export directory (export_directory)
public function resolveDoneDirectories(?array $targetConfiguration = null): array$targetConfiguration: The YAML configuration of the export target as an array
Returns the storage paths of the .done-Dateien generated after an export
public function resolveAssetDirectory(Asset $asset, ?string $exportJob = null, ?array $targetConfiguration = null): string$asset: The asset
$exportJob: The job ID of the current export $targetConfiguration: The YAML configuration of the export target as an array
Returns the storage directory for assets, this is always relative to the configured asset directory (asset_directory)

Registering the resolver

New resolvers must be registered in a service configuration file. The service tag twocream.shopware_connector.directory_resolver must be used.

services:
_defaults:
autowire: true
autoconfigure: true
public: false

twocream.shopware_connector.directory_resolver_example:
public: true
class: App\Service\DirectoryResolver\ExampleDirectoryResolver
tags: [ 'twocream.shopware_connector.directory_resolver' ]