Skip to content

Doctrine entity listeners #5013

Closed
Closed
@luciantugui

Description

@luciantugui

As mentioned at the end of Creating the Listener Class paragraph from event listeners and subscribers doctrine cookbook, entity listeners are introduced in Doctrine 2.4.

An entity listener is a lifecycle listener class used for a specific entity. Entity listeners can be defined as services and the great thing is that they can have container services/parameters injected. Shouldn't this be documented? For example:

services:
    user_listener:
        class: \UserListener
        arguments: 
            - "%some_param%"
        tags:
            - { name: doctrine.orm.entity_listener }
            - { name: doctrine.orm.entity_listener, entity_manager: custom }

Entity listeners are barely mentioned here. This was ticket was opened as a suggestion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DoctrineactionableClear and specific issues ready for anyone to take them.good first issueIdeal for your first contribution! (some Symfony experience may be required)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions