Skip to content

Commit

Permalink
add $emptyToNull to createReferenceOne
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Zogg committed Mar 11, 2019
1 parent 19e7b5d commit 93cd6a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Expand Up @@ -30,7 +30,7 @@ final class ReferenceOneFieldDenormalizer implements FieldDenormalizerInterface
/**
* @param callable $repository
* @param AccessorInterface $accessor
* @param bool $emptyToNull
* @param bool $emptyToNull
*/
public function __construct(callable $repository, AccessorInterface $accessor, bool $emptyToNull = false)
{
Expand Down
10 changes: 8 additions & 2 deletions src/Mapping/DenormalizationFieldMappingBuilder.php
Expand Up @@ -139,15 +139,21 @@ public static function createReferenceMany(
/**
* @param string $name
* @param callable $repository
* @param bool $emptyToNull
*
* @return DenormalizationFieldMappingBuilderInterface
*/
public static function createReferenceOne(
string $name,
callable $repository
callable $repository,
bool $emptyToNull = false
): DenormalizationFieldMappingBuilderInterface {
$self = new self($name);
$self->fieldDenormalizer = new ReferenceOneFieldDenormalizer($repository, new PropertyAccessor($name));
$self->fieldDenormalizer = new ReferenceOneFieldDenormalizer(
$repository,
new PropertyAccessor($name),
$emptyToNull
);

return $self;
}
Expand Down

0 comments on commit 93cd6a1

Please sign in to comment.