php - Symfony: Error: Call to a member function get() on a non-object -


in symfony2 __construct, code

public function __construct() {         $session = $this->getrequest()->getsession();     }  error: call member function get() on non-object in f:\xampp\htdocs\salon\vendor\symfony\symfony\src\symfony\bundle\frameworkbundle\controller\controller.php line 208 

please me,thx~

the method $this->getrequest() shortcut method $this->container->get('request') of basic controller. essentially, calling container request object. however, container in not available in basic controller's constructor. if need request object in controller's constructor, make service , inject request it.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -