Inject Silex $app in my custom class
问题 I'm on a Silex project and I use classes to different treatments: $connection = new Connection($app); $app->match('/connection', function () use ($app, $connection) { $connexion->connectMember(); return $app->redirect($app['url_generator']->generate('goHome')); })->method('GET|POST')->bind('doConnection'); In the function 'connectMember()' of my class 'Connection', I have : [...] if($isMember){ [...] }else{ return $this->_app['twig']->render( 'message.twig', array('msg' => "This member does