Skip to content

Commit

Permalink
[Form][CheckboxType] Remove _false_is_empty flag
Browse files Browse the repository at this point in the history
  • Loading branch information
fancyweb committed Mar 18, 2020
1 parent eda7aad commit 6fac6d4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
// doing so also calls setDataLocked(true).
$builder->setData(isset($options['data']) ? $options['data'] : false);
$builder->addViewTransformer(new BooleanToStringTransformer($options['value'], $options['false_values']));
$builder->setAttribute('_false_is_empty', true); // @internal - A boolean flag to treat false as empty, see Form::isEmpty() - Do not rely on it, it will be removed in Symfony 5.1.
}

/**
Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Component/Form/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -742,9 +742,7 @@ public function isEmpty()
// arrays, countables
((\is_array($this->modelData) || $this->modelData instanceof \Countable) && 0 === \count($this->modelData)) ||
// traversables that are not countable
($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData)) ||
// @internal - Do not rely on it, it will be removed in Symfony 5.1.
(false === $this->modelData && $this->config->getAttribute('_false_is_empty'));
($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData));
}

/**
Expand Down

0 comments on commit 6fac6d4

Please sign in to comment.