-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
Adds configuration for the hydrator on a per property basis #42
base: 4.2.x
Are you sure you want to change the base?
Conversation
The TravisCI failures seem to be of stylistic nature ... I would like this PR to be merged in order to further enhance the GeneratedHydrator code |
* | ||
* @param type $allowedProperties | ||
*/ | ||
private function expandAllowedProperties($options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is way too large
$propertyData = '$data["\\0*\\0' . $propertyName . '"]'; | ||
} | ||
|
||
$body .= 'if (isset(' . $propertyData . ")) {\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit doubtful if i need to check if the object property is set before i can extract it.. not sure what to do here
@flip111 can you add unit tests for this changes? |
|
* | ||
* @param array $options | ||
*/ | ||
private function expandAllowedProperties($options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array $options
1. moved information on properties outside of the HydratorMethodsVisitor into the HydratorGenerator 2. moved exception code into it's own class InvalidOptionException 3. moved option parsing from HydratorMethodsVisitor to value object AllowedPropertiesOption 4. small fix where a null would not be hydrated (in case the object itself has another default value)
@Ocramius any more fundamental remarks on this PR? Please let me know, then i will proceed with unit tests and wrap this up. |
Design: #16 (comment)
Unit tests will follow after design approval