mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
SDK Form demonstrator refactor
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\FormType\Base;
|
||||
namespace Combodo\iTop\Forms\FormType\Base;
|
||||
|
||||
use Symfony\Component\Form\AbstractType as SymfonyAbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
@@ -18,7 +18,7 @@ abstract class AbstractType extends SymfonyAbstractType
|
||||
parent::buildForm($builder, $options);
|
||||
if (isset($options['callback']) && isset($options['hook_type'])) {
|
||||
$builder->addEventListener($options['hook_type'], function (FormEvent $event) use ($options): void {
|
||||
\IssueLog::Info($event->getForm()->getName().' '.$options['hook_type']);
|
||||
\IssueLog::Info($event->getForm()->getName().' AbstractType.php'.$options['hook_type']);
|
||||
call_user_func($options['callback'], $event);
|
||||
});
|
||||
}
|
||||
@@ -4,10 +4,10 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\FormType\Base;
|
||||
namespace Combodo\iTop\Forms\FormType\Base;
|
||||
|
||||
use Combodo\iTop\FormType\Orm\AttCodeGroupByType;
|
||||
use Combodo\iTop\FormType\Orm\ValuesFromAttcodeType;
|
||||
use Combodo\iTop\Forms\FormType\Orm\AttCodeGroupByType;
|
||||
use Combodo\iTop\Forms\FormType\Orm\ValuesFromAttcodeType;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\Form\DataMapperInterface;
|
||||
@@ -86,21 +86,13 @@ class FormBuilder implements FormBuilderInterface, \IteratorAggregate
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ----------------------------------------
|
||||
*
|
||||
* Pure decoration methods below.
|
||||
*
|
||||
* ----------------------------------------
|
||||
*/
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return $this->builder->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|FormBuilderInterface $child
|
||||
* @param string|null $type
|
||||
* @param array $options
|
||||
*
|
||||
* @return \Combodo\iTop\Forms\FormType\Base\FormBuilder
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function add($child, ?string $type = null, array $options = []): static
|
||||
{
|
||||
@@ -122,6 +114,19 @@ class FormBuilder implements FormBuilderInterface, \IteratorAggregate
|
||||
return $this;
|
||||
}
|
||||
|
||||
/*
|
||||
* ----------------------------------------
|
||||
*
|
||||
* Pure decoration methods below.
|
||||
*
|
||||
* ----------------------------------------
|
||||
*/
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return $this->builder->count();
|
||||
}
|
||||
|
||||
public function create(string $name, ?string $type = null, array $options = []): FormBuilderInterface
|
||||
{
|
||||
return $this->builder->create($name, $type, $options);
|
||||
@@ -4,7 +4,7 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\FormType\Base;
|
||||
namespace Combodo\iTop\Forms\FormType\Base;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType as SymfonyHiddenType;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\FormType\Base;
|
||||
namespace Combodo\iTop\Forms\FormType\Base;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType as SymfonyTextType;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\FormType\Base;
|
||||
namespace Combodo\iTop\Forms\FormType\Base;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType as SymfonyTextareaType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
@@ -4,9 +4,9 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\FormType\Orm;
|
||||
namespace Combodo\iTop\Forms\FormType\Orm;
|
||||
|
||||
use Combodo\iTop\FormType\Base\AbstractType;
|
||||
use Combodo\iTop\Forms\FormType\Base\AbstractType;
|
||||
use Dict;
|
||||
use Exception;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SymfonyChoiceType;
|
||||
@@ -4,9 +4,9 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\FormType\Orm;
|
||||
namespace Combodo\iTop\Forms\FormType\Orm;
|
||||
|
||||
use Combodo\iTop\FormType\Base\AbstractType;
|
||||
use Combodo\iTop\Forms\FormType\Base\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType as SymfonyTextareaType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\FormType\Orm;
|
||||
namespace Combodo\iTop\Forms\FormType\Orm;
|
||||
|
||||
use Combodo\iTop\FormType\Base\AbstractType;
|
||||
use Combodo\iTop\Forms\FormType\Base\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SymfonyChoiceType;
|
||||
use utils;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace Combodo\iTop\Test\UnitTest\Application\FormType\Base;
|
||||
|
||||
use Combodo\iTop\FormType\Orm\AttCodeGroupByType;
|
||||
use Combodo\iTop\Forms\FormType\Orm\AttCodeGroupByType;
|
||||
use Combodo\iTop\Test\UnitTest\ItopTestCase;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationExtension;
|
||||
|
||||
Reference in New Issue
Block a user