Sfoglia il codice sorgente

Merge pull request #12 from thorsten/development

Added possibility to automatically set container on workers implementing...
Marc 13 anni fa
parent
commit
eb9ce31157

+ 3 - 3
lib/Mmoreramerino/GearmanBundle/Service/GearmanExecute.php

@@ -47,13 +47,13 @@ class GearmanExecute extends GearmanService
             $this->addServers($gmworker, $worker['servers']);
             $this->addServers($gmworker, $worker['servers']);
         }
         }
 
 
-
-
-
         if (null !== $worker['service']) {
         if (null !== $worker['service']) {
             $objInstance = $this->container->get($worker['service']);
             $objInstance = $this->container->get($worker['service']);
         } else {
         } else {
             $objInstance = new $worker['className'];
             $objInstance = new $worker['className'];
+            if ($objInstance instanceof \Symfony\Component\DependencyInjection\ContainerAwareInterface) {
+                $objInstance->setContainer($this->container);
+            }
         }
         }
 
 
         foreach ($jobs as $job) {
         foreach ($jobs as $job) {