Skip to content

Allow custom setter methods to run for aliased attributes (fixes #350) #351

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Allow custom setter methods to run for aliased attributes (fixes #350) #351

wants to merge 1 commit into from

Conversation

leightonshank
Copy link

The logic in the Model::__set() magic method allowed for either an aliased
attribute or a custom setter, but not both. If a custom setter method
was defined for an aliased attribute, then the attribute value would be
set without going through the custom setter method.

Changed the logic so that the _set() method first normalizes an
aliased attribute into the real attribute name, then checks to see if
an there is a custom setter method defined and runs it if it exists.

The logic in the Model::__set() magic method allowed for either an aliased
attribute *or* a custom setter, but not both.  If a custom setter method
was defined for an aliased attribute, then the attribute value would be
set without going through the custom setter method.

Changed the logic so that the _set() method first normalizes an
aliased attribute into the real attribute name, then checks to see if
an there is a custom setter method defined and runs it if it exists.
@koenpunt
Copy link
Collaborator

koenpunt commented Dec 8, 2014

@cvanschalkwijk should I add this to #430?

@jpfuentes2
Copy link
Owner

Yes, I think we should add it because it is a bug yet trivial to fix.

@jpfuentes2 jpfuentes2 added the bug label Dec 9, 2014
@koenpunt koenpunt mentioned this pull request Dec 9, 2014
27 tasks
@jpfuentes2
Copy link
Owner

I just added it under the mixed category.

@koenpunt
Copy link
Collaborator

koenpunt commented Dec 9, 2014

I'd notice, GitHub protects its content from being saved after a remote change has occurred.

@jpfuentes2
Copy link
Owner

I thought it didn't email on edited comments? Maybe no one's ever edited my comment/description for me to see.

@jpfuentes2
Copy link
Owner

closes #350

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants