Dependencies between Export Adapters
In some cases, it is necessary for an Export Adapter to depend on another Export Adapter. For example, a product import initially requires the relational product attributes.
For this purpose, the abstract Adapter class of the Shopware-Connector-Bundle
provides the method getDependentAdapters
. The return value of this method expects a list of strings representing the dependent adapter keys.
The dependent adapters are automatically processed together with this information.
Example
config/packages/shopware_connector.yaml
twocream_shopware_connector:
export_targets:
- key: shop
target_type: shopware
has_delta_management: true
export_directory: '/NFS/transfer/from-pimcore/to-shop/json/'
asset_domain: 'https://cdn.my-company.tld'
asset_directory: '/NFS/transfer/from-pimcore/to-shop/assets/'
reporting:
from: 'noreply@my-company.tld'
reply_to: 'noreply@my-company.tld'
import_mail_subject: "[Shopware-Connector] Pimcore-Export to Shop"
export_mail_subject: "[Shopware-Connector] Shopware-Import to Shop"
adapters:
- key: 'products'
source_folder_ids:
- '123'
- key: 'attributes'
hide_export_mask: true
source_folder_ids:
- '456'
- key: 'attribute-values'
hide_export_mask: true
source_folder_ids:
- '456'
language_mapping:
de: 'de_DE'
en: 'en_GB'
src/Components/Export/Adapters/Product/ProductAdapter.php
<?php
namespace App\Components\Export\Adapters\Product;
use Twocream\ShopwareConnectorBundle\Transformer\Adapter\ArrayAdapter\ArrayAdapterAbstract;
class ProductAdapter extends ArrayAdapterAbstract
{
// ...
public function getDependentAdapters(): array
{
return ['attributes', 'attribute-values'];
}
// ...
}
Summary
In this example, the products
adapter depends on the attributes
and attribute-values
adapters.
The attributes
and attribute-values
adapters are thus automatically processed together when products
is selected.