1

Can model events be used in pivot models? I have a many to many relation that uses a pivot model. If I define a beforeSave() in the pivot model code, the function is not called. Should it work like this?

dragontree
  • 1,709
  • 11
  • 14
  • 1
    This is a known bug which is yet to be fixed! See this question https://stackoverflow.com/q/42740344/69537 and this issue https://github.com/octobercms/october/issues/2747 – B Faley May 22 '17 at 15:38

1 Answers1

0

pivotModel specify a custom model class to return when accessing the pivot relation. Defaults to October\Rain\Database\Pivot.

And this class doesn't contain any Events, so I think it doesn't support them.

Pavel Chernov
  • 361
  • 1
  • 6
  • The Pivot model extends the rainlab Model class where the events are defined. Therefore they should be fired – dragontree May 22 '17 at 12:33