Search code examples
symfonydoctrine-ormbundlesylius

Missing properties: ancestor in class - Sylius\Bundle\TaxonomiesBundle\Model\Taxon


I am trying to install sylius/taxonomies-bundle but i have this error when I update schema :

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

[Gedmo\Exception\InvalidMappingException]
Missing properties: ancestor in class - 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"
},

Solution

  • The installation guide for the bundle doesnt mention it but the configuration reference does. I had to configure it like this.

    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