2017 © Pedro Peláez
 

library nette-autoinject

Grouped autoinject of services in Nette Presenter

image

lulco/nette-autoinject

Grouped autoinject of services in Nette Presenter

  • Thursday, December 17, 2015
  • by lulco
  • Repository
  • 1 Watchers
  • 0 Stars
  • 33 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Nette autoinject

Grouped autoinject of services in Nette Presenter, (*1)

Background

If you have to inject some services to presenter just because you need them to initialize, your presenter looks like this:, (*2)

class BasePresenter extends Presenter
{
    /** @var Some\Service1 @inject */
    public $service1;

    /** @var Some\Service2 @inject */
    public $service2;

    /** @var Some\Service3 @inject */
    public $service3;
}

So if you want to avoid this, you can use this library., (*3)

Usage

1) Register NetteAutoInject Manager to config.neon and add all services you want to be initialized in presenter:, (*4)

services:
    ...
    -
        class: Lulco\NetteAutoInject\Manager
        setup:
            - addService(Some\Service1())
            - addService(Some\Service2())
            - addService(Some\Service3())
    ...

2) Inject Manager to Presenter:, (*5)

class BasePresenter extends Presenter
{
    /** @var \Lulco\NetteAutoInject\Manager @inject */
    public $autoInject;
}

And that's it :), (*6)

The Versions

17/12 2015

dev-master

9999999-dev

Grouped autoinject of services in Nette Presenter

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michal Lulco

php nette phinx

17/12 2015

1.0.0

1.0.0.0

Grouped autoinject of services in Nette Presenter

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michal Lulco

php nette phinx