This topic contains 1 reply, has 1 voice, and was last updated by Edmund 7 years, 11 months ago.
- Topic
Hello,
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)?Thanks!
The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.