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
Post a Comment