Having an issue with 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 is the Services Class in the Services namespace. Email the administrator @ " . $this->email . " | " . $this->message;
}
public function sessionIdGetAction(){
$hello = $this->sessInt->getID();
return $hello;
}
}
Throws this error:
Type error: Argument 3 passed to 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 I call any one of these functions from my controller.
I am lost with this. Seems I following what the guide says but not working....
I am missing something somewhere...