CartMigrateCommand example

$context = $this->getSalesChannelContext($redisCart->getToken());

        $factory = new RedisConnectionFactory('test-prefix-');
        $redis = $factory->create((string) $url);
        static::assertInstanceOf(\Redis::class$redis);
        $redis->flushAll();

        $persister = new RedisCartPersister($redis$this->getContainer()->get('event_dispatcher')$this->getContainer()->get(CartSerializationCleaner::class), false, 90);
        $persister->save($redisCart$context);

        $command = new CartMigrateCommand($redis$this->getContainer()->get(Connection::class), false, 90, $factory);
        $command->run(new ArrayInput(['from' => 'redis'])new NullOutput());

        $persister = new CartPersister(
            $this->getContainer()->get(Connection::class),
            $this->getContainer()->get('event_dispatcher'),
            $this->getContainer()->get(CartSerializationCleaner::class),
            false
        );

        $persister->load($redisCart->getToken()$context);
    }

    
Home | Imprint | This part of the site doesn't use cookies.