Closed akomm closed 8 years ago
Assume you use both doctrine ORM and ODB in your project.
You have subscribers: AppBundle\Subscribers\{ODM,ORM}
AppBundle\Subscribers\{ODM,ORM}
ODM subscribers need a service tag doctrine_mongodb.odm.event_subscriber ORM subscribersneed a service tag doctrine.event_subscriber
doctrine_mongodb.odm.event_subscriber
doctrine.event_subscriber
Both have same interface requirement: Doctrine\Common\EventSubscriber
Doctrine\Common\EventSubscriber
So you can not differentiate between them by interface.
What do you think is better:
create interface AppBundle\Subscriber\OrmSubscriberInterface extends Doctrine\Common\EventSubscriber and interface AppBundle\Subscriber\OdmSubscriberInterface extends Doctrine\Common\EventSubscriber then config:
interface AppBundle\Subscriber\OrmSubscriberInterface extends Doctrine\Common\EventSubscriber
interface AppBundle\Subscriber\OdmSubscriberInterface extends Doctrine\Common\EventSubscriber
dunglas_action: tags: AppBundle\Subscriber\OdmSubscriberInterface: - ''doctrine_mongodb.odm.event_subscriber" AppBundle\Subscriber\OrmSubscriberInterface: - "doctrine.event_subscriber"
or 2: An option inside the "tags" config to narrow down to a directory?
Your first solution seems better to me as this isn't usual and would complexify the bundle.
I agree with @Ener-Getick, solution 1 looks even cleaner from an OOP point of view. Closing for now.
Assume you use both doctrine ORM and ODB in your project.
You have subscribers:
AppBundle\Subscribers\{ODM,ORM}
ODM subscribers need a service tag
doctrine_mongodb.odm.event_subscriber
ORM subscribersneed a service tagdoctrine.event_subscriber
Both have same interface requirement:
Doctrine\Common\EventSubscriber
So you can not differentiate between them by interface.
What do you think is better:
create
interface AppBundle\Subscriber\OrmSubscriberInterface extends Doctrine\Common\EventSubscriber
andinterface AppBundle\Subscriber\OdmSubscriberInterface extends Doctrine\Common\EventSubscriber
then config:or 2: An option inside the "tags" config to narrow down to a directory?