public function setValue($value)
{
if ($this->checkAllowedValues && $value !== NULL && !array_key_exists((string) $value, $this->items)) {
$set = Nette\Utils\Strings::truncate(implode(', ', array_map(function ($s) {
return var_export($s, TRUE);
}, array_keys($this->items))), 70, '...');
throw new Nette\InvalidArgumentException("Value '{$value}' is out of allowed set [{$set}] in field '{$this->name}'.");
}
$this->value = $value === NULL ? NULL : key([(string) $value => NULL]);
return $this;
}