Using symfony2. I have a listener class that is attempting to call a method from a different class (a controller) like so:
$authenticate = new Authe
I'm adding another answer because what @dev-null-dweller suggests is a bad practice: in almost every case you better to inject only the services you need — not the whole container:
use Doctrine\DBAL\Connection;
public function __construct(Connection $connection)
{
$this->connection = $connection;
}
my_listener:
arguments: [ @database_connection ]