I have an annotations mapping on an entity that will have an ManyToOne association of type "Person" but depending on the circumstances I want to change the type of that relation to a more specific one, for example "Student".
How can I change the relationship mapping information dynamically?
PD: Actually I want to do this as a workaround of other problem ( Not finding field in polymorphic association with Doctrine2 )
I did it like this:
$cmf = $this->em->getMetadataFactory();
$class = $cmf->getMetadataFor("Article");
$class->associationMappings["person"]["targetEntity"]="User";