Matthias\SymfonyConsoleForm\Form\FormUtil::typeAncestry PHP Method

typeAncestry() public static method

public static typeAncestry ( Symfony\Component\Form\FormInterface $form ) : array
$form Symfony\Component\Form\FormInterface
return array
    public static function typeAncestry(FormInterface $form)
    {
        $types = [];
        self::typeAncestryForType($form->getConfig()->getType(), $types);
        return $types;
    }

Usage Example

 /**
  * @param FormInterface $form
  *
  * @throws CouldNotResolveTransformer
  *
  * @return FormToQuestionTransformer
  */
 public function resolve(FormInterface $form)
 {
     $types = FormUtil::typeAncestry($form);
     foreach ($types as $type) {
         if (isset($this->transformers[$type])) {
             return $this->transformers[$type];
         }
     }
     throw new CouldNotResolveTransformer(sprintf('Could not find a transformer for any of these types (%s)', implode(', ', $types)));
 }