I'm looking for an appropriate way to reduce coupling in a messaging bundle I'm writing for the Symfony2 framework, so that I can easily use it between applications.
Each instance of the Message entity should have a sender and a recipient, instanceof Symfony\Component\Security\Core\User\UserInterface, which I can require just fine in the setters for the properties. However, in setting up the ORM relationships, it seems that I have to specifically set a targetEntity (Foo\BarBundle\Entity\User, for example), which means that all further uses of the Message entity in different applications will either require a code change, or shoehorn them into using a User entity, which doesn't seem to me to be in a messaging bundle's scope to require.
Any suggestions/best practices on how I can reduce coupling in this instance?
EDIT: I tried setting a global parameter with an extension and using that in the annotations, something like @ORM\ManyToOne(targetEntity="%my.entity%"), but it seems that the annotation parser doesn't convert parameters, because the string was interpreted as a literal, which failed, of course.