geniv / nette-autowired
Autowired trait for Nette Framework
Installs: 1 097
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
- nette/component-model: >=2.3
- nette/di: >=2.4
- nette/reflection: >=2.4
This package is auto-updated.
Last update: 2024-12-11 01:29:03 UTC
README
This trait allows self class use in parameters for createComponent*
inspired by: https://github.com/Kdyby/Autowired
Installation
$ composer require geniv/nette-autowired
or
"geniv/nette-autowired": "^1.6"
require:
"php": ">=7.0", "nette/component-model": ">=2.3", "nette/di": ">=2.4", "nette/reflection": ">=2.4"
Include in application
base presenters:
class BasePresenter extends Presenter { use AutowiredComponent;
usage:
protected function createComponentDatagrid(string $name, IDatagridFactory $factory): DatagridFactory { return $factory->create(); }
or
protected function createComponentSomeone(Someone $someone): Someone { return $someone; }