Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

[BC] Remove need of setter in ClassMethods hydrator #2426

Closed

Conversation

bakura10
Copy link
Contributor

This PR breaks compatibility, and I may be wrong, but the code of extracting was strange. If a getter was here but no setter, the current implementation skip the value and does not extract the value (because it wants both the getter and setter, which I can't understand and is not logical from an extraction point of view).

So I remove the need for that, but some tests break, that I remove. I can't honestly understand the use case and in some cases we only have getter (for instance for ID in entities, when you don't want to expose a setter, but still want be able to read the identifier in the form).

If someone can explain me the use case behind this, I can close this PR, but for now I think the current implementation is buggy and does not behave as expected.

@@ -123,20 +123,6 @@ public function testHydratorClassMethodsCamelCase()
$this->assertEquals($test->hasBar(), false);
}

public function testHydratorClassMethodsCamelCaseWithSetterMissing()
Copy link
Contributor

Choose a reason for hiding this comment

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

You should to update the test instead of removing no ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not really understand it to be honest. I can't understand the use case nor the test, so I can't really update it :/.

@@ -63,19 +63,13 @@ public function extract($object)
if (!preg_match('/^(get|has|is)[A-Z]\w*/', $method)) {
continue;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove the trailing whitespaces on this line please?

@ghost ghost assigned weierophinney Oct 1, 2012
weierophinney added a commit that referenced this pull request Oct 1, 2012
Forward port #2426

Conflicts:
	tests/ZendTest/Stdlib/HydratorTest.php
@weierophinney
Copy link
Member

This isn't so much a BC break as loosening the conditions. As such, I see it as a hotfix, to be included in 2.0.3.

weierophinney added a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
Forward port zendframework/zendframework#2426

Conflicts:
	tests/ZendTest/Stdlib/HydratorTest.php
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants