The field must not exist
@access public
@param $error string
@return \Gcs\Framework\Core\Orm\Validation\Element\Element
@since 3.0
@package Gcs\Framework\Core\Form\Validation\Element
343032
public function notExist($error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::NOTEXIST, 'message' => $error]);
        }

        return $this;
    }
833444
public function setError(Model\Error $error) {
        $errorMessage = $error->getErrorMessage();

        $this->headers->add([
            'X-Imbo-Error-Message' => $errorMessage,
            'X-Imbo-Error-InternalCode' => $error->getImboErrorCode(),
            'X-Imbo-Error-Date' => $error->getDate()->format('D, d M Y H:i:s') . ' GMT',
        ]);

        $this->setStatusCode($error->getHttpCode(), $errorMessage)
             ->setEtag(null)
             ->setLastModified(null);

        $this->setModel($error);

        return $this;
    }
550621
public static function errorToString($error) {
        if (!is_int($error)) throw new IllegalTypeException('Illegal type of parameter $error: '.gettype($error));

        if (key_exists($error, self::$win32Errors))
            return self::$win32Errors[$error][0];
        return (string) $error;
    }
1205618
public function getValidationErrors($value)
	{
		$errors = array();
		if($this->required===true and !$value)
		{
			$errors['required'] = 'this element is required';
		}
		if(isset($this->defaultValue) and !empty($this->readonly) and $value!=$this->defaultValue)
		{
			$errors['readonly'] = 'this element is readonly';
		}
		return $errors;
	}
568142
public function getValidationErrors($value)
	{
		$errors = array();
		if($this->required===true and !isset($value))
		{
			$errors['required'] = 'this element is required';
		}
		if(isset($this->min) and $this->min>0 and mb_strlen($value)<$this->min)
		{
			$errors['min'] = json_encode(array(
				'msg' => "at least %s characters is required",
				'arguments' => array($this->min)
			));
		}
		if(isset($this->max) and $this->max>0 and mb_strlen($value)>$this->max)
		{
			$errors['max'] = json_encode(array(
				'msg' => "maximum characters length is %s",
				'arguments' => array($this->max)
			));
		}
		if(!empty($this->value))
		{
			if(isset($this->regex))
			{
				if(substr($this->regex, 0, 1)!==substr($this->regex, -1, 1))
				{
					if(strpos($this->regex, '/')===false)
						$this->regex = '/'.$this->regex.'/';
					elseif(strpos($this->regex, '~')===false)
						$this->regex = '~'.$this->regex.'~';

				}
			}
			if(isset($this->regex) and !preg_match($this->regex, $value))
			{
				$errors['pattern'] = 'value does not match the pattern';
			}
		}
		if(isset($this->defaultValue) and !empty($this->readonly) and $value!=$this->defaultValue)
		{
			$errors['readonly'] = 'this element is readonly';
		}
		return $errors;
	}
757609
public function mail($error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::MAIL, 'message' => $error]);
        }

        return $this;
    }
1285136
public function setError($error)
  {
    if ( !($error instanceof Exception) && is_string($error) ){
      $error = new Exception($error);
    }
    
    array_push($this->errors, $error);
    
    return $this;
  }
189271
public function addError($error)
    {
        if (is_string($error)) {
            $error = array('message' => $error);
        }

        if (is_array($error)) {
            $error = new AnError($error);
        }

        if (!isset($this->_errors[$this->_mixer])) {
            $this->_errors[$this->_mixer] = new AnObjectSet();
        }

        $this->_errors[$this->_mixer]->insert($error);

        return $this;
    }
1351536
public function hasError($field=null){
        if($field == null){
            return count($this->errors) > 0;
        }
        return array_key_exists($field, $this->errors);
    }
989263
private function translateError(FormError $error)
    {
        if ($this->translator === null) {
            return $error->getMessage();
        }

        if ($error->getMessagePluralization() !== null) {
            return $this->translator->transChoice(
                $error->getMessageTemplate(),
                $error->getMessagePluralization(),
                $error->getMessageParameters(),
                'validators'
            );
        }

        return $this->translator->trans(
            $error->getMessageTemplate(),
            $error->getMessageParameters(),
            'validators'
        );
    }
1263864
public function getErrorDocs($error)
    {
        return isset($this->docs['shapes'][$error]['base'])
            ? $this->docs['shapes'][$error]['base']
            : null;
    }
104209
protected function getNotFoundPage($error)
    {
        return new Response($this->twig->render('@crud/notFound.twig', [
            'crud' => $this->service,
            'error' => $error,
            'crudEntity' => '',
            'layout' => $this->service->getTemplate('layout', '', '')
        ]), 404);
    }
162959
public function checkValidationMessageFor($element, $message)
    {
        $foundElement = $this->getFieldElement($element);
        if (null === $foundElement) {
            throw new ElementNotFoundException($this->getSession(), 'Validation message', 'css', '.sylius-validation-error');
        }

        $validationMessage = $foundElement->find('css', '.sylius-validation-error');
        if (null === $validationMessage) {
            throw new ElementNotFoundException($this->getSession(), 'Validation message', 'css', '.sylius-validation-error');
        }

        return $message === $validationMessage->getText();
    }
614088
public function validate($value)
    {
        if (!is_array($value)) {
            return Error::unit([ Error::NON_ARRAY ]);
        }

        $errors = [];
        foreach ($value as $pos => $item) {
            $result = parent::validate($item);
            if ($result instanceof Error) {
                $errors[$pos] = $result->unwrap();
            }
        }

        return empty($errors) ? Ok::unit() : Error::unit($errors);
    }
171055
public function getValidationError($field)
    {
        // break apart path
        $crumbs = explode('.', $field);

        // resolve path recursively
        $cur = &$this->_validationErrors;
        while ($crumb = array_shift($crumbs)) {
            if (array_key_exists($crumb, $cur)) {
                $cur = &$cur[$crumb];
            } else {
                return null;
            }
        }

        // return current value
        return $cur;
    }
838274
public function error($rule=null) {
		if($rule === null)
			return $this->self;
		elseif(isset($this->rules[$rule]))
			return $this->rules[$rule];
		elseif($attribute = $this->attribute($rule))
			return $attribute->error();
	}
404216
protected function validateElement(\marvin255\serviform\interfaces\Field $element)
    {
        $value = $element->getValue();
        if ($this->getArrayValue()) {
            if (!is_array($value)) {
                throw new InvalidArgumentException('Value must ba an array for element: ' . $element->getName());
            }
            $res = true;
            $errors = [];
            foreach ($value as $key => $item) {
                if ($this->vaidateValue($item, $element)) {
                    continue;
                }
                $res = false;
                $errors[$key] = $this->createErrorMessage($element);
            }
            if ($res === false) {
                $element->addError($errors);
            }
        } else {
            $res = $this->vaidateValue($value, $element);
            if ($res === false) {
                $element->addError($this->createErrorMessage($element));
            }
        }

        return $res;
    }