ORO 从 3.1.19 迁移到 4.1.2

ORO MIgration from 3.1.19 to 4.1.2

我们正在从 ORO 3.1.19 迁移到 4.1.2,我们遇到了迁移问题。

$ php bin/console --env=prod oro:migration:load --force --show-queries
Process migrations...
  > Oro\Bundle\EntityExtendBundle\Migration\LoadEntityConfigStateMigration
  > Oro\Bundle\MigrationBundle\Migration\UpdateBundleVersionMigration
  > Oro\Bundle\EntityExtendBundle\Migration\RefreshExtendCacheMigration

    Prepare entity config
    Clear extended entity cache
    Dump the configuration of extended entities to the cache
    Clear entity metadata cache
    Warm   up entity metadata cache

    In RuntimeReflectionService.php line 63:

    Property Oro\Bundle\AttachmentBundle\Entity\Attachment::$account_8d93c122 does not exist

我们尝试清除缓存、实体配置缓存但没有成功

 php bin/console --env=prod oro:entity-config:cache:clear
 php bin/console --env=prod oro:entity-config:cache:warmup

如有任何帮助或反馈,我们将不胜感激。

谢谢

编辑

我们可以看到 Attachment::$account_8d93c122 在初始容器创建期间被反射找到,但在实体缓存预热期间没有找到

当实体元数据未准备好时,请确保您没有使用 doctrine ORM 服务(@doctrine、@entity_manager 等)。

通常,在编译器传递或迁移中使用 ORM 时会出现该错误。

solution/workaround 是 运行 oro:entity-extend:cache:check 缓存清除前

class RefreshExtendCacheMigrationQuery {
// ....
    public function execute(LoggerInterface $logger)
    {
        $this->commandExecutor->runCommand(
            'oro:entity-extend:cache:check',
            [],
            $logger
        );

        $this->commandExecutor->runCommand(
            'oro:entity-extend:cache:clear',
            [],
            $logger
        );
    }
}