Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 1 addition & 1 deletion src/Core/Field/AnyJsonField.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* @internal
*/
#[Package('after-sales')]
#[Package('fundamentals@after-sales')]
class AnyJsonField extends Field implements StorageAware
{
public function __construct(
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Field/AnyJsonFieldSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* @internal
*/
#[Package('after-sales')]
#[Package('fundamentals@after-sales')]
class AnyJsonFieldSerializer extends AbstractFieldSerializer
{
public function encode(Field $field, EntityExistence $existence, KeyValuePair $data, WriteParameterBag $parameters): \Generator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* @internal
*/
#[Package('after-sales')]
#[Package('fundamentals@after-sales')]
class Migration1762346793RenameColumnOfMappingTable extends MigrationStep
{
use ColumnExistsTrait;
Expand Down
3 changes: 1 addition & 2 deletions src/DependencyInjection/entity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<tag name="shopware.entity.definition" entity="swag_migration_connection"/>
</service>

<service id="SwagMigrationAssistant\Migration\MigrationFix\SwagMigrationFixDefinition">
<service id="SwagMigrationAssistant\Migration\ErrorResolution\Entity\SwagMigrationFixDefinition">
<tag name="shopware.entity.definition" entity="swag_migration_fix"/>
</service>

Expand All @@ -56,6 +56,5 @@

<tag name="shopware.field_serializer"/>
</service>

</services>
</container>
2 changes: 1 addition & 1 deletion src/DependencyInjection/migration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
<argument type="service" id="SwagMigrationAssistant\Migration\Logging\LoggingService"/>
<argument type="service" id="SwagMigrationAssistant\Migration\Data\SwagMigrationDataDefinition"/>
<argument type="service" id="swag_migration_mapping.repository"/>
<argument type="service" id="SwagMigrationAssistant\Migration\Writer\MigrationFix\MigrationFixApplier"/>
<argument type="service" id="SwagMigrationAssistant\Migration\ErrorResolution\SwagMigrationErrorResolutionService"/>
</service>

<service id="SwagMigrationAssistant\Migration\Service\MediaFileProcessorService" public="true">
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/writer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
<tag name="shopware.migration.writer"/>
</service>

<service id="SwagMigrationAssistant\Migration\Writer\MigrationFix\MigrationFixApplier">
<service id="SwagMigrationAssistant\Migration\ErrorResolution\SwagMigrationErrorResolutionService">
<argument type="service" id="Doctrine\DBAL\Connection"/>
</service>
</services>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
* file that was distributed with this source code.
*/

namespace SwagMigrationAssistant\Migration\MigrationFix;
namespace SwagMigrationAssistant\Migration\ErrorResolution\Entity;

use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection;
use Shopware\Core\Framework\Log\Package;

/**
* @extends EntityCollection<SwagMigrationFixEntity>
*/
#[Package('after-sales')]
#[Package('fundamentals@after-sales')]
class SwagMigrationFixCollection extends EntityCollection
{
protected function getExpectedClass(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* file that was distributed with this source code.
*/

namespace SwagMigrationAssistant\Migration\MigrationFix;
namespace SwagMigrationAssistant\Migration\ErrorResolution\Entity;

use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition;
use Shopware\Core\Framework\DataAbstractionLayer\Field\CreatedAtField;
Expand All @@ -18,7 +18,7 @@
use Shopware\Core\Framework\Log\Package;
use SwagMigrationAssistant\Core\Field\AnyJsonField;

#[Package('after-sales')]
#[Package('fundamentals@after-sales')]
class SwagMigrationFixDefinition extends EntityDefinition
{
public const ENTITY_NAME = 'swag_migration_fix';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* file that was distributed with this source code.
*/

namespace SwagMigrationAssistant\Migration\MigrationFix;
namespace SwagMigrationAssistant\Migration\ErrorResolution\Entity;

use Shopware\Core\Framework\DataAbstractionLayer\Entity;
use Shopware\Core\Framework\DataAbstractionLayer\EntityIdTrait;
use Shopware\Core\Framework\Log\Package;

#[Package('after-sales')]
#[Package('fundamentals@after-sales')]
class SwagMigrationFixEntity extends Entity
{
use EntityIdTrait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
* file that was distributed with this source code.
*/

namespace SwagMigrationAssistant\Migration\Writer\MigrationFix;
namespace SwagMigrationAssistant\Migration\ErrorResolution;

use Shopware\Core\Framework\Log\Package;
use Shopware\Core\Framework\Uuid\Uuid;
use SwagMigrationAssistant\Exception\MigrationException;

#[Package('after-sales')]
class MigrationFix
#[Package('fundamentals@after-sales')]
class SwagMigrationErrorResolution
{
private const PATH_SEPARATOR = '.';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
* file that was distributed with this source code.
*/

namespace SwagMigrationAssistant\Migration\Writer\MigrationFix;
namespace SwagMigrationAssistant\Migration\ErrorResolution;

use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\Log\Package;
use Shopware\Core\Framework\Uuid\Uuid;

#[Package('after-sales')]
class MigrationFixApplier
#[Package('fundamentals@after-sales')]
class SwagMigrationErrorResolutionService
{
public function __construct(
private readonly Connection $connection,
Expand Down Expand Up @@ -46,7 +46,7 @@ public function apply(array &$data, string $connectionId, string $runId): void
/**
* @param array<int, string> $ids
*
* @return array<string, list<MigrationFix>>
* @return array<string, list<SwagMigrationErrorResolution>>
*/
private function getFixes(array $ids, string $connectionId, string $runId): array
{
Expand Down Expand Up @@ -81,7 +81,7 @@ private function getFixes(array $ids, string $connectionId, string $runId): arra
$return[$entityId] = [];
}

$return[$entityId][] = MigrationFix::fromDatabaseQuery($row);
$return[$entityId][] = SwagMigrationErrorResolution::fromDatabaseQuery($row);
}

return $return;
Expand Down
2 changes: 1 addition & 1 deletion src/Migration/Mapping/MappingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public function getMappings(string $connectionId, string $entityName, array $ids
return $this->migrationMappingRepo->search($criteria, $context);
}

public function hasValidMappingByEntityUuid(string $connectionId, string $entityName, string $entityId, Context $context): bool
public function hasValidMappingByEntityId(string $connectionId, string $entityName, string $entityId, Context $context): bool
{
$criteria = new Criteria();
$criteria->addFilter(
Expand Down
2 changes: 1 addition & 1 deletion src/Migration/Mapping/MappingServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function writeMapping(): void;
*/
public function getMappings(string $connectionId, string $entityName, array $ids, Context $context): EntitySearchResult;

public function hasValidMappingByEntityUuid(string $connectionId, string $entityName, string $entityId, Context $context): bool;
public function hasValidMappingByEntityId(string $connectionId, string $entityName, string $entityId, Context $context): bool;

public function preloadMappings(array $mappingIds, Context $context): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected function changeProgressToNextEntity(SwagMigrationRunEntity $run, Migra

if ($nextEntity === null && $run->getStep() === MigrationStep::FETCHING) {
$nextEntity = \current($dataSets);
$this->runTransitionService->transitionToRunStep($run->getId(), MigrationStep::APPLY_FIXES);
$this->runTransitionService->transitionToRunStep($run->getId(), MigrationStep::ERROR_RESOLUTION);
$progress->setProgress(0);
$progress->setTotal($this->getWriteTotal($context));
} elseif ($nextEntity === null && $run->getStep() === MigrationStep::WRITING) {
Expand Down
4 changes: 2 additions & 2 deletions src/Migration/Run/MigrationStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ enum MigrationStep: string

case FETCHING = 'fetching';

case APPLY_FIXES = 'apply-fixes';
case ERROR_RESOLUTION = 'error-resolution';

case WRITING = 'writing';

Expand Down Expand Up @@ -45,7 +45,7 @@ public function isRunning(): bool
public function needsProcessor(): bool
{
return !\in_array($this, [
self::APPLY_FIXES,
self::ERROR_RESOLUTION,
self::WAITING_FOR_APPROVE,
], true);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Migration/Run/RunService.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ public function resumeAfterFixes(Context $context): void

$runId = $run->getId();

if ($run->getStepValue() !== MigrationStep::APPLY_FIXES->value) {
throw MigrationException::migrationNotInStep($runId, MigrationStep::APPLY_FIXES->value);
if ($run->getStepValue() !== MigrationStep::ERROR_RESOLUTION->value) {
throw MigrationException::migrationNotInStep($runId, MigrationStep::ERROR_RESOLUTION->value);
}

$this->runTransitionService->transitionToRunStep($runId, MigrationStep::WRITING);
Expand Down
4 changes: 2 additions & 2 deletions src/Migration/Run/RunServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ interface RunServiceInterface
* If no migration run is running, it returns the progress with the step status IDLE.
*
* After starting the migration run, the steps are as follows, if the migration run is not aborted:
* IDLE -> FETCHING -> APPLY_FIXES -> WRITING -> MEDIA_PROCESSING -> CLEANUP -> INDEXING -> WAITING_FOR_APPROVE -> IDLE
* IDLE -> FETCHING -> ERROR_RESOLUTION -> WRITING -> MEDIA_PROCESSING -> CLEANUP -> INDEXING -> WAITING_FOR_APPROVE -> IDLE
*
* If the migration run is aborted, the steps are as follows:
* IDLE -> [FETCHING || APPLY_FIXES || WRITING || MEDIA_PROCESSING] -> ABORTING -> CLEANUP -> INDEXING -> IDLE
* IDLE -> [FETCHING || ERROR_RESOLUTION || WRITING || MEDIA_PROCESSING] -> ABORTING -> CLEANUP -> INDEXING -> IDLE
*/
public function getRunStatus(Context $context): MigrationState;

Expand Down
6 changes: 3 additions & 3 deletions src/Migration/Service/MigrationDataWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
use SwagMigrationAssistant\Exception\WriterNotFoundException;
use SwagMigrationAssistant\Migration\Data\SwagMigrationDataCollection;
use SwagMigrationAssistant\Migration\Data\SwagMigrationDataEntity;
use SwagMigrationAssistant\Migration\ErrorResolution\SwagMigrationErrorResolutionService;
use SwagMigrationAssistant\Migration\Logging\Log\Builder\SwagMigrationLogBuilder;
use SwagMigrationAssistant\Migration\Logging\Log\ExceptionRunLog;
use SwagMigrationAssistant\Migration\Logging\Log\WriteExceptionRunLog;
use SwagMigrationAssistant\Migration\Logging\LoggingServiceInterface;
use SwagMigrationAssistant\Migration\Mapping\SwagMigrationMappingCollection;
use SwagMigrationAssistant\Migration\Media\MediaFileServiceInterface;
use SwagMigrationAssistant\Migration\MigrationContextInterface;
use SwagMigrationAssistant\Migration\Writer\MigrationFix\MigrationFixApplier;
use SwagMigrationAssistant\Migration\Writer\WriterRegistryInterface;

#[Package('fundamentals@after-sales')]
Expand All @@ -49,7 +49,7 @@ public function __construct(
private readonly LoggingServiceInterface $loggingService,
private readonly EntityDefinition $dataDefinition,
private readonly EntityRepository $mappingRepo,
private readonly MigrationFixApplier $fixApplier,
private readonly SwagMigrationErrorResolutionService $errorResolutionService,
) {
// write / upsert entities only with this single context,
// otherwise the migration behaves differently when started in the administration
Expand Down Expand Up @@ -106,7 +106,7 @@ public function writeData(MigrationContextInterface $migrationContext, Context $
}

$convertedValues = array_values($converted);
$this->fixApplier->apply($convertedValues, $migrationContext->getConnection()->getId(), $migrationContext->getRunUuid());
$this->errorResolutionService->apply($convertedValues, $migrationContext->getConnection()->getId(), $migrationContext->getRunUuid());

try {
$currentWriter = $this->writerRegistry->getWriter($dataSet::getEntity());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private function validateAssociations(SwagMigrationValidationContext $validation
throw MigrationException::unexpectedNullValue($fkFieldName);
}

$hasMapping = $this->mappingService->hasValidMappingByEntityUuid(
$hasMapping = $this->mappingService->hasValidMappingByEntityId(
$validationContext->getMigrationContext()->getConnection()->getId(),
$referenceEntity,
$fkValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const MIGRATION_API_SERVICE = 'migrationApiService';
export const MIGRATION_STEP = {
IDLE: 'idle',
FETCHING: 'fetching',
APPLY_FIXES: 'apply-fixes',
ERROR_RESOLUTION: 'error-resolution',
WRITING: 'writing',
MEDIA_PROCESSING: 'media-processing',
CLEANUP: 'cleanup',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const MIGRATION_STATE_POLLING_INTERVAL = 1000 as const; // 1 second
const MIGRATION_STEP_DISPLAY_INDEX = {
[MIGRATION_STEP.IDLE]: 0,
[MIGRATION_STEP.FETCHING]: 0,
[MIGRATION_STEP.APPLY_FIXES]: 1,
[MIGRATION_STEP.ERROR_RESOLUTION]: 1,
[MIGRATION_STEP.WRITING]: 2,
[MIGRATION_STEP.MEDIA_PROCESSING]: 3,
[MIGRATION_STEP.ABORTING]: 4,
Expand All @@ -24,7 +24,7 @@ const MIGRATION_STEP_DISPLAY_INDEX = {

const UI_COMPONENT_INDEX = {
LOADING_SCREEN: 0,
APPLY_FIXES: 1,
ERROR_RESOLUTION: 1,
RESULT_SUCCESS: 2,
} as const;

Expand Down Expand Up @@ -216,8 +216,8 @@ export default Shopware.Component.wrapComponentConfig({
) {
this.componentIndex = UI_COMPONENT_INDEX.LOADING_SCREEN;
this.flowChartItemIndex = MIGRATION_STEP_DISPLAY_INDEX[state.step];
} else if (state.step === MIGRATION_STEP.APPLY_FIXES) {
this.componentIndex = UI_COMPONENT_INDEX.APPLY_FIXES;
} else if (state.step === MIGRATION_STEP.ERROR_RESOLUTION) {
this.componentIndex = UI_COMPONENT_INDEX.ERROR_RESOLUTION;
this.flowChartItemIndex = MIGRATION_STEP_DISPLAY_INDEX[state.step];
} else if (state.step === MIGRATION_STEP.WAITING_FOR_APPROVE || state.step === MIGRATION_STEP.IDLE) {
this.componentIndex = UI_COMPONENT_INDEX.RESULT_SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
{% endblock %}

{% block swag_migration_index_main_page_card_applyFixes %}
<div v-if="componentIndex === UI_COMPONENT_INDEX.APPLY_FIXES">
<div v-if="componentIndex === UI_COMPONENT_INDEX.ERROR_RESOLUTION">
<swag-migration-apply-fixes/>
</div>
{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/app/administration/src/type/global.types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @sw-package after-sales
* @sw-package fundamentals@after-sales
*/
import type { SubContainer } from '@administration/src/global.types';
import type { MigrationStore } from '../module/swag-migration/store/migration.store';
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/app/administration/src/type/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @sw-package after-sales
* @sw-package fundamentals@after-sales
* @private
*/
import type Repository from 'shopware-administration/src/core/data/repository.data';
Expand All @@ -16,7 +16,7 @@ type TRepository<T> = Repository<T>;
type MigrationStep =
| 'idle'
| 'fetching'
| 'apply-fixes'
| 'error-resolution'
| 'writing'
| 'media-processing'
| 'cleanup'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* @internal
*/
#[Package('after-sales')]
#[Package('fundamentals@after-sales')]
class Migration1762346793RenameColumnOfMappingTableTest extends TestCase
{
use TableHelperTrait;
Expand Down
2 changes: 1 addition & 1 deletion tests/Migration/Controller/StatusControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ public function testResumeMigration(): void
[
[
'id' => $this->runUuid,
'step' => MigrationStep::APPLY_FIXES->value,
'step' => MigrationStep::ERROR_RESOLUTION->value,
],
],
$this->context
Expand Down
4 changes: 2 additions & 2 deletions tests/Migration/Services/MigrationDataWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
use SwagMigrationAssistant\Migration\Data\SwagMigrationDataEntity;
use SwagMigrationAssistant\Migration\DataSelection\DataSelectionRegistry;
use SwagMigrationAssistant\Migration\DataSelection\DefaultEntities;
use SwagMigrationAssistant\Migration\ErrorResolution\SwagMigrationErrorResolutionService;
use SwagMigrationAssistant\Migration\Gateway\GatewayRegistry;
use SwagMigrationAssistant\Migration\Gateway\Reader\ReaderRegistry;
use SwagMigrationAssistant\Migration\Logging\LoggingService;
Expand All @@ -74,7 +75,6 @@
use SwagMigrationAssistant\Migration\Service\PremappingService;
use SwagMigrationAssistant\Migration\Setting\GeneralSettingCollection;
use SwagMigrationAssistant\Migration\Writer\CustomerWriter;
use SwagMigrationAssistant\Migration\Writer\MigrationFix\MigrationFixApplier;
use SwagMigrationAssistant\Migration\Writer\ProductWriter;
use SwagMigrationAssistant\Migration\Writer\WriterRegistry;
use SwagMigrationAssistant\Profile\Shopware\DataSelection\DataSet\CategoryDataSet;
Expand Down Expand Up @@ -295,7 +295,7 @@ public function initServices(): void
$this->loggingService,
static::getContainer()->get(SwagMigrationDataDefinition::class),
$mappingRepo,
static::getContainer()->get(MigrationFixApplier::class)
static::getContainer()->get(SwagMigrationErrorResolutionService::class)
);

$migrationContextFactoryMock = $this->createMock(MigrationContextFactory::class);
Expand Down
Loading
Loading