My example application has two bundles, AcmeAuthenticationBundle
and AcmePhonelistbundle
.
In AcmeAuthenticationBundle
I created a user entity which I need for authentication (obviously) that has some user specific attributes (like surname, givename, etc.). In AcmePhonelistBundle
I want to generate a phonelist based on that user entity.
For this purpose I created a service that gets the doctrine entity manager and the user class (in doctrine shorthand form) injected (defined in services.yml):
parameters:
acme_phonelist.user.class: AcmeAuthenticationBundle:User
services:
acme_phonelist.factory:
class: Acme\PhonelistBundle\Factory\PhonelistFactory
arguments:
em: "@doctrine.orm.entity_manager"
userClass: "%acme_phonelist.user.class%"
I couldn't come up with a different/better solution to keep those bundles decoupled. Is this a proper/sane way for this use case or did I overlook something? Any suggestions for improvement?