public function setValues($values, $erase = FALSE) : self
{
$this->initEntityRelations();
foreach ($values as $property => $value) {
if ($this[$property] instanceof Nette\Forms\IControl) {
$value = $value === '' ? NULL : $value;
if ($this[$property] instanceof Nette\Forms\Controls\Checkbox && !$value && $this->metadata->getProperty($property)->isNullable) {
$value = NULL;
}
$this->entity->setValue($property, $value);
}
}
return parent::setValues($values, $erase);
}