Announcement

Collapse
No announcement yet.

Many to many relationship

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Many to many relationship

    Hi!

    I have two entities related with many to mani relationship. I need obtain a list of items of the second entity, related to a particular item of the first entity.

    For example: Account and Contact entities hava a many to many relationship. And I want obtain contacts of Account with 57bc9aa66dc8d05d7 id.

    I tried with opcions in https://github.com/espocrm/documenta...lopment/orm.md page. But I don't get it.

    Some idea? How can I do it?

    Thanks!

  • #2
    Hi
    $account = $this->getEntityManager()->getEntity('Account', '57bc9aa66dc8d05d7');
    $contactList = $this->getEntityManager()->getRepository('Account')->findRelated($account, 'contacts'); // 'contacts' - link name in account entityDefs

    Comment


    • #3
      Thanks!! It works! My mistake was in "/ 'contacts' - link name in account entityDefs". ​​​​​​​

      Comment

      Working...
      X