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

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -