/**
* @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)));
}