如何在Sylius中从结帐中删除步骤

时间:2019-03-28 15:40:36

标签: symfony symfony4 sylius

我将sylius/sylius 1.3.9与symfony/framework-bundle 4.2.4结合使用。关于doc要从结帐中删除状态,您必须替换Sylius核心捆绑包的整个配置。

我将配置放入src/Resources/SyliusCoreBundle/config/app/state_machine/sylius_order_checkout.yml

winzou_state_machine:
    sylius_order_checkout:
        class: '%sylius.model.order.class%'
        property_path: checkoutState
        graph: sylius_order_checkout
        state_machine_class: '%sylius.state_machine.class%'
        states:
            cart: ~
            addressed: ~
            completed: ~
        transitions:
            address:
                from: [cart, addressed]
                to: addressed
            complete:
                from: [addressed]
                to: completed
        callbacks:
            after:
                sylius_process_cart:
                    on: [address]
                    do: ['@sylius.order_processing.order_processor', process]
                    args: [object]
                sylius_create_order:
                    on: [complete]
                    do: ['@sm.callback.cascade_transition', apply]
                    args: [object, event, create, sylius_order]
                sylius_save_checkout_completion_date:
                    on: [complete]
                    do: [object, completeCheckout]
                    args: [object]

之后,我执行:

php bin/console cache:clear -e dev
[...]
php bin/console debug:winzou:state-machine sylius_order_checkout -e dev

+--------------------+
| Configured States: |
+--------------------+
| cart               |
| addressed          |
| shipping_selected  |
| shipping_skipped   |
| payment_skipped    |
| payment_selected   |
| completed          |
+--------------------+
[...]

什么都没有改变。当我在文档中遵循link时说:

  

在Symfony 4.0中删除了捆绑继承[...]

Symfony 4.2仍然有可能像文档中所建议的那样替换捆绑包的整个配置文件,或者这是Sylius 1.3中的回归,如果我没有做错什么,那将是一个可能的解决方案?

1 个答案:

答案 0 :(得分:0)

您可以尝试在state_machine中创建config/packages目录,将您的YAML文件放入configureContainer()方法中的这一行,并将其添加到src / Kernel中:

protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
    {
        ...
        $loader->load($confDir.'/state_machine/*'.self::CONFIG_EXTS, 'glob');
    }