缺少属性:类中的祖先 - Sylius \ Bundle \ TaxonomiesBundle \ Model \ Taxon

时间:2013-11-27 19:43:52

标签: symfony doctrine-orm bundle sylius

我正在尝试安装sylius / taxonomies-bundle但我在更新架构时遇到此错误:

php app / console doctrine:schema:update --force

[Gedmo \异常\ InvalidMappingException]
  缺少属性:类中的祖先 - Sylius \ Bundle \ TaxonomiesBundle \ Model \ Taxon

appKernel.php

new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),

new Sylius\Bundle\TaxonomiesBundle\SyliusTaxonomiesBundle(),
new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
new Sylius\Bundle\TaxationBundle\SyliusTaxationBundle(),

new JMS\AopBundle\JMSAopBundle(),
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
new JMS\DiExtraBundle\JMSDiExtraBundle($this),
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
new Genemu\Bundle\FormBundle\GenemuFormBundle(),
new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),

new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),

new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle($this),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),

config.yml

sylius_taxonomies:
    driver: doctrine/orm # The driver used for persistence layer.
    classes:
        taxonomy:
            model: Sylius\Bundle\TaxonomiesBundle\Model\Taxonomy
        taxon:
            model: Sylius\Bundle\TaxonomiesBundle\Model\Taxon

    validation_groups:
        taxonomy: [sylius] # Taxonomy validation groups.
        taxon: [sylius] # Taxon validation groups.

sylius_taxation:
    driver: doctrine/orm

stof_doctrine_extensions:
    default_locale: %locale%
    orm:
        default:
            tree: true
            sluggable: true
            timestampable: true
            softdeleteable: true

的routing.yml

sylius_taxonomies:
    resource: @SyliusTaxonomiesBundle/Resources/config/routing.yml
    prefix: /taxonomies

composer.json

"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.3.*",
    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "1.2.*@dev",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.3.*",
    "symfony/swiftmailer-bundle": "2.3.*",
    "symfony/monolog-bundle": "2.3.*",
    "sensio/distribution-bundle": "2.3.*",
    "sensio/framework-extra-bundle": "2.3.*",
    "sensio/generator-bundle": "2.3.*",
    "incenteev/composer-parameter-handler": "~2.0",
    "jms/security-extra-bundle": "1.5.*@dev",
    "friendsofsymfony/jsrouting-bundle": "~1.1",
    "genemu/form-bundle": "2.2.*",
    "knplabs/knp-paginator-bundle": "dev-master",
    "stof/doctrine-extensions-bundle": "1.1.*@dev",
    "sylius/resource-bundle": "1.0.*@dev",
    "sylius/taxation-bundle": "1.0.*@dev",
    "sylius/taxonomies-bundle": "1.0.*@dev"
},

1 个答案:

答案 0 :(得分:3)

捆绑包的安装指南没有提及,但配置参考确实如此。我必须像这样配置它。

sylius_taxonomies:
    driver: doctrine/orm #Configure the doctrine orm driver used in documentation.
    classes:
        taxonomy:
            model: Sylius\Bundle\TaxonomiesBundle\Model\Taxonomy
            form: Sylius\Bundle\TaxonomiesBundle\Form\Type\TaxonomyType
        taxon:
            model: Sylius\Bundle\TaxonomiesBundle\Model\Taxon
            form: Sylius\Bundle\TaxonomiesBundle\Form\Type\TaxonType

http://docs.sylius.org/en/latest/bundles/SyliusTaxonomiesBundle/configuration.html