This bundle enables action autowiring for controllers.
Inspired by Argument Value Resolver available since Symfony 3.1.
composer require symplify/action-autowire
Add bundle to AppKernel.php
:
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
new Symplify\ActionAutowire\SymplifyActionAutowireBundle(),
// ...
];
}
}
class SomeController
{
public function detailAction(SomeClass $someClass)
{
$someClass->someMethod();
// ...
}
}
This is especially convenient when moving from named services to constructor injection:
class SomeController extends Controller
{
public function detailAction()
{
$someClass = $this->get('some_service');
// ...
}
}
That's all :)
vendor/bin/symplify-cs check src tests
vendor/bin/phpunit
Rules are simple:
- new feature needs tests
- all tests must pass
- 1 feature per PR
I'd be happy to merge your feature then.