@inject with default value (optional service)
Notice: This thread is very old.
- matopeto
- Member | 395
In nette 2.0 i used to write optional services as:
<?php
function injectService(Service $service = null) {
$this->service = $service;
}
?>
That make Service optional (If service was not defined in config, it has default null value).
Is any way to do that with @inject annotation?
This doesn't work:
<?php
/** @var Service @inject */
public $service = null;
?>
And I know that I can use old style, but I would like use this with simple @inject annotation.
(Sorry for my bad english:))