-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix model.setAttribute event value #170
Conversation
@bennothommo any idea about the larastan error ? |
model.setAttribute
event value
@mjauvin I have no idea - it seems to be happening randomly at the moment. Retrying the test usually resolves it. |
It could just be because it's late and I should probably go to bed, but why exactly is this necessary? This feels very wrong, to be modifying the value returned from the event; why wouldn't it be the job of the listener to retrieve the accessor value if it didn't like the value as provided by this event? |
It goes to the expectation of the event - given that there's a |
But the setAttribute is dealing with the raw value of the attribute as stored in the attributes array, it's not dealing with the value as potentially mutated through an accessor method; so I'm concerned that this will break things. Why does it need to be done this way, can't the consumer of this event change what it's doing if it's having problems with that value? |
My main concern is that there's potentially a disconnect between the value that's provided to the event and the value that's actually stored in the attributes array, and I was simply following the behaviour that's being exhibited by these lines:
In that they're modifying the original value set in the parameters (as If the intention of the event was to send the value pre-modification to the I'm certainly amenable to adding this as an additional parameter to the event if we must, but I'd rather fix the oversight if possible. |
Fixes wintercms/winter#1047
Replaces wintercms/winter#1071