Skip to content

[PropertyAccess] stop overwriting once a reference is reached (2nd) #13831

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

Closed
wants to merge 5 commits into from
Closed

[PropertyAccess] stop overwriting once a reference is reached (2nd) #13831

wants to merge 5 commits into from

Conversation

bananer
Copy link
Contributor

@bananer bananer commented Mar 3, 2015

Updated, squashed version of PR 13826

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets 13731
License MIT
Doc PR none

I added test cases for the scenario described in my issue. After looking through the PropertyAccessor source my conclusion was that there is no reason to overwrite parents of references, so I changed that. None of the previous test cases disagreed and my new tests also passed.

Or maybe I got it all wrong, I'm willing to learn.

array(new TestClass(array('foo' => 'bar')), 'publicGetSetter[foo]', 'bar'),
array(new TestClass(new TestClass('bar')), 'publicGetter.publicGetSetter', 'bar'),
array(new TestClass(array('foo' => new TestClass('bar'))), 'publicGetter[foo].publicGetSetter', 'bar'),
array(new TestClass(new TestClass(new TestClass('bar'))), 'publicGetter.publicGetSetter.publicGetSetter', 'bar'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

publicGetter.publicGetter.publicGetSetter should be enough (no need for GetSetter in middle)

@Tobion
Copy link
Contributor

Tobion commented Mar 3, 2015

Thanks for the work. Looks very good now. 👍

I was wondering if there are circumstances where a object reference must be repopulated downwards. The only thing I could image is Value Objects like PSR-7 Uri where the "setter" creates new objects which would need to be set on the root, e.g. request.uri.scheme. But that was not possible before as well since it would require to save the return value of the setter. Supporting that would be a different topic.

So this change here is indeed a bug fix and does not break anything. It should also be merged in 2.6.

@bananer bananer closed this Mar 3, 2015
Tobion added a commit that referenced this pull request Mar 3, 2015
…hed (3rd) (bananer)

This PR was squashed before being merged into the 2.6 branch (closes #13835).

Discussion
----------

[PropertyAccess] stop overwriting once a reference is reached (3rd)

I commited with a different email address in [PR 13831](#13831), so here is the third attempt. Also removed unnecessary test as suggested by @Tobion

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | [13731](#13731)
| License       | MIT
| Doc PR        | none

I added test cases for the scenario described in my issue. After looking through the PropertyAccessor source my conclusion was that there is no reason to overwrite parents of references, so I changed that. None of the previous test cases disagreed and my new tests also passed.

Or maybe I got it all wrong, I'm willing to learn.

Commits
-------

d733a88 [PropertyAccess] stop overwriting once a reference is reached (3rd)
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.

3 participants