code: public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder->addModelTransformer(
              new CallbackTransformer(
                  function ($toView) {
                      if ($toView instanceof \Traversable) {
                          return iterator_to_array($toView);
                      }
  
                      return $toView;
                  },
                  function ($toModel) {
                      return $toModel;
                  }
              )
          );
      }
docs: @param FormBuilderInterface $builder
  @param array                $options
  
  @throws \InvalidArgumentException