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

Commit

Permalink
fix ValueFormatTransformer broken empty-values
Browse files Browse the repository at this point in the history
  • Loading branch information
sstok committed Jun 29, 2015
1 parent a26ae86 commit 9c66f5e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private function validateEmptyValueOption($emptyValue, array $mappingFields)
}

foreach ($emptyValue as $field => $value) {
if (!in_array($field, $mappingFields, true)) {
if (!array_key_exists($field, $mappingFields)) {
throw new TransformationFailedException(sprintf('Empty-value of mapping field "%s" doesn\'t exists in field mapping.', $field));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testTransformEmptyValueWithArray()

public function testTransformEmptyValuePerFieldWithArray()
{
$transformer = new ValueFormatTransformer(['id' => '0', 'name' => 'NV'], ',', null, ['id', 'name']);
$transformer = new ValueFormatTransformer(['id' => '0', 'name' => 'NV'], ',', null, ['id' => 'user.id', 'name' => 'name']);

$this->assertEquals('foo', $transformer->transform('foo'));
$this->assertEquals('', $transformer->transform(null));
Expand Down

0 comments on commit 9c66f5e

Please sign in to comment.