Skip to content

Commit

Permalink
Revert "added FormFactory & DI service"
Browse files Browse the repository at this point in the history
This reverts commit 0b7fe74.
  • Loading branch information
dg committed Oct 6, 2021
1 parent 2ee94a5 commit 6fc7350
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 91 deletions.
11 changes: 0 additions & 11 deletions src/Bridges/FormsDI/FormsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
7 changes: 0 additions & 7 deletions src/Forms/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
38 changes: 0 additions & 38 deletions src/Forms/FormFactory.php

This file was deleted.

15 changes: 0 additions & 15 deletions tests/Forms.DI/FormsExtension.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
20 changes: 0 additions & 20 deletions tests/Forms/FormFactory.phpt

This file was deleted.

0 comments on commit 6fc7350

Please sign in to comment.