diff --git a/src/Bridges/FormsDI/FormsExtension.php b/src/Bridges/FormsDI/FormsExtension.php index 17b052b05..58281781b 100644 --- a/src/Bridges/FormsDI/FormsExtension.php +++ b/src/Bridges/FormsDI/FormsExtension.php @@ -26,17 +26,6 @@ public function __construct() } - public function beforeCompile() - { - $builder = $this->getContainerBuilder(); - - if ($builder->findByType(Nette\Http\IRequest::class)) { - $builder->addDefinition($this->prefix('factory')) - ->setFactory(Nette\Forms\FormFactory::class); - } - } - - public function afterCompile(Nette\PhpGenerator\ClassType $class) { $initialize = $this->initialization ?? $class->getMethod('initialize'); diff --git a/src/Forms/Form.php b/src/Forms/Form.php index 02ae52649..897cb835c 100644 --- a/src/Forms/Form.php +++ b/src/Forms/Form.php @@ -703,13 +703,6 @@ public static function initialize(bool $reinit = false): void } - /** @internal */ - public function setHttpRequest(Nette\Http\IRequest $request) - { - $this->httpRequest = $request; - } - - private function getHttpRequest(): Nette\Http\IRequest { if (!$this->httpRequest) { diff --git a/src/Forms/FormFactory.php b/src/Forms/FormFactory.php deleted file mode 100644 index 8bbb8a7cf..000000000 --- a/src/Forms/FormFactory.php +++ /dev/null @@ -1,38 +0,0 @@ -httpRequest = $httpRequest; - } - - - public function createForm(string $name = null): Form - { - $form = new Form($name); - $form->setHttpRequest($this->httpRequest); - return $form; - } -} diff --git a/tests/Forms.DI/FormsExtension.phpt b/tests/Forms.DI/FormsExtension.phpt index 17dc487f0..e96c8d978 100644 --- a/tests/Forms.DI/FormsExtension.phpt +++ b/tests/Forms.DI/FormsExtension.phpt @@ -52,18 +52,3 @@ Assert::exception(function () { eval($compiler->addConfig($config)->setClassName('Container2')->compile()); }, Nette\InvalidArgumentException::class, 'Constant Nette\Forms\Form::Foo\Bar or constant Foo\Bar does not exist.'); - - -test('form factory', function () { - $compiler = new DI\Compiler; - $compiler->addExtension('http', new Nette\Bridges\HttpDI\HttpExtension); - $compiler->addExtension('forms', new FormsExtension); - - eval($compiler->setClassName('Container3')->compile()); - - $container = new Container3; - $container->initialize(); - $factory = $container->getByType(Nette\Forms\FormFactory::class); - $form = $factory->createForm(); - Assert::type(Form::class, $form); -}); diff --git a/tests/Forms/FormFactory.phpt b/tests/Forms/FormFactory.phpt deleted file mode 100644 index 8c3862c00..000000000 --- a/tests/Forms/FormFactory.phpt +++ /dev/null @@ -1,20 +0,0 @@ -fromGlobals(); -$factory = new FormFactory($request); -$form = $factory->createForm(); -Assert::type(Form::class, $form); - - -$form = $factory->createForm('foo'); -Assert::same('foo', $form->getName());