2

I have two models Contact and Eventthat have a many2many relationship. I need to store(save/cache) the count of each relationship when the relationship change. For example:

  • Person A has Event 1, Event2
  • Person B has Event 2

This way : Person A has 2 events, Person B has one event, Event 1 has one person, Event 2 has 2 persons.

How can I listen on changes on relationship o I can change counts on each two models (add, delete)?

I know I have to listen on delete events on Contact and Event model, so I can change counts on the other side part of the relationship

user237329
  • 809
  • 1
  • 10
  • 27

0 Answers0