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
3 changes: 3 additions & 0 deletions src/DependencyInjection/migration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,9 @@
<argument type="service" id="Symfony\Component\EventDispatcher\EventDispatcherInterface"/>
<argument type="service" id="SwagMigrationAssistant\Migration\Logging\LoggingService"/>
<argument type="service" id="SwagMigrationAssistant\Migration\Mapping\MappingService"/>
<argument type="service" id="Doctrine\DBAL\Connection"/>

<tag name="kernel.reset" method="reset"/>
</service>
</services>
</container>
2 changes: 1 addition & 1 deletion src/Exception/MigrationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class MigrationException extends HttpException

final public const INVALID_ID = 'SWAG_MIGRATION__INVALID_ID';

public const DUPLICATE_SOURCE_CONNECTION = 'SWAG_MIGRATION__DUPLICATE_SOURCE_CONNECTION';
final public const DUPLICATE_SOURCE_CONNECTION = 'SWAG_MIGRATION__DUPLICATE_SOURCE_CONNECTION';

public static function associationEntityRequiredMissing(string $entity, string $missingEntity): self
{
Expand Down
9 changes: 9 additions & 0 deletions src/Migration/Mapping/MappingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,15 @@ public function getMappings(string $connectionId, string $entityName, array $ids

public function hasValidMappingByEntityId(string $connectionId, string $entityName, string $entityId, Context $context): bool
{
// check in write array first to avoid unnecessary db calls and find not yet written mappings
foreach ($this->writeArray as $writeMapping) {
if ($writeMapping['connectionId'] !== $connectionId || $writeMapping['entityId'] !== $entityId) {
continue;
}

return $writeMapping['oldIdentifier'] !== null;
}

$criteria = new Criteria();
$criteria->addFilter(
new EqualsFilter('connectionId', $connectionId),
Expand Down
1 change: 1 addition & 0 deletions src/Migration/Service/MediaFileProcessorService.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ private function getMediaFiles(MigrationContextInterface $migrationContext): arr
->from('swag_migration_media_file')
->where('run_id = :runId')
->andWhere('written = 1')
->andWhere('processed = 0')
->orderBy('entity, file_size')
->setFirstResult($migrationContext->getOffset())
->setMaxResults($migrationContext->getLimit())
Expand Down
5 changes: 3 additions & 2 deletions src/Migration/Service/MigrationDataWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function writeData(MigrationContextInterface $migrationContext, Context $
$criteria->addFilter(new EqualsFilter('entity', $dataSet::getEntity()));
$criteria->addFilter(new EqualsFilter('runId', $migrationContext->getRunUuid()));
$criteria->addFilter(new EqualsFilter('convertFailure', false));
$criteria->addFilter(new EqualsFilter('written', false));
$criteria->setOffset($migrationContext->getOffset());
$criteria->setLimit($migrationContext->getLimit());
$criteria->addSorting(new FieldSorting('autoIncrement', FieldSorting::ASCENDING));
Expand Down Expand Up @@ -133,7 +134,7 @@ public function writeData(MigrationContextInterface $migrationContext, Context $
}
unset($data);

return $migrationData->getTotal();
return $migrationData->count();
} catch (WriteException $exception) {
$this->handleWriteException(
$exception,
Expand Down Expand Up @@ -165,7 +166,7 @@ public function writeData(MigrationContextInterface $migrationContext, Context $
$context
);

return $migrationData->getTotal();
return $migrationData->count();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{
public function isUserFixable(): bool
{
return true;
return false;
}

public function getLevel(): string
Expand Down
Loading
Loading