Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### 1. Why is this change necessary?
Copy link
Member Author

@larskemper larskemper Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't merge!


// Please link to the relevant issues, if they exists, or explain the solved issue here. e.g.
// closes https://github.com/shopware/shopware/issues/{ISSUE_NUMBER}

### 2. What does this change do, exactly?

// Shortly explain how your change solves the issue
// If the issue has more than one obvious solution,
// shortly explain your reasoning for your chosen approach

### 3. Describe each step to reproduce the issue or behaviour.


### 5. Checklist

- [ ] I have created the PR in draft status and only open it when it's ready for review
- [ ] If the change is large: I have thought about splitting it up into smaller PRs
- [ ] I have written tests and if it's a bug fix verified that they fail without my change or that new code is covered by tests
- [ ] I have updated developer-facing release notes if this change affects external developers
- [ ] I have written or adjusted the documentation according to my changes
- [ ] I added the correct package annotation to each `src` file (not strictly necessary for tests)
- [ ] This change has code comments where appropriate, especially for non-obvious lines of code
- [ ] Ensure the pull request title as well as first commit follows conventional commits
- [ ] I have thought about well-defined extension points and marked everything else as `@internal` / `@private`
398 changes: 199 additions & 199 deletions phpstan-baseline.neon

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions src/DataProvider/Provider/Data/MailHeaderFooterProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php declare(strict_types=1);
/*
* (c) shopware AG <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace SwagMigrationAssistant\DataProvider\Provider\Data;

use Shopware\Core\Content\MailTemplate\Aggregate\MailHeaderFooter\MailHeaderFooterCollection;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Sorting\FieldSorting;
use Shopware\Core\Framework\Log\Package;
use SwagMigrationAssistant\Migration\DataSelection\DefaultEntities;

#[Package('fundamentals@after-sales')]
class MailHeaderFooterProvider extends AbstractProvider
{
/**
* @param EntityRepository<MailHeaderFooterCollection> $mailHeaderFooterRepo
*/
public function __construct(private readonly EntityRepository $mailHeaderFooterRepo)
{
}

public function getIdentifier(): string
{
return DefaultEntities::MAIL_HEADER_FOOTER;
}

public function getProvidedData(int $limit, int $offset, Context $context): array
{
$criteria = new Criteria();
$criteria->setLimit($limit);
$criteria->setOffset($offset);
$criteria->addAssociation('translations');
$criteria->addSorting(new FieldSorting('id'));
$result = $this->mailHeaderFooterRepo->search($criteria, $context);

return $this->cleanupSearchResult($result, [
'mailHeaderFooterId',
]);
}

public function getProvidedTotal(Context $context): int
{
return $this->readTotalFromRepo($this->mailHeaderFooterRepo, $context);
}
}
1 change: 1 addition & 0 deletions src/DataProvider/Provider/Data/SystemConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class SystemConfigProvider extends AbstractProvider
public static array $CONFIG_KEY_BLOCK_LIST = [
// shop instance, license related or consent data
'core.app.shopId',
'core.app.shopIdV2',
'core.basicInformation.shopName',
'core.basicInformation.activeCaptchas',
'core.basicInformation.activeCaptchasV2',
Expand Down
5 changes: 5 additions & 0 deletions src/DependencyInjection/dataProvider.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@
<tag name="shopware.dataProvider.provider"/>
</service>

<service id="SwagMigrationAssistant\DataProvider\Provider\Data\MailHeaderFooterProvider">
<argument type="service" id="mail_header_footer.repository"/>
<tag name="shopware.dataProvider.provider"/>
</service>

<service id="SwagMigrationAssistant\DataProvider\Provider\Data\MailTemplateProvider">
<argument type="service" id="mail_template.repository"/>
<tag name="shopware.dataProvider.provider"/>
Expand Down
20 changes: 4 additions & 16 deletions src/DependencyInjection/migration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,6 @@
<argument type="service" id="SwagMigrationAssistant\Migration\ErrorResolution\MigrationErrorResolutionService"/>
</service>

<service id="SwagMigrationAssistant\Migration\Service\MediaFileProcessorService" public="true">
<argument type="service" id="messenger.default_bus"/>
<argument type="service" id="SwagMigrationAssistant\Migration\DataSelection\DataSet\DataSetRegistry"/>
<argument type="service" id="SwagMigrationAssistant\Migration\Logging\LoggingService"/>
<argument type="service" id="Doctrine\DBAL\Connection"/>
</service>

<service id="SwagMigrationAssistant\Migration\Media\MediaFileProcessorRegistry">
<argument type="tagged_iterator" tag="shopware.migration.media_file_processor"/>
</service>
Expand Down Expand Up @@ -309,14 +302,6 @@
<argument type="service" id="swag_migration_connection.repository"/>
</service>

<service id="SwagMigrationAssistant\Migration\MessageQueue\Handler\ProcessMediaHandler">
<argument type="service" id="swag_migration_run.repository"/>
<argument type="service" id="SwagMigrationAssistant\Migration\Media\MediaFileProcessorRegistry"/>
<argument type="service" id="SwagMigrationAssistant\Migration\Logging\LoggingService"/>
<argument type="service" id="SwagMigrationAssistant\Migration\MigrationContextFactory"/>
<tag name="messenger.message_handler"/>
</service>

<service id="SwagMigrationAssistant\Migration\MessageQueue\Handler\TruncateMigrationHandler">
<argument type="service" id="Doctrine\DBAL\Connection"/>
<argument type="service" id="messenger.default_bus"/>
Expand Down Expand Up @@ -404,8 +389,11 @@

<service id="SwagMigrationAssistant\Migration\MessageQueue\Handler\Processor\MediaProcessingProcessor"
parent="SwagMigrationAssistant\Migration\MessageQueue\Handler\Processor\AbstractProcessor">
<argument type="service" id="SwagMigrationAssistant\Migration\Service\MediaFileProcessorService"/>
<argument type="service" id="messenger.default_bus"/>
<argument type="service" id="SwagMigrationAssistant\Migration\Logging\LoggingService"/>
<argument type="service" id="Doctrine\DBAL\Connection"/>
<argument type="service" id="SwagMigrationAssistant\Migration\Media\MediaFileProcessorRegistry"/>
<argument type="service" id="SwagMigrationAssistant\Migration\DataSelection\DataSet\DataSetRegistry"/>

<tag name="shopware.migration.processor"/>
</service>
Expand Down
1 change: 1 addition & 0 deletions src/DependencyInjection/shopware.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
<argument type="service" id="SwagMigrationAssistant\Migration\Media\MediaFileService"/>
<argument type="service" id="SwagMigrationAssistant\Migration\Mapping\Lookup\MediaDefaultFolderLookup"/>
<argument type="service" id="SwagMigrationAssistant\Migration\Mapping\Lookup\DocumentTypeLookup"/>
<argument type="service" id="SwagMigrationAssistant\Migration\Mapping\Lookup\GlobalDocumentBaseConfigLookup"/>
</service>

<service id="SwagMigrationAssistant\Profile\Shopware\Converter\CustomerGroupAttributeConverter"
Expand Down
21 changes: 21 additions & 0 deletions src/DependencyInjection/shopware6.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@
<tag name="shopware.migration.converter"/>
</service>

<service id="SwagMigrationAssistant\Profile\Shopware6\Converter\MailHeaderFooterConverter"
parent="SwagMigrationAssistant\Profile\Shopware6\Converter\ShopwareConverter">
<tag name="shopware.migration.converter"/>
</service>

<service id="SwagMigrationAssistant\Profile\Shopware6\Converter\MailTemplateConverter"
parent="SwagMigrationAssistant\Profile\Shopware6\Converter\ShopwareMediaConverter">
<argument type="service" id="SwagMigrationAssistant\Migration\Mapping\Lookup\MailTemplateTypeLookup"/>
Expand Down Expand Up @@ -478,6 +483,10 @@
<tag name="shopware.migration.data_set"/>
</service>

<service id="SwagMigrationAssistant\Profile\Shopware6\DataSelection\DataSet\MailHeaderFooterDataSet">
<tag name="shopware.migration.data_set"/>
</service>

<service id="SwagMigrationAssistant\Profile\Shopware6\DataSelection\DataSet\MailTemplateDataSet">
<tag name="shopware.migration.data_set"/>
</service>
Expand Down Expand Up @@ -725,6 +734,11 @@
<tag name="shopware.migration.reader"/>
</service>

<service id="SwagMigrationAssistant\Profile\Shopware6\Gateway\Api\Reader\MailHeaderFooterReader"
parent="SwagMigrationAssistant\Profile\Shopware6\Gateway\Api\Reader\ApiReader">
<tag name="shopware.migration.reader"/>
</service>

<service id="SwagMigrationAssistant\Profile\Shopware6\Gateway\Api\Reader\MailTemplateReader"
parent="SwagMigrationAssistant\Profile\Shopware6\Gateway\Api\Reader\ApiReader">
<tag name="shopware.migration.reader"/>
Expand Down Expand Up @@ -919,6 +933,13 @@
<tag name="shopware.migration.writer"/>
</service>

<service id="SwagMigrationAssistant\Profile\Shopware6\Writer\MailHeaderFooterWriter"
parent="SwagMigrationAssistant\Migration\Writer\AbstractWriter">
<argument type="service" id="Shopware\Core\Framework\DataAbstractionLayer\Write\EntityWriter"/>
<argument type="service" id="Shopware\Core\Content\MailTemplate\Aggregate\MailHeaderFooter\MailHeaderFooterDefinition"/>
<tag name="shopware.migration.writer"/>
</service>

<service id="SwagMigrationAssistant\Profile\Shopware6\Writer\MailTemplateWriter"
parent="SwagMigrationAssistant\Migration\Writer\AbstractWriter">
<argument type="service" id="Shopware\Core\Framework\DataAbstractionLayer\Write\EntityWriter"/>
Expand Down
2 changes: 2 additions & 0 deletions src/Migration/DataSelection/DefaultEntities.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ final class DefaultEntities

final public const LOCALE = 'locale';

final public const MAIL_HEADER_FOOTER = 'mail_header_footer';

final public const MAIL_TEMPLATE = 'mail_template';

final public const MAIL_TEMPLATE_TYPE = 'mail_template_type';
Expand Down
25 changes: 25 additions & 0 deletions src/Migration/Mapping/Lookup/GlobalDocumentBaseConfigLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class GlobalDocumentBaseConfigLookup implements ResetInterface
*/
private array $cache = [];

/**
* @var array<string, array<string, mixed>|null>
*/
private array $configCache = [];

/**
* @param EntityRepository<DocumentBaseConfigCollection> $documentBaseConfigRepository
*
Expand Down Expand Up @@ -51,8 +56,28 @@ public function get(string $documentTypeId, Context $context): ?string
return $baseConfigId;
}

/**
* @return array<string, mixed>|null
*/
public function getBaseConfig(string $baseConfigId, Context $context): ?array
{
if (\array_key_exists($baseConfigId, $this->configCache)) {
return $this->configCache[$baseConfigId];
}

$criteria = new Criteria([$baseConfigId]);

$baseConfig = $this->documentBaseConfigRepository->search($criteria, $context)->first();

$config = $baseConfig?->getConfig();
$this->configCache[$baseConfigId] = $config;

return $config;
}

public function reset(): void
{
$this->cache = [];
$this->configCache = [];
}
}
4 changes: 2 additions & 2 deletions src/Migration/Media/Processor/HttpDownloadServiceBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
use SwagMigrationAssistant\Migration\Media\MediaFileProcessorInterface;
use SwagMigrationAssistant\Migration\Media\MediaProcessWorkloadStruct;
use SwagMigrationAssistant\Migration\Media\SwagMigrationMediaFileCollection;
use SwagMigrationAssistant\Migration\MessageQueue\Handler\ProcessMediaHandler;
use SwagMigrationAssistant\Migration\MessageQueue\Handler\Processor\MediaProcessingProcessor;
use SwagMigrationAssistant\Migration\MigrationContextInterface;

/**
Expand Down Expand Up @@ -120,7 +120,7 @@ function (MediaProcessWorkloadStruct $work) use ($uuid) {
$work->setAdditionalData($additionalData);
$work->setErrorCount($work->getErrorCount() + 1);

if ($work->getErrorCount() > ProcessMediaHandler::MEDIA_ERROR_THRESHOLD) {
if ($work->getErrorCount() > MediaProcessingProcessor::MEDIA_ERROR_THRESHOLD) {
$failureUuids[] = $uuid;
$work->setState(MediaProcessWorkloadStruct::ERROR_STATE);

Expand Down
Loading
Loading