Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 7 additions & 2 deletions src/Profile/Magento/Converter/CategoryConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Swag\MigrationMagento\Profile\Magento\Converter;

use Shopware\Core\Content\Category\CategoryDefinition;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\Log\Package;
use Swag\MigrationMagento\Migration\Mapping\MagentoMappingServiceInterface;
Expand Down Expand Up @@ -100,12 +101,16 @@

return new ConvertStruct(null, $data);
}
$rootCategoryMapping = $this->mappingService->getMapping($this->connectionId, MagentoDefaults::ROOT_CATEGORY, $data['parent_id'], $context);

$rootCategoryMapping = $this->mappingService->getMapping($this->connectionId, MagentoDefaults::ROOT_CATEGORY, $data['parent_id'], $context);
$fields = $this->checkForEmptyRequiredDataFields($data, self::$requiredDataFieldKeys);

if (!empty($fields)) {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($migrationContext)
->withEntityName(CategoryDefinition::ENTITY_NAME)
->withFieldSourcePath(implode(', ', $fields))
->withSourceData($data)

Check failure on line 113 in src/Profile/Magento/Converter/CategoryConverter.php

View workflow job for this annotation

GitHub Actions / PHPStan Analysis

Parameter #1 $sourceData of method SwagMigrationAssistant\Migration\Logging\Log\Builder\SwagMigrationLogBuilder::withSourceData() expects array<int, array<string, mixed>>, array<string, mixed> given.
->build(EmptyNecessaryFieldRunLog::class)
);

Expand Down
13 changes: 11 additions & 2 deletions src/Profile/Magento/Converter/CrossSellingConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Swag\MigrationMagento\Profile\Magento\Converter;

use Shopware\Core\Content\Product\Aggregate\ProductCrossSelling\ProductCrossSellingDefinition;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\Log\Package;
use Swag\MigrationMagento\Profile\Magento\DataSelection\DefaultEntities as MagentoDefaultEntities;
Expand Down Expand Up @@ -61,8 +62,12 @@
);

if ($sourceProductMapping === null) {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($migrationContext)
->withEntityName(ProductCrossSellingDefinition::ENTITY_NAME)
->withFieldSourcePath('sourceProductId')
->withSourceData($data)

Check failure on line 69 in src/Profile/Magento/Converter/CrossSellingConverter.php

View workflow job for this annotation

GitHub Actions / PHPStan Analysis

Parameter #1 $sourceData of method SwagMigrationAssistant\Migration\Logging\Log\Builder\SwagMigrationLogBuilder::withSourceData() expects array<int, array<string, mixed>>, array<string, mixed> given.
->withConvertedData($converted)

Check failure on line 70 in src/Profile/Magento/Converter/CrossSellingConverter.php

View workflow job for this annotation

GitHub Actions / PHPStan Analysis

Parameter #1 $convertedData of method SwagMigrationAssistant\Migration\Logging\Log\Builder\SwagMigrationLogBuilder::withConvertedData() expects array<int, array<string, mixed>>, array<string, string|null> given.
->build(AssociationRequiredMissingLog::class)
);

Expand All @@ -78,8 +83,12 @@
);

if ($relatedProductMapping === null) {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($migrationContext)
->withEntityName(ProductCrossSellingDefinition::ENTITY_NAME)
->withFieldSourcePath('linked_product_id')
->withSourceData($data)

Check failure on line 90 in src/Profile/Magento/Converter/CrossSellingConverter.php

View workflow job for this annotation

GitHub Actions / PHPStan Analysis

Parameter #1 $sourceData of method SwagMigrationAssistant\Migration\Logging\Log\Builder\SwagMigrationLogBuilder::withSourceData() expects array<int, array<string, mixed>>, array<string, mixed> given.
->withConvertedData($converted)

Check failure on line 91 in src/Profile/Magento/Converter/CrossSellingConverter.php

View workflow job for this annotation

GitHub Actions / PHPStan Analysis

Parameter #1 $convertedData of method SwagMigrationAssistant\Migration\Logging\Log\Builder\SwagMigrationLogBuilder::withConvertedData() expects array<int, array<string, mixed>>, array<string, string|null> given.
->build(AssociationRequiredMissingLog::class)
);

Expand Down
8 changes: 6 additions & 2 deletions src/Profile/Magento/Converter/CustomFieldConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\Log\Package;
use Shopware\Core\System\CustomField\CustomFieldDefinition;
use SwagMigrationAssistant\Migration\Converter\Converter;
use SwagMigrationAssistant\Migration\Converter\ConvertStruct;
use SwagMigrationAssistant\Migration\DataSelection\DefaultEntities;
Expand Down Expand Up @@ -63,9 +64,12 @@
);

if ($defaultLocale === null) {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($migrationContext)
->withEntityName(DefaultEntities::CUSTOM_FIELD_SET)
->withEntityName(CustomFieldDefinition::ENTITY_NAME)
->withFieldName('locale')
->withFieldSourcePath('global_default')
->withSourceData($data)

Check failure on line 72 in src/Profile/Magento/Converter/CustomFieldConverter.php

View workflow job for this annotation

GitHub Actions / PHPStan Analysis

Parameter #1 $sourceData of method SwagMigrationAssistant\Migration\Logging\Log\Builder\SwagMigrationLogBuilder::withSourceData() expects array<int, array<string, mixed>>, array<string, mixed> given.
->build(AssociationRequiredMissingLog::class)
);

Expand Down
82 changes: 69 additions & 13 deletions src/Profile/Magento/Converter/CustomerConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Swag\MigrationMagento\Profile\Magento\Converter;

use Shopware\Core\Checkout\Customer\CustomerDefinition;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\Log\Package;
use Shopware\Core\System\NumberRange\ValueGenerator\NumberRangeValueGeneratorInterface;
Expand Down Expand Up @@ -89,9 +90,13 @@
public function convert(array $data, Context $context, MigrationContextInterface $migrationContext): ConvertStruct
{
$fields = $this->checkForEmptyRequiredDataFields($data, self::$requiredDataFieldKeys);

if (!empty($fields)) {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($migrationContext)
->withEntityName(CustomerDefinition::ENTITY_NAME)
->withFieldSourcePath(implode(', ', $fields))
->withSourceData($data)

Check failure on line 99 in src/Profile/Magento/Converter/CustomerConverter.php

View workflow job for this annotation

GitHub Actions / PHPStan Analysis

Parameter #1 $sourceData of method SwagMigrationAssistant\Migration\Logging\Log\Builder\SwagMigrationLogBuilder::withSourceData() expects array<int, array<string, mixed>>, array<string, mixed> given.
->build(EmptyNecessaryFieldRunLog::class)
);

Expand Down Expand Up @@ -149,8 +154,13 @@
}

if (empty($converted['salesChannelId'])) {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($migrationContext)
->withEntityName(CustomerDefinition::ENTITY_NAME)
->withFieldName('salesChannelId')
->withFieldSourcePath('store_id')
->withSourceData($data)

Check failure on line 162 in src/Profile/Magento/Converter/CustomerConverter.php

View workflow job for this annotation

GitHub Actions / PHPStan Analysis

Parameter #1 $sourceData of method SwagMigrationAssistant\Migration\Logging\Log\Builder\SwagMigrationLogBuilder::withSourceData() expects array<int, array<string, mixed>>, array<string, mixed> given.
->withConvertedData($converted)
->build(EmptyNecessaryFieldRunLog::class)
);

Expand Down Expand Up @@ -191,8 +201,12 @@
);

if ($mapping === null) {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($migrationContext)
->withEntityName(CustomerDefinition::ENTITY_NAME)
->withFieldSourcePath('default_salutation')
->withSourceData($data)
->withConvertedData($converted)
->build(EmptyNecessaryFieldRunLog::class)
);

Expand Down Expand Up @@ -243,8 +257,12 @@
if (!isset($converted['defaultBillingAddressId'], $converted['defaultShippingAddressId'])) {
$this->mappingService->deleteMapping($converted['id'], $this->connectionId, $this->context);

$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($migrationContext)
->withEntityName(CustomerDefinition::ENTITY_NAME)
->withFieldName('default_billing_address_id, default_shipping_address_id')
->withSourceData($data)
->withConvertedData($converted)
->build(EmptyNecessaryFieldRunLog::class)
);

Expand Down Expand Up @@ -287,11 +305,15 @@
$addresses = [];
foreach ($originalData['addresses'] as $address) {
$newAddress = [];

$fields = $this->checkForEmptyRequiredDataFields($address, self::$requiredAddressDataFieldKeys);

if (!empty($fields)) {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($this->migrationContext)
->withEntityName(CustomerDefinition::ENTITY_NAME)
->withFieldSourcePath(implode(', ', $fields))
->withSourceData($address)
->withConvertedData($converted)
->build(EmptyNecessaryFieldRunLog::class)
);

Expand Down Expand Up @@ -321,9 +343,14 @@
$newAddress['customerId'] = $customerUuid;

$countryUuid = $this->countryLookup->getByIso3($address['country_iso3'], $this->context);

if ($countryUuid === null) {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($this->migrationContext)
->withEntityName(CustomerDefinition::ENTITY_NAME)
->withFieldName('countryId')
->withFieldSourcePath('country_iso3')
->withSourceData($addresses)
->build(UnknownEntityLog::class)
);

Expand Down Expand Up @@ -357,8 +384,13 @@
'countryId' => $countryUuid,
];
} else {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($this->migrationContext)
->withEntityName(CustomerDefinition::ENTITY_NAME)
->withFieldName('country')
->withFieldSourcePath('addresses.countryState')
->withSourceData($originalData)
->withConvertedData($converted)
->build(UnknownEntityLog::class)
);
}
Expand Down Expand Up @@ -398,8 +430,13 @@
$converted['defaultShippingAddressId'] = $addresses[0]['id'];
unset($originalData['default_billing_address_id'], $originalData['default_shipping_address_id']);

$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($this->migrationContext)
->withEntityName(CustomerDefinition::ENTITY_NAME)
->withFieldName('defaultBillingAddressId, defaultShippingAddressId')
->withFieldSourcePath('default_billing_address_id, default_shipping_address_id')
->withSourceData($originalData)
->withConvertedData($converted)
->build(FieldReassignedRunLog::class)
);
}
Expand All @@ -411,8 +448,13 @@
$converted['defaultShippingAddressId'] = $converted['defaultBillingAddressId'];
unset($originalData['default_shipping_address_id']);

$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($this->migrationContext)
->withEntityName(CustomerDefinition::ENTITY_NAME)
->withFieldName('defaultShippingAddressId')
->withFieldSourcePath('default_shipping_address_id')
->withSourceData($originalData)
->withConvertedData($converted)
->build(FieldReassignedRunLog::class)
);
}
Expand All @@ -424,8 +466,13 @@
$converted['defaultBillingAddressId'] = $converted['defaultShippingAddressId'];
unset($originalData['default_billing_address_id']);

$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($this->migrationContext)
->withEntityName(CustomerDefinition::ENTITY_NAME)
->withFieldName('defaultBillingAddressId')
->withFieldSourcePath('default_shipping_address_id')
->withSourceData($originalData)
->withConvertedData($converted)
->build(FieldReassignedRunLog::class)
);
}
Expand All @@ -449,8 +496,14 @@
);

if ($mapping === null) {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($this->migrationContext)
->withEntityName(CustomerDefinition::ENTITY_NAME)
->withFieldName('salutationId')
->withFieldSourcePath('default_salutation')
->withSourceData([

Check failure on line 504 in src/Profile/Magento/Converter/CustomerConverter.php

View workflow job for this annotation

GitHub Actions / PHPStan Analysis

Parameter #1 $sourceData of method SwagMigrationAssistant\Migration\Logging\Log\Builder\SwagMigrationLogBuilder::withSourceData() expects array<int, array<string, mixed>>, array<string, string> given.
'gender' => $gender,
])
->build(UnknownEntityLog::class)
);

Expand All @@ -472,8 +525,11 @@
);

if ($paymentMethodMapping === null) {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($this->migrationContext)
->withEntityName(CustomerDefinition::ENTITY_NAME)
->withFieldName('defaultPaymentMethodId')
->withFieldSourcePath('default_payment_method')
->build(UnknownEntityLog::class)
);

Expand Down
23 changes: 16 additions & 7 deletions src/Profile/Magento/Converter/NewsletterRecipientConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace Swag\MigrationMagento\Profile\Magento\Converter;

use Shopware\Core\Content\Newsletter\Aggregate\NewsletterRecipient\NewsletterRecipientDefinition;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\Log\Package;
use Shopware\Core\System\SalesChannel\SalesChannelDefinition;
use Swag\MigrationMagento\Profile\Magento\DataSelection\DefaultEntities as MagentoDefaultEntities;
use Swag\MigrationMagento\Profile\Magento19\Premapping\Magento19NewsletterRecipientStatusReader;
use SwagMigrationAssistant\Migration\Converter\ConvertStruct;
Expand Down Expand Up @@ -52,9 +52,12 @@
);

if ($languageMapping === null) {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($migrationContext)
->withEntityName(DefaultEntities::NEWSLETTER_RECIPIENT)
->withEntityName(NewsletterRecipientDefinition::ENTITY_NAME)
->withFieldName('salesChannelId')
->withFieldSourcePath('store_id')
->withSourceData($data)

Check failure on line 60 in src/Profile/Magento/Converter/NewsletterRecipientConverter.php

View workflow job for this annotation

GitHub Actions / PHPStan Analysis

Parameter #1 $sourceData of method SwagMigrationAssistant\Migration\Logging\Log\Builder\SwagMigrationLogBuilder::withSourceData() expects array<int, array<string, mixed>>, array<string, mixed> given.
->build(AssociationRequiredMissingLog::class)
);

Expand Down Expand Up @@ -129,9 +132,12 @@
);

if ($salesChannelMapping === null) {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($migrationContext)
->withEntityName(SalesChannelDefinition::ENTITY_NAME)
->withEntityName(NewsletterRecipientDefinition::ENTITY_NAME)
->withFieldName('salesChannelId')
->withFieldSourcePath('store_id')
->withSourceData($this->originalData)
->build(EmptyNecessaryFieldRunLog::class)
);
}
Expand All @@ -158,9 +164,12 @@
}

if ($status === null) {
$this->loggingService->addLogEntry( // TODO: add optional fields
$this->loggingService->addLogEntry(
SwagMigrationLogBuilder::fromMigrationContext($migrationContext)
->withEntityName('status')
->withEntityName(NewsletterRecipientDefinition::ENTITY_NAME)
->withFieldName('status')
->withFieldSourcePath('default_newsletter_recipient_status')
->withSourceData($data)
->build(EmptyNecessaryFieldRunLog::class)
);
}
Expand Down
Loading
Loading