public function process(FormRuleProcessorContext $context, FormRuleContextBuilder $formRuleContext)
 {
     $form = $context->getForm();
     $formConfig = $form->getConfig();
     if (!$formConfig->getCompound()) {
         return;
     }
     /** @var \Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer $transformer */
     $transformer = $this->findTransformer($formConfig, 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToArrayTransformer');
     if ($transformer === null) {
         return;
     }
     $view = $context->getView();
     $fields = $this->getTransformerFields($transformer);
     $invalidMessage = $this->getFormRuleMessage($formConfig);
     $views = array();
     $conditions = array();
     foreach ($fields as $fieldName) {
         $childView = $view->children[$fieldName];
         // Get child rules collection
         $childRules = $formRuleContext->get($childView);
         if ($childRules === null) {
             $formRuleContext->add($childView, new RuleCollection());
             $childRules = $formRuleContext->get($childView);
         }
         // Register rules
         $this->addNumberCheck($childView, $childRules, $invalidMessage, $conditions);
         $views[] = FormHelper::getFormName($childView);
         $conditions[] = new FieldDependency($childView);
     }
     if ($this->useGroupRule && count($views) > 1) {
         $rules = $formRuleContext->get(array_shift($views));
         $rules->set(CompoundCopyToChildPass::RULE_NAME_GROUP_REQUIRED, new TransformerRule(CompoundCopyToChildPass::RULE_NAME_GROUP_REQUIRED, $views, $invalidMessage));
     }
 }
 protected function extractRules(FormRuleContextBuilder $formRuleContext, FormInterface $form, FormView $view)
 {
     $extracted = new FormRuleContextBuilder();
     if ($form->getConfig()->getCompound()) {
         $it = new \RecursiveIteratorIterator(new FormViewRecursiveIterator($view->getIterator()), \RecursiveIteratorIterator::SELF_FIRST);
         $found = array();
         foreach ($it as $childView) {
             $found[] = FormHelper::getFormName($childView);
         }
     } else {
         $found = array($view);
     }
     foreach ($found as $foundView) {
         $rules = $formRuleContext->get($foundView);
         if ($rules === null) {
             continue;
         }
         $extracted->add($foundView, $rules);
         $formRuleContext->remove($foundView);
     }
     return $extracted;
 }
 public function addGroup($view, $groups)
 {
     $groups = $this->normalizeGroups($groups);
     $name = FormHelper::getFormName($view);
     $this->groups[$name] = $groups;
 }
 public function __construct($field, $condition = self::VALUE_EQUAL, $value)
 {
     $this->field = FormHelper::getFormName($field);
     $this->condition = $condition;
     $this->value = $value;
 }