Skip to content

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

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

Merged
merged 1 commit into from
Jan 19, 2015
Merged

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

merged 1 commit into from
Jan 19, 2015

Conversation

koenpunt
Copy link
Collaborator

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 koenpunt mentioned this pull request Jan 19, 2015
27 tasks
koenpunt added a commit that referenced this pull request Jan 19, 2015
…ibute

Allow custom setter methods to run for aliased attributes (fixes #350)
@koenpunt koenpunt merged commit 9113cc2 into jpfuentes2:1.1-dev Jan 19, 2015
koenpunt added a commit that referenced this pull request Jun 3, 2017
…ibute

Allow custom setter methods to run for aliased attributes (fixes #350)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants