deprecated-packages / ActionAutowire

[DEPRECATED, READ-ONLY] Use:

Home Page:https://github.com/Symplify/ControllerAutowire

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Action Autowire

Build Status Quality Score Code Coverage Downloads Latest stable

This bundle enables action autowiring for controllers.

Inspired by Argument Value Resolver available since Symfony 3.1.

Install

composer require symplify/action-autowire

Add bundle to AppKernel.php:

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            new Symplify\ActionAutowire\SymplifyActionAutowireBundle(),
            // ...
        ];
    }
}

Usage

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 :)

Testing

vendor/bin/symplify-cs check src tests
vendor/bin/phpunit

Contributing

Rules are simple:

  • new feature needs tests
  • all tests must pass
  • 1 feature per PR

I'd be happy to merge your feature then.

About

[DEPRECATED, READ-ONLY] Use:

https://github.com/Symplify/ControllerAutowire

License:MIT License


Languages

Language:PHP 100.0%