Skip to content
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

Open
wants to merge 2 commits into
base: 4.2.x
Choose a base branch
from

Conversation

flip111
Copy link

@flip111 flip111 commented Nov 23, 2015

Design: #16 (comment)

Unit tests will follow after design approval

@flip111
Copy link
Author

flip111 commented Nov 23, 2015

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)
Copy link
Owner

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"
Copy link
Author

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

@malukenho
Copy link
Collaborator

@flip111 can you add unit tests for this changes?

@flip111
Copy link
Author

flip111 commented Nov 24, 2015

@flip111 can you add unit tests for this changes?

#42 (comment)

Unit tests will follow after design approval

*
* @param array $options
*/
private function expandAllowedProperties($options)
Copy link
Collaborator

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)
@flip111
Copy link
Author

flip111 commented Nov 29, 2015

@Ocramius any more fundamental remarks on this PR? Please let me know, then i will proceed with unit tests and wrap this up.

@Ocramius Ocramius changed the base branch from master to 4.2.x January 17, 2021 19:15
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.

None yet

3 participants