Using symfony2. I have a listener class that is attempting to call a method from a different class (a controller) like so:
$authenticate = new AuthenticationController();
$authenticate->isTokenValid($token);
And the controller isTokenValid method:
public function isTokenValid($token) {
$conn = $this->get('database_connection');
Is throwing the error
Fatal error: Call to a member function get() on a non-object in /home/content/24/9254124/html/newsite/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php on line 246
If i load the controller method the proper way (using routing in the url) it works fine.