symfony - Access a bundle (sncRedisBundle) from within an Extension -
i have installed sncredisbundle , used predis element of within controller, using:
$this->container->get('snc_redis.default');
i want same within extension:
class myextension extends extension { /** * {@inheritdoc} */ public function load(array $configs, containerbuilder $container) { $configuration = new configuration(); $config = $this->processconfiguration($configuration, $configs); $redis = $container->get('snc_redis.default'); } }
but get:
the service definition "snc_redis.default" not exist.
is scoping issue? how access redis within extension?
thanks!
services: site: class: emlaktown\appbundle\site\site arguments: [%api_url%, "@request_stack", "@service_container"]
....
use symfony\component\dependencyinjection\container;
....
public function __construct($apiurl, requeststack $requeststack, container $container) { $this->client = new client($apiurl); $this->redis = $container->get('snc_redis.cache'); $request = $requeststack->getcurrentrequest(); $this->client->setdefaultoption('accept-language', $request->getlocale()); }
Comments
Post a Comment