1

I'm trying to set a different entity listener resolver because I want to use a couple of services among a few lifecycle callbacks. I googled out some answers that say it should be set in config the way similar to this one:

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
        entity_listener_resolver: {HERE!}

However, when I do it this way, I get the following error:

Unrecognized options "entity_listener_resolver" under "doctrine.orm.entity_    
  managers.default"

Moreover, when I look at the configuration reference, I don't see such option anywhere or an option to set it: http://symfony.com/doc/current/reference/configuration/doctrine.html

So how do I change the entity listener resolver?

I'm using the newest Sf 2.5 version.

user294034
  • 323
  • 1
  • 2
  • 9

2 Answers2

1

I'm running into the same issue, when using "doctrine/doctrine-bundle": "~1.2".

You have two options.

1) Use doctrine/doctrine-bundle 1.3 Beta, where the key entity_listener_resolver exists.

2) Or use the following gist to get it working without using the key: https://gist.github.com/vadim2404/9538227

More infos: http://egeloen.fr/2013/12/01/symfony2-doctrine2-entity-listener-as-serice/

Thx to the guy from the irc channel.

millejano
  • 11
  • 1
  • Summarize the content on the linked page. Simply linking to the documentation does not make for a good answer as the page may fail to load in the future or may have different content. –  Aug 19 '14 at 12:01
  • Hint for 1) http://stackoverflow.com/questions/22114239/how-to-use-doctrine-entity-listener-with-symfony-2-4 – millejano Aug 19 '14 at 13:03
0

You can use it like this only in the services.yml for a specific bundle:

    orm:
        entity_listener_resolver: {your_entity_listener_resolver}

But in the config.yml file you need to set the entity listener resolver for a specific entity manager for example the default one:

    orm:
    entity_managers:
        default:
            entity_listener_resolver: {your_entity_listener_resolver}