Я использую Логическое расширение поведения для регистрации изменений в моих сущностях. Я хочу также вносить изменения в отношения manyToMany. Я хочу показать пользователю такой журнал изменений:
+--------------------------------------------------+
| Article "My Article" change log: |
+-------+------------+-----------------------------+
| Who | When | What |
+-------+------------+-----------------------------+
| Admin | 2015-07-01 | Removed tags "tag1", "tag2" |
| Admin | 2015-07-01 | Added tags "tag3" |
+-------+------------+-----------------------------+
Проблема с событием
Думаю, Doctrine не срабатывает при изменении отношения manyToMany, поэтому Loggable (прослушивание доктрин) не сохраняет запись в журнале. Я могу обойти это, создав свою собственную таблицу ManyToMany, но вот вторая проблема:
Собственная проблема ManyToMany
Когда я создаю объект, представляющий отношение manyToMany без аннотации @JoinTable, я не знаю, как написать новый объект, чтобы вести себя как старый JoinTable. Я не хочу разорвать БК. Не могли бы вы дать мне понять, как это делает Доктрина?
Есть ли у вас рекомендации, как регистрировать изменения в отношениях manyToMany?