mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 15:34:12 +01:00
30 lines
698 B
PHP
30 lines
698 B
PHP
<?php
|
|
|
|
namespace Combodo\iTop\Forms\FormBuilder;
|
|
|
|
use Symfony\Component\Form\Event\PostSetDataEvent;
|
|
use Symfony\Component\Form\Event\PostSubmitEvent;
|
|
use Symfony\Component\Form\FormEvent;
|
|
use Symfony\Component\Form\FormEvents;
|
|
|
|
class FormHelper
|
|
{
|
|
/**
|
|
* Get the event type.
|
|
*
|
|
* @param FormEvent $event
|
|
*
|
|
* @return string
|
|
* @throws FormBuilderException
|
|
*/
|
|
public static function GetEventType(FormEvent $event): string
|
|
{
|
|
if ($event instanceof PostSetDataEvent) {
|
|
return FormEvents::POST_SET_DATA;
|
|
} else if ($event instanceof PostSubmitEvent) {
|
|
return FormEvents::POST_SUBMIT;
|
|
}
|
|
|
|
throw new FormBuilderException(sprintf('Unknown event type %s', get_class($event)));
|
|
}
|
|
} |