[Form][CheckboxType] Remove _false_is_empty flag

This commit is contained in:
Thomas Calvet 2020-03-18 14:07:42 +01:00
parent eda7aad51e
commit 6fac6d4086
2 changed files with 1 additions and 4 deletions

View File

@ -33,7 +33,6 @@ class CheckboxType extends AbstractType
// 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.
}
/**

View File

@ -742,9 +742,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
// 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));
}
/**