stof / StofDoctrineExtensionsBundle

Integration bundle for DoctrineExtensions by l3pp4rd in Symfony
https://symfony.com/bundles/StofDoctrineExtensionsBundle/current/index.html
MIT License
1.89k stars 379 forks source link

InvalidConfigurationException: Unrecognized options "auto_mapping" under "doctrine.orm" #141

Closed Ziiweb closed 12 years ago

Ziiweb commented 12 years ago

Hi,

after following the instructions to install this bundle, Im getting this error:

InvalidConfigurationException: Unrecognized options "auto_mapping" under "doctrine.orm"

I found other issues related to this problem but i did not find a solution..

This is my config.yml:


doctrine:
    orm:
        auto_generate_proxy_classes: %kernel.debug%
        auto_mapping: true
        entity_managers:
            default:
                mappings:
                    StofDoctrineExtensionsBundle: ~
and this below is my composer.phar:

{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },  
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.1._",
        "doctrine/orm": "2.2._",
        "doctrine/doctrine-bundle": "dev-master",
        "twig/extensions": "dev-master",
        "symfony/assetic-bundle": "dev-master",
        "symfony/swiftmailer-bundle": "dev-master",
        "symfony/monolog-bundle": "dev-master",
        "sensio/distribution-bundle": "dev-master",
        "sensio/framework-extra-bundle": "dev-master",
        "sensio/generator-bundle": "dev-master",
        "jms/security-extra-bundle": "1.1._",
        "jms/di-extra-bundle": "1.0._",
        "gedmo/doctrine-extensions": "dev-master",
        "friendsofsymfony/user-bundle": "_",
        "stof/doctrine-extensions-bundle": "dev-master",
        "knplabs/knp-menu-bundle" : "1.1._",
        "knplabs/knp-menu" : "1.1.*",
        "sonata-project/exporter" : "dev-master",
        "sonata-project/jquery-bundle" : "dev-master",
        "sonata-project/block-bundle" : "dev-master",
        "sonata-project/cache-bundle" : "dev-master",
        "sonata-project/admin-bundle" : "dev-master",
        "sonata-project/user-bundle" : "dev-master",
        "sonata-project/doctrine-orm-admin-bundle" : "dev-master"
Javi
stof commented 12 years ago

you are mixing the short syntax and the complete syntax for the ORM config. You should choose one of them only.

short syntax:

doctrine:
    orm:
        auto_generate_proxy_classes: %kernel.debug%
        auto_mapping: true
        mappings:
            StofDoctrineExtensionsBundle: ~

expanded syntax:

doctrine:
    orm:
        auto_generate_proxy_classes: %kernel.debug%
        entity_managers:
            default:
                auto_mapping: true
                mappings:
                    StofDoctrineExtensionsBundle: ~

And btw, your config for the mapping is wrong. There is no entity in the bundle at all (and they would be catched by the auto_mapping otherwise anyway). What needs to be mapped are the entities of the extensions. See the related documentation

luisansal commented 11 years ago

Thank you, i didn't know that expanded syntax!!!, good man!

ureimers commented 11 years ago

Didn't know of the short <> complete syntax discrepancy either. Thank you!

ajaypatelbardoli commented 10 years ago

Thanks for the solution though i have not asked this questions but i have also faced this questions :)

matheo commented 10 years ago

I have a quick related question: While using multiple entity managers, a config like this:

entity_managers:
    default:
        connection: connection_1
        auto_mapping: true
    second_em:
        connection: connection_2
        mappings:
            FooBarBundle: ~

will allow FooBarBundle to be in the connection_2 while the others Bundles in the app will be mapped by the default entity manager with connection_1? TIA

fundup commented 9 years ago

Using this config and SYmfony 2.7

orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        naming_strategy: doctrine.orm.naming_strategy.underscore
        auto_mapping: true
        dql:
            datetime_functions:
                month: DoctrineExtensions\Query\Mysql\Month
                year: DoctrineExtensions\Query\Mysql\Year

I have an error : Attempted to load class "Month" from namespace "DoctrineExtensions\Query\Mysql". Did you forget a "use" statement for another namespace?

I tried to add a use statement in my reposotory... If anyone as an idea ?

BigWenceslas commented 4 years ago

Same issue... I have an error : Attempted to load class "Month" from namespace "DoctrineExtensions\Query\Mysql". Did you forget a "use" statement for another namespace?

stof commented 4 years ago

@BigWenceslas These classes don't belong to this bundle, nor to the Gedmo extensions. So this is the wrong place to report this.