public function setConstraints($constraints)
    {
        foreach ($constraints as $fieldName => $v) {
            if (is_array($v)) {
                foreach ($v as $constraintFromArray) {
                    $this->setConstraint($fieldName, $constraintFromArray);
                }
            } else {
                $this->setConstraint($fieldName, $v);
            }
        }

        return $this;
    }