@param $value

@throws DomainException
488002
public function setRenewalPolicy($value)
    {
        if (!in_array($value, self::renewalPolicies(), true)) {
            throw new DomainException(sprintf(self::UNEXPECTED_RENEWAL_POLICY, implode(', ', self::renewalPolicies())));
        }
        $this->setAttribute('renewalPolicy', $value);
    }
1350629
public function unserialize($value) : void
    {
        if (isset($this->value)) {
            throw new \LogicException('unserialize() is an internal function, it must not be called directly.');
        }

        $this->value = $value;
    }
917730
final public function offsetSet($key, $value)
	{
		$key = (string) $key;

		if ( array_key_exists($key, $this->_stack) ) {
			throw new \DomainException('Key already exists.');
		}

		$this->_stack[$key] = $value;
	}
1183006
protected function setValue($value)
    {
        if (!$this->validate($value)) {
            throw new \InvalidArgumentException(sprintf('%s is not a valid value', $value));
        }

        $this->value = $value;
    }
848693
public function execute($value)
    {
        if (!is_array($value) || count($value) != 2) {
            throw new \Exception('Value for date range comparison should have to values');
        }

        $queryBuilder = $this->getQueryBuilder();

        if (!empty($value[0])) {

            $transformer = new FullTransformer(
                $this->container->getParameter('pedro_teixeira_grid.date.date_format'),
                $this->container->getParameter('locale')
            );
            $date = new \DateTime();
            $transformer->parse($date, $value[0]);

            $queryBuilder->andWhere(
                $queryBuilder->expr()->gte(
                    $this->getIndex(),
                    ":{$this->getIndexClean()}_1"
                )
            )
                ->setParameter(
                    ":{$this->getIndexClean()}_1",
                    $date->format('Y-m-d') . ' 00:00:00'
                );
        }

        if (!empty($value[1])) {

            $transformer = new FullTransformer(
                $this->container->getParameter('pedro_teixeira_grid.date.date_format'),
                $this->container->getParameter('locale')
            );
            $date = new \DateTime();
            $transformer->parse($date, $value[1]);

            $queryBuilder->andWhere(
                $queryBuilder->expr()->lte(
                    $this->getIndex(),
                    ":{$this->getIndexClean()}_2"
                )
            )
                ->setParameter(
                    ":{$this->getIndexClean()}_2",
                    $date->format('Y-m-d') . ' 23:59:59'
                );
        }
    }
170429
protected function setValue($value)
    {
        if (!is_string($value)) {
            throw InvalidTypeException::fromMessageAndPrototype("Value must be a string", static::prototype());
        }

        if(!mb_check_encoding($value, 'UTF-8')) {
            throw InvalidTypeException::fromMessageAndPrototype("Value must be a UTF-8 encoded", static::prototype());
        }

        $this->value = $value;
    }
179248
public function setPolicy($value)
    {
        if (!in_array($value, self::policies(), true)) {
            throw new DomainException(sprintf(self::MSG_UNEXPECTED_POLICY, implode(', ', self::policies())));
        }

        return $this->setAttribute('policy', $value);
    }
39468
protected function setDataValue($data, $field, $value)
    {
        if (!isset($this->dataNamesMap[$field]['set'])) {

            if (true === $this->ignoreNotMappedFields) {
                return $this;
            }

            throw new \DomainException('Field have not mapping with Data instance (field: ' . $field . ')');
        }

        $method = $this->dataNamesMap[$field]['set'];

        $data->{$method}($value);

        return $this;
    }
598741
protected function checkType($value)
    {
        if (is_string($value) !== true) {
            $msg = "The Identifier Datatype only accepts to store identifier values.";
            throw new InvalidArgumentException($msg);
        } elseif ($value === '') {
            $msg = "The Identifier Datatype do not accept empty strings as valid identifiers.";
            throw new InvalidArgumentException($msg);
        }
    }
1113694
public function setDocumentType($value)
    {
        $allowedTypes = self::allowedTypes();

        if (!in_array($value, $allowedTypes, true)) {
            throw new DomainException(self::MSG_BAD_DOCUMENT_TYPE);
        }

        return $this->setAttribute('documentType', $value);
    }
760931
public function offsetSet($name, $value)
    {
        if ($name == '_id') {
            throw new \Exception('Property "_id" is read-only');
        } elseif ($name === null) {
            throw new \Exception('Property name cannot be null');
        } else {
            parent::offsetSet($name, $value);
        }
    }
116435
public function setValues(array $values)
    {
        $listValues = [];

        if (empty($values)) {
            throw new DomainException('Values cannot be empty');
        }

        foreach ($values as $value) {
            if (is_scalar($value)) {
                $listValues[] = $value;
            } else {
                throw new DomainException('Each value must be a scalar element');
            }
        }

        return $this->setAttribute('values', $listValues);
    }
994323
public function filter($value, SolrDisMaxQuery $query = null, Facets $facets = null)
    {
        if (null === $query) {
            throw new DomainException('$query must not be null');
        }
        
        if (null === $facets) {
            throw new DomainException('$facets must not be null');
        }
        
        $this->createQuery($value, $query, $facets);
    }
1329577
public function setIsAdmin($value)
    {
        $this->_validateNotNull('IsAdmin', $value);
        $this->_validateInt('IsAdmin', $value);

        if ($this->data['is_admin'] === $value) {
            return;
        }

        $this->data['is_admin'] = $value;

        $this->_setModified('is_admin');
    }
394570
public function filter($value)
    {

        // If it's already a timestamp, return it as is.
        if (preg_match('/^-?\d+$/', $value) === 1) {
            if ($value < 0) {
                throw new \DomainException('Invalid value');
            }
            return $value;
        }

        // Allow SQL specials.
        if ($this->getConfig('allowSqlSpecials') === true) {
            $temp = strtolower($value);
            if ($temp === 'now()' || $temp === 'current_timestamp') {
                return time();
            }
        }

        // Catch invalid strings.
        $time = strtotime($value);
        if ($time === false) {
            throw new \DomainException('Invalid value');
        }

        return $time;

    }
432040
public function setWebsites(array $value)
    {
        $websites = [];

        foreach ($value as $website) {
            if ($website instanceof Website) {
                $websites[] = $website->getId();
            } elseif (is_string($website)) {
                $websites[] = $website;
            } else {
                throw new DomainException('Each website must be string identifier or Website entity object');
            }
        }

        return $this->setAttribute('websites', $websites);
    }
303337
protected function processArray(&$value, $domain)
    {
        if (isset($value['label'])) {
            $label = $value['label'];
            if (is_string($label)) {
                if (empty($label)) {
                    $value = $label;
                } else {
                    $translatable = isset($value['translatable'])
                        ? $value['translatable']
                        : true;
                    $transDomain  = isset($value['translation_domain'])
                        ? $value['translation_domain']
                        : $domain;

                    if (isset($value['parameters'])) {
                        $params = $value['parameters'];
                        if (!empty($params)) {
                            $this->processArray($params, $domain);
                        }
                    } else {
                        $params = [];
                    }

                    $value = $translatable
                        ? $this->translator->trans($label, $params, $transDomain)
                        : strtr($label, $params);
                }
            } else {
                foreach ($value as &$val) {
                    if (is_array($val)) {
                        $this->processArray($val, $domain);
                    }
                }
            }
        } elseif (array_key_exists('label', $value)) {
            $value = null;
        } else {
            foreach ($value as &$val) {
                if (is_array($val)) {
                    $this->processArray($val, $domain);
                }
            }
        }
    }