Skip to content

Commit

Permalink
Merge pull request #86 from thewilkybarkid/country-choice-optional
Browse files Browse the repository at this point in the history
Allow the country choice widget to not be required
  • Loading branch information
thewilkybarkid committed Mar 31, 2016
2 parents 845897f + 85f0ebb commit 87a58b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Form/DataTransformer/PhoneNumberToArrayTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function reverseTransform($value)
throw new TransformationFailedException('Expected an array.');
}

if ('' === trim(implode('', $value))) {
if ('' === trim($value['number'])) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ public function reverseTransformProvider()
array('country' => '', 'number' => ''),
null,
),
array(
array('GB'),
array('country' => 'GB', 'number' => ''),
null,
),
array(
array('GB'),
array('country' => '', 'number' => 'foo'),
Expand Down

0 comments on commit 87a58b5

Please sign in to comment.