Symfony Call to a member function get() on null -


i use symfony components in own framework. installed di component , tried in basecontroller time same error:

call member function get() on null

my base controller:

abstract class basecontroller implements containerawareinterface {     use containerawaretrait;     ... } 

and when try access $this->container->get('ser_id'); return call member function.

how slove this?

update:

only work if include in controller service container

$this->service_container = include __dir__ .'/../../../container.php'; 

and use this:

$this->service_container->get('id'); 


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -