minor #36128 [Form][CheckboxType] Remove _false_is_empty flag (fancyweb)
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Form][CheckboxType] Remove _false_is_empty flag
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Cleanup of https://github.com/symfony/symfony/pull/35938.
Commits
-------
6fac6d4086
[Form][CheckboxType] Remove _false_is_empty flag
This commit is contained in:
commit
836a72acba
@ -33,7 +33,6 @@ class CheckboxType extends AbstractType
|
|||||||
// doing so also calls setDataLocked(true).
|
// doing so also calls setDataLocked(true).
|
||||||
$builder->setData(isset($options['data']) ? $options['data'] : false);
|
$builder->setData(isset($options['data']) ? $options['data'] : false);
|
||||||
$builder->addViewTransformer(new BooleanToStringTransformer($options['value'], $options['false_values']));
|
$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.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -740,9 +740,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
|||||||
// arrays, countables
|
// arrays, countables
|
||||||
((\is_array($this->modelData) || $this->modelData instanceof \Countable) && 0 === \count($this->modelData)) ||
|
((\is_array($this->modelData) || $this->modelData instanceof \Countable) && 0 === \count($this->modelData)) ||
|
||||||
// traversables that are not countable
|
// traversables that are not countable
|
||||||
($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData)) ||
|
($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'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user