php - Symfony 3 Injecting Services in Services with __construct -


having issue injecting services in services following: https://symfony.com/doc/current/service_container.html#injecting-services-config-into-a-service

this code:

namespace servicesbundle\services;  use symfony\bundle\frameworkbundle\controller\controller; use symfony\component\httpfoundation\session\sessioninterface; use symfony\component\httpfoundation\request; use symfony\component\httpfoundation\response; use doctrine\orm\entitymanagerinterface;  class services {  private $email;  public function __construct($email, $message, sessioninterface $sessint) {      $this->email = $email;     $this->message = $message;     $this->sessint = $sessint;  }  public function displaymessage(){       return "this services class in services namespace. email administrator @ " . $this->email . " | " . $this->message;  }  public function sessionidgetaction(){     $hello = $this->sessint->getid();     return $hello; } } 

throws error:

type error: argument 3 passed servicesbundle\services\services::__construct() must implement interface symfony\component\httpfoundation\session\sessioninterface, none given, called in /home/admin-daniel/symfony-test-sites/july262017/var/cache/dev/appdevdebugprojectcontainer.php on line 412

when call 1 of these functions controller.

i lost this. seems following guide says not working....

i missing somewhere...

if need inject session

service:    my.service.name:       class: ..\myclassname       arguments:          session: "@session" 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -