public function setValue($value)
{
if (!is_scalar($value) && $value !== NULL && !method_exists($value, '__toString')) {
throw new Nette\InvalidArgumentException(sprintf("Value must be scalar or NULL, %s given in field '%s'.", gettype($value), $this->name));
}
if (!$this->persistValue) {
$this->value = (string) $value;
}
return $this;
}