I want to add a new Doctrine entity with relation to OroCRM’s “Contact” entity.
For instance, I have a new entity class called “Activity”. This is a “Regular Entity” written in PHP class.
Now, I want to set up a relationship so that a “Contact” can have many “Activities”.
Being a developer with Symfony2 & Doctrine background, I know that this can be done by:
adding the @ManyToOne annotation to the $contact field of the “Activity” class, and
add a new field $activities to the “Contact” entity class, and add the @OneToMany annotation to it.
But now “Contact” class is a part of the OroCRM, and I’ve read that there is currently no way to extend the original “Contact” class and tell the platform to use the extended one. It seems that I need to use a migration script to add the @OneToMany annotation equivalent. And that’s where I stuck. I would like to know:
Is it possible to achieve what I want to do, i.e. setting up a bidirectional relationship to my new Regular entity and OroCRM’s Contact entity? If yes, is there any example I can refer to?
One of the reason a bidirectional relationship is preferred is that I want to be able to something like $contact->getActivities(). Is it possible via existing mean(s)?
You must be logged in to reply to this topic.