Closed kbond closed 5 years ago
@kbond Do you have an observer on the Page model and the Product model? Because then in your second example the expected behavior is that it calls an observer method three times, two times in the parent observer and one in the child, per https://github.com/tightenco/parental/blob/master/tests/Features/ParentsObserveChildrenTest.php#L15
No observers at all. Just static::created(function () {})
in Page::boot()
@kbond ah yep, I'm seeing the same thing you're describing. Looks like it's only an issue when registering observer events in boot
I added a PR with a failing test (#40) to better demonstrate the problem.
Should be fixed in the aforementioned PR
When registering an event in a parent's boot method. It is triggered twice if the parent was booted first in the same process.
For instance, with a
Page
model that has aProduct
child and acreated
event registered inPage::boot()
:(another process)
I believe this was introduced in #26.