PHP版本: 8.1
Shopware版本: 6.4.13
预期行为:数据迁移成功,并在后端/前端可见。
实际行为:迁移的数据似乎在后端/前端中不可见,日志中也有错误。
如何复制:在虚拟环境中的本地开发环境中,我正在尝试从带有演示数据的购物软件5.7迁移到商店软件6.4。我遵循了站点https://docs.shopware.com/en/migration-en/Migrationprocess?category=migration-en/shopware5中提到的所有说明,为此我使用了本地网关设置。
虽然移民的地位是“成功”的。在shopware 6.4的后端中看不到迁移的数据,迁移过程中的日志中也有错误。我附上了一份日志以供参考。
错误日志:
[error] SWAG_MIGRATION_RUN_EXCEPTION
An exception occurred
Entity: language, sourceId: -
SwagMigrationAssistant\Migration\Logging\Log\ExceptionRunLog::__construct(): Argument #4 ($sourceId) must be of type ?string, int given, called in /var/www/webdev/shopware56/custom/plugins/SwagMigrationAssistant/Migration/Service/MigrationDataConverter.php on line 144
[error] SWAG_MIGRATION_RUN_EXCEPTION
An exception occurred
Entity: category, sourceId: -
SwagMigrationAssistant\Profile\Shopware\Converter\ShopwareConverter::getSourceIdentifier(): Return value must be of type string, int returned
[error] SWAG_MIGRATION_RUN_EXCEPTION
An exception occurred
Entity: customer_group, sourceId: -
SwagMigrationAssistant\Profile\Shopware\Converter\ShopwareConverter::getSourceIdentifier(): Return value must be of type string, int returned
[error] SWAG_MIGRATION_RUN_EXCEPTION
An exception occurred
Entity: sales_channel, sourceId: -
SwagMigrationAssistant\Profile\Shopware\Converter\ShopwareConverter::getSourceIdentifier(): Return value must be of type string, int returned发布于 2022-08-01 07:32:57
造成问题的原因是PHP8.1在Shopware 5系统上的使用。
从PHP8.1开始,SELECT的数据在默认情况下不再以PHP字符串的形式返回,而是具有正确的数据类型,如整数或浮点数。请参阅https://www.php.net/manual/de/migration81.incompatible.php#migration81.incompatible.pdo
作为解决办法,您可以将Shopware 5中的PHP8.0降级为PHP8.0或将以下内容添加到config.php中:
...
'db' => [
'username' => '<your-credentials>',
'password' => '<your-credentials>',
'dbname' => '<your-db-name>',
'host' => '<your-host>',
'driverOptions' => [
\PDO::ATTR_STRINGIFY_FETCHES => true,
],
],
...对于Shopware 5.7.15,这将是默认设置。
https://stackoverflow.com/questions/73169064
复制相似问题