本文介绍了Sylius 产品捆绑配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 Sylius Product Bundle 集成到我现有的 Symfony 项目中.它已经配置了学说.

I'm trying to integrate Sylius Product Bundle into my existing Symfony project. It already has doctrine configured.

这是我得到的错误:

[SymfonyComponentConfigDefinitionExceptionInvalidConfigurationException]
  The child node "driver" at path "sylius_attribute" must be configured.

知道是什么原因造成的吗?我立即按照说明进行操作,没有进行任何其他 sylius 安装.

Any idea what's causing this? I followed the instruction right off the bat without doing any other installations of sylius.

http://docs.sylius.org/en/latest/bundles/SyliusProductBundle/installation.html

我必须在我的 composer.json 文件中更改学说捆绑版本以允许

I had to change the doctrine-bundle version in my composer.json file to allow the

作曲家需要sylius/product-bundle"

成功运行而没有错误.我将版本从 1.2.* 更改为

to run successfully without errors. I changed the version from 1.2.* to

教义/教义捆绑":1.3.*"

在 composer 安装这些家伙之后,我将以下内容添加到我的 config.yml 文件中

Also after composer installed these guys, i added the following to my config.yml file

sylius_product:
    driver: doctrine/orm
    classes:
        product:
            model: SyliusBundleCoreBundleModelProduct
            controller: SyliusBundleCoreBundleControllerProductController
            repository: SyliusBundleCoreBundleRepositoryProductRepository

stof_doctrine_extensions:
    default_locale: es_us
    translation_fallback: true
    orm:
        default:
            tree: true

最初我收到以下错误:

[Exception]
  Missing parameter sylius.translation.default.mapping. Default translation mapping must be defined!

经过一番搜索,我将以下内容添加到 config.yml 文件中

After a little searching around I added the piece below to the config.yml file

sylius_translation:
    default_mapping:
        translatable:
            field: translations
            currentLocale: currentLocale
            fallbackLocale: fallbackLocale
        translation:
            field: translatable
            locale: locale

之前在我的 config.yml 文件中已经存在的是:

Already existing earlier in my config.yml file was:

doctrine:
    dbal:
        driver:   "%database_driver%"
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        auto_mapping: true

我没有更改这些设置中的任何内容.

I didn't change anything in these settings.

我在这里做错了什么或错过了什么?任何帮助将不胜感激.

What am i doing wrong here or missing? ANy help will be greatly appreciated.

谢谢!

编辑

我尝试添加以下所有项目:

I tried adding all the below items:

sylius_attribute:
    driver: doctrine/orm
sylius_variation:
    driver: doctrine/orm
sylius_archetype:
    driver: doctrine/orm

现在我收到以下错误:

[InvalidArgumentException]
  The class sylius.model.product_archetype.class does not exist.

我将相应的文件添加到 AppKernel 中仍然没有成功!

I added the corresponding file to the AppKernel with still no luck!

new SyliusBundleAttributeBundleSyliusArchetypeBundle(),

然后改成:

new SyliusBundleArchetypeBundleSyliusArchetypeBundle(),

到目前为止,设置 Sylius 的压力很大:(

Setting up Sylius has been quiet stressful so far :(

推荐答案

你遵循的教程中没有提到,但我认为它会对你有所帮助:

It wasn't mention on the tutorial you followed but I think it will help you :

https://github.com/Sylius/Sylius-Docs/blob/master/bundles/SyliusAttributeBundle/installation.rst#container-configuration

这篇关于Sylius 产品捆绑配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 10:15