We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currently we often need to create getter/setter to get or set values by a field name.
$fieldNames = ['field1','field2']; foreach($fieldNames as $field){ #currently $value = $o->{"get".ucfirst($field)}(); #could be $value = $o->get($field); }
Add a shorthand to get and set Values on objects by there field Name.
Add the following Code to the AbstractObject.php
/** * @param string $fieldName * @return mixed */ public function get($fieldName){ return $this->{"get".ucfirst($fieldName)}(); } /** * @param string $fieldName * @param $value * @return mixed */ public function set($fieldName,$value){ return $this->{"set".ucfirst($fieldName)}($value); }
The text was updated successfully, but these errors were encountered:
Would be also good then to have them on localized fields and objects bricks (and maybe somewhere else?) - just to be consistent.
Sorry, something went wrong.
dvesh3
No branches or pull requests
Feature Request
Currently we often need to create getter/setter to get or set values by a field name.
Add a shorthand to get and set Values on objects by there field Name.
Add the following Code to the AbstractObject.php
The text was updated successfully, but these errors were encountered: