Sylius 产品包配置
Sylius Product Bundle configuration
我正在尝试将 Sylius Product Bundle 集成到我现有的 Symfony 项目中。它已经配置了学说。
这是我收到的错误:
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
The child node "driver" at path "sylius_attribute" must be configured.
知道是什么原因造成的吗?我直接按照说明操作,没有安装任何其他 sylius。
http://docs.sylius.org/en/latest/bundles/SyliusProductBundle/installation.html
我必须更改 composer.json 文件中的 doctrine-bundle 版本以允许
composer require "sylius/product-bundle"
到 运行 成功,没有错误。我将版本从 1.2.* 更改为
"doctrine/doctrine-bundle": "1.3.*"
此外,在作曲家安装了这些家伙之后,我将以下内容添加到我的 config.yml 文件
sylius_product:
driver: doctrine/orm
classes:
product:
model: Sylius\Bundle\CoreBundle\Model\Product
controller: Sylius\Bundle\CoreBundle\Controller\ProductController
repository: Sylius\Bundle\CoreBundle\Repository\ProductRepository
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 文件
sylius_translation:
default_mapping:
translatable:
field: translations
currentLocale: currentLocale
fallbackLocale: fallbackLocale
translation:
field: translatable
locale: locale
我的 config.yml 文件中早先存在的是:
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
我没有更改这些设置中的任何内容。
我在这里做错了什么或遗漏了什么?任何帮助将不胜感激。
谢谢!
编辑
我尝试添加以下所有项目:
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了,还是不行!
new Sylius\Bundle\AttributeBundle\SyliusArchetypeBundle(),
然后改为:
new Sylius\Bundle\ArchetypeBundle\SyliusArchetypeBundle(),
到目前为止,设置 Sylius 一直压力山大 :(
您遵循的教程中没有提及,但我认为它会对您有所帮助:
我有 updated the docs 的 ProductBundle:
在 composer.json
中,您需要添加以下行:
"require": {
...
"sylius/locale-bundle": "0.13.*",
"sylius/product-bundle": "0.13.*"
...
}
在app/AppKernel.php
中:
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle($this),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
new Sylius\Bundle\ArchetypeBundle\SyliusArchetypeBundle(),
new Sylius\Bundle\AttributeBundle\SyliusAttributeBundle(),
new Sylius\Bundle\ProductBundle\SyliusProductBundle(),
new Sylius\Bundle\LocaleBundle\SyliusLocaleBundle(),
new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
new Sylius\Bundle\TranslationBundle\SyliusTranslationBundle(),
new Sylius\Bundle\VariationBundle\SyliusVariationBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
在config.yml
中:
parameters:
sylius.locale: "%locale%"
sylius_archetype:
classes:
product:
subject: Sylius\Component\Product\Model\Product
attribute: Sylius\Component\Product\Model\Attribute
option: Sylius\Component\Product\Model\Option
archetype:
model: Sylius\Component\Product\Model\Archetype
repository: Sylius\Bundle\ResourceBundle\Doctrine\ORM\TranslatableEntityRepository
translatable:
targetEntity: Sylius\Component\Product\Model\ArchetypeTranslation
archetype_translation:
model: Sylius\Component\Product\Model\ArchetypeTranslation
sylius_attribute:
driver: doctrine/orm
sylius_product:
driver: doctrine/orm
sylius_locale:
driver: doctrine/orm
sylius_translation:
default_mapping:
translatable:
field: translations
currentLocale: currentLocale
fallbackLocale: fallbackLocale
translation:
field: translatable
locale: locale
sylius_variation:
driver: doctrine/orm
stof_doctrine_extensions:
orm:
default:
sluggable: true
timestampable: true
现在您应该能够 运行 架构更新成功
$ php app/console doctrine:schema:update --dump-sql
如果满意,执行:
$ php app/console doctrine:schema:update --force
更新: 升级到 0.14(当前发布版本为 0.13)时,此配置将被破坏。
我正在尝试将 Sylius Product Bundle 集成到我现有的 Symfony 项目中。它已经配置了学说。
这是我收到的错误:
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
The child node "driver" at path "sylius_attribute" must be configured.
知道是什么原因造成的吗?我直接按照说明操作,没有安装任何其他 sylius。
http://docs.sylius.org/en/latest/bundles/SyliusProductBundle/installation.html
我必须更改 composer.json 文件中的 doctrine-bundle 版本以允许
composer require "sylius/product-bundle"
到 运行 成功,没有错误。我将版本从 1.2.* 更改为
"doctrine/doctrine-bundle": "1.3.*"
此外,在作曲家安装了这些家伙之后,我将以下内容添加到我的 config.yml 文件
sylius_product:
driver: doctrine/orm
classes:
product:
model: Sylius\Bundle\CoreBundle\Model\Product
controller: Sylius\Bundle\CoreBundle\Controller\ProductController
repository: Sylius\Bundle\CoreBundle\Repository\ProductRepository
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 文件
sylius_translation:
default_mapping:
translatable:
field: translations
currentLocale: currentLocale
fallbackLocale: fallbackLocale
translation:
field: translatable
locale: locale
我的 config.yml 文件中早先存在的是:
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
我没有更改这些设置中的任何内容。
我在这里做错了什么或遗漏了什么?任何帮助将不胜感激。
谢谢!
编辑
我尝试添加以下所有项目:
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了,还是不行!
new Sylius\Bundle\AttributeBundle\SyliusArchetypeBundle(),
然后改为:
new Sylius\Bundle\ArchetypeBundle\SyliusArchetypeBundle(),
到目前为止,设置 Sylius 一直压力山大 :(
您遵循的教程中没有提及,但我认为它会对您有所帮助:
我有 updated the docs 的 ProductBundle:
在 composer.json
中,您需要添加以下行:
"require": {
...
"sylius/locale-bundle": "0.13.*",
"sylius/product-bundle": "0.13.*"
...
}
在app/AppKernel.php
中:
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle($this),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
new Sylius\Bundle\ArchetypeBundle\SyliusArchetypeBundle(),
new Sylius\Bundle\AttributeBundle\SyliusAttributeBundle(),
new Sylius\Bundle\ProductBundle\SyliusProductBundle(),
new Sylius\Bundle\LocaleBundle\SyliusLocaleBundle(),
new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
new Sylius\Bundle\TranslationBundle\SyliusTranslationBundle(),
new Sylius\Bundle\VariationBundle\SyliusVariationBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
在config.yml
中:
parameters:
sylius.locale: "%locale%"
sylius_archetype:
classes:
product:
subject: Sylius\Component\Product\Model\Product
attribute: Sylius\Component\Product\Model\Attribute
option: Sylius\Component\Product\Model\Option
archetype:
model: Sylius\Component\Product\Model\Archetype
repository: Sylius\Bundle\ResourceBundle\Doctrine\ORM\TranslatableEntityRepository
translatable:
targetEntity: Sylius\Component\Product\Model\ArchetypeTranslation
archetype_translation:
model: Sylius\Component\Product\Model\ArchetypeTranslation
sylius_attribute:
driver: doctrine/orm
sylius_product:
driver: doctrine/orm
sylius_locale:
driver: doctrine/orm
sylius_translation:
default_mapping:
translatable:
field: translations
currentLocale: currentLocale
fallbackLocale: fallbackLocale
translation:
field: translatable
locale: locale
sylius_variation:
driver: doctrine/orm
stof_doctrine_extensions:
orm:
default:
sluggable: true
timestampable: true
现在您应该能够 运行 架构更新成功
$ php app/console doctrine:schema:update --dump-sql
如果满意,执行:
$ php app/console doctrine:schema:update --force
更新: 升级到 0.14(当前发布版本为 0.13)时,此配置将被破坏。