Skip to content

Commit

Permalink
Merge pull request netgen#38 from amirkoklan/master
Browse files Browse the repository at this point in the history
Object Relation BugFix in Update Mode
  • Loading branch information
MarioBlazek committed Jun 6, 2017
2 parents d71244c + ed3854a commit d8b9045
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bundle/Form/FieldTypeHandler/Relation.php
Expand Up @@ -71,6 +71,6 @@ public function convertFieldValueToForm(Value $value, FieldDefinition $fieldDefi
return null;
}

return $this->repository->getContentService()->loadContent($value->destinationContentId);
return $value->destinationContentId;
}
}
8 changes: 1 addition & 7 deletions tests/Form/FieldTypeHandler/RelationTest.php
Expand Up @@ -93,18 +93,12 @@ public function testAssertInstanceOfFieldTypeHandler()

public function testConvertFieldValueToForm()
{
$destinationContentId = 2;
$this->contentService->expects($this->once())
->method('loadContent')
->with($destinationContentId)
->willReturn('foo');

$relation = new Relation($this->repository, $this->translationHelper);
$relationValue = new RelationValue(2);

$returnedValue = $relation->convertFieldValueToForm($relationValue);

$this->assertEquals('foo', $returnedValue);
$this->assertEquals(2, $returnedValue);
}

public function testConvertFieldValueToFormNullDestinationContentId()
Expand Down

0 comments on commit d8b9045

Please sign in to comment.