This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fixes #6585 #6614
Closed
vixriihi
wants to merge
13
commits into
zendframework:master
from
vixriihi:fix/adding-collections-dynamically
Closed
fixes #6585 #6614
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c01a56f
[#6585] test for "no element by the name" error
vixriihi a4fa608
added missing assert
vixriihi 0e535a2
[#6585] added test to check that noting is lost from the bound object…
vixriihi da60434
[#6585] fixes #6585
vixriihi 45c1230
Tweaked the fix by adding new method instead of new parameter
vixriihi 8d3cf3a
Small test tweak
vixriihi 70caa79
Added the BindValuesPreservesNewValueAfterValidation test from PR #6711
vixriihi f8261fe
extractAndPopulate => populate
vixriihi eda4e9d
populate => populateValues
vixriihi d0b1fa7
Added parameter to forms populateValues to enable only populating to …
vixriihi b8ce565
cs fix
vixriihi 195487c
Merge remote-tracking branch 'upstream/master' into fix/adding-collec…
vixriihi dfea91f
Changed docblock for populateValues method
vixriihi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
use Zend\Form\Form; | ||
use Zend\Form\Fieldset; | ||
use Zend\InputFilter\InputFilter; | ||
use Zend\Stdlib\Hydrator; | ||
|
||
class FieldsetTest extends TestCase | ||
{ | ||
|
@@ -522,4 +523,25 @@ public function testShouldValidateAllowObjectBindingByObject() | |
$this->assertTrue($allowed); | ||
} | ||
|
||
public function testBindValuesPreservesNewValueAfterValidation() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps you can add a group annotation so it is clear why the test is needed? See #6711 |
||
{ | ||
$form = new Form(); | ||
$form->add(new Element('foo')); | ||
$form->setHydrator(new Hydrator\ObjectProperty); | ||
|
||
$object = new \stdClass(); | ||
$object->foo = 'Initial value'; | ||
$form->bind($object); | ||
|
||
$form->setData(array( | ||
'foo' => 'New value' | ||
)); | ||
|
||
$this->assertSame('New value', $form->get('foo')->getValue()); | ||
|
||
$form->isValid(); | ||
|
||
$this->assertSame('New value', $form->get('foo')->getValue()); | ||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should be
private
orprotected
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.
That's overriding method from fieldset. So either we need to figure out a new name for this or keep it public :(
We could take that method away from the form all together but that would change the existing behavior a little (Namely that the form would populate every field instead of just the base during bind and validation without data)..Tests seem to pass then also, but I'd be surprised if there wouldn't be any side effects in some app.
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.
If it's an override then it's fine: I just don't want new API that is an implementation detail :-)
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.
Me neither :)
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.
If it's inherited, could you replace the docblock with
{@inheritDoc}
?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.
done