You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using the replicating event on models for some time now, but I recently had to extend the logic and do some work when a model gets replicated.
Much to my surprise, turns out the replicated model gets passed to the event, not the model that's, well, being replicated.
Is it confusing to anyone else?
For reference, this is the PR that added the event:
The event is fired from the new, replicated instance, instead of the original model which is actually the one being replicated. The name replicating is confusing as one would assume the model that actually gets replicated would fire the event.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hey all,
I've been using the
replicating
event on models for some time now, but I recently had to extend the logic and do some work when a model gets replicated.Much to my surprise, turns out the replicated model gets passed to the event, not the model that's, well, being replicated.
Is it confusing to anyone else?
For reference, this is the PR that added the event:
https://github.com/laravel/framework/pull/28077/files
As you can see here:
https://github.com/laravel/framework/pull/28077/files#diff-9a5c2ebd8e090a8b2bffdd26cd58bbfddf07f39f98beaf89f7c9bd454ab187acR1179
The event is fired from the new, replicated instance, instead of the original model which is actually the one being replicated. The name
replicating
is confusing as one would assume the model that actually gets replicated would fire the event.Ideas?
Beta Was this translation helpful? Give feedback.
All reactions