-
Notifications
You must be signed in to change notification settings - Fork 108
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
Don't use magic "behind the curtains" #104
Comments
Any opinions? |
I'm a little bit confused by your example. Are you saying end-users should use // So instead of this
$my_model->some_column = 'value';
// It would be
$my_model->set('some_column', 'value'); Or are you saying internally we should never use magic methods? (In that case I think I would agree) |
@evanpurkhiser exactly, sorry if I wasn't clear enough |
This sounds good to me then. I can't think of any reasons not to use the get/set methods. 👍 |
Yeah, even magic methods are mapped to |
ORM shouldn't rely on magic methods natively but use the methods for setting / getting instead. Examples;
$this->{$name} = $var;
$this->{$key}->values($values[$key], $column);
$this->$column = $values[$column];
$data[$var] = $this->{$var};
$this->{$property} = $value;
This obviously doesn't apply to properties which aren't magic anyway
The text was updated successfully, but these errors were encountered: