Predavanie parametrov a zavislosti v neone pre services
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
- duskohu
- Člen | 778
Viete mi poradit ako predam parameter v neone pre services? Vracia mi
to:
php: 5.3.13
nette: 2.1-dev
https://github.com/…7c9112366790
Service 'nsmailer': Parameter $templateThemeDir in NsMailer::__construct() has no type hint, so its value must be specified.
neon:
common:
parameters:
theme:
templateThemeDir: 'myTheme'
smtp:
smtp: true
host: 'smtp-...'
username: 'admin@...'
password: '.....'
secure: 'ssl'
nette:
mailer: %smtp%
services:
NsMailer:
class: NsMailer(%theme.templateThemeDir%)
class NsMailer extends Nette\Object {
private $mailer;
private $templateThemeDir;
public function __construct($templateThemeDir, \Nette\Mail\SmtpMailer $mailer) {
$this->mailer = $mailer;
$this->templateThemeDir = $tmplateThemeDir;
}
}