public function buildConstraint(&$options, FcFieldConstraint $fc_constraint)
 {
     $params = $fc_constraint->getParams();
     $this->match = (bool) $params['match'];
     $this->pattern = $this->buildPattern($params['sets']);
     parent::buildConstraint($options, $fc_constraint);
 }
 public function buildConstraint(&$options, FcFieldConstraint $fc_constraint)
 {
     $params = $fc_constraint->getParams();
     try {
         $value = new \DateTime($params['value']);
         $limit = clone $value;
     } catch (\Exception $e) {
         return;
     }
     $options['constraints'][] = new DateComparison(array('groups' => $this->getGroups($fc_constraint), 'value' => $value, 'message' => $fc_constraint->getMessage(), 'type' => $this->constraints[$params['type']], 'format' => $options['format']));
     switch ($params['type']) {
         case 'greater':
             $limit->modify('+1 day');
         case 'greater_or_equal':
             $attr = 'data-min-date';
             break;
         case 'less':
             $limit->modify('-1 day');
         case 'less_or_equal':
             $attr = 'data-max-date';
             break;
         default:
             return;
     }
     if (!isset($options['attr'])) {
         $options['attr'] = array();
     }
     $options['attr'][$attr] = $limit->format($options['format']);
 }
 public function buildConstraint(&$options, FcFieldConstraint $fc_constraint)
 {
     $callback = function ($object, ExecutionContextInterface $context) use($fc_constraint) {
         $is_valid = false;
         $params = $fc_constraint->getParams();
         $data = $context->getRoot()->getData();
         foreach ($params['fields'] as $field) {
             if (isset($data[$field]) && !empty($data[$field])) {
                 $is_valid = true;
                 break;
             }
         }
         if (!$is_valid) {
             $context->buildViolation($fc_constraint->getMessage())->addViolation();
         }
     };
     $options['constraints'][] = new Callback(array('groups' => $this->getGroups($fc_constraint), 'callback' => $callback));
 }
 public function buildConstraint(&$options, FcFieldConstraint $fc_constraint)
 {
     $params = $fc_constraint->getParams();
     $options['constraints'][] = new Email(array('groups' => $this->getGroups($fc_constraint), 'message' => $fc_constraint->getMessage(), 'strict' => (bool) $params['strict'], 'checkMX' => (bool) $params['strict'], 'checkHost' => (bool) $params['strict']));
 }
 public function buildConstraint(&$options, FcFieldConstraint $fc_constraint)
 {
     $params = $fc_constraint->getParams();
     $options['constraints'][] = new $this->constraints[$params['type']](array('groups' => $this->getGroups($fc_constraint), 'value' => $params['value'], 'message' => $fc_constraint->getMessage()));
 }