コード例 #1
0
 /**
  * Create a default node hierarchy by using AND operator.
  *
  * @param Form                   $form
  * @param ConditionNodeInterface $root
  * @param string                 $parentName
  */
 protected function buildDefaultConditionNode(Form $form, ConditionNodeInterface $root, $parentName = '')
 {
     foreach ($form->all() as $child) {
         $name = '' !== $parentName ? $parentName . '.' . $child->getName() : $child->getName();
         if ($child->getConfig()->hasAttribute('add_shared')) {
             $isCollection = $child->getConfig()->getType()->getInnerType() instanceof CollectionAdapterFilterType;
             $this->buildDefaultConditionNode($isCollection ? $child->get(0) : $child, $root->andX(), $name);
         } else {
             $root->field($name);
         }
     }
 }