我遇到了GearmanBundle的一些问题,因为在安装过程成功后,我可以找到我所有的工作和 Worker :

$ app / console gearman:worker:list @Worker:HeloBundle \ Workers \ PushWorker callablename:HeloBundleWorkersPushWorker Jobs:1 name:sendPushJob callablename:HeloBundleWorkersPushWorker~sendPushJob @Worker:HeloBundle \ Workers \ EmailWorker callablename:HeloBundleWorkersEmailWorker Jobs:2 name:sendMailJob callablename :HeloBundleWorkersEmailWorker~sendMailJob

你可以,我的装备安装在PHP上:

$ php -i | grep gearman | grep启用gearman support =>启用

但是当我这样称呼时:

try
 {
                $gearman = $this->container->get('gearman');
                $gearman->doBackgroundJob('HeloBundleWorkersPushWorker~sendPushJob', json_encode(array(
                        'tags' => $tags,
                        'message' => $message,
                        'all' => $all
                    )));
                $flash['type'] = 'notice';
                $flash['message'] = 'Success.';
            } catch (\Exception $e) {
                $flash['type'] = 'warning';
                $flash['message'] = 'Error.';
            }

它返回给我这条消息:

request.CRITICAL:未捕获的PHP异常Symfony \ Component \ Debug \ Exception \ ClassNotFoundException:“尝试从全局命名空间加载类”GearmanClient“ . 您是否忘记了”Mmoreram \ GearmanBundle \ Service \ GearmanClient“的”use“语句? “ at /var/www/stage/vendor/mmoreram/gearman-bundle/Mmoreram/GearmanBundle/Service/GearmanClient.php第90行{“exception”:“[object](Symfony \ Component \ Debug \ Exception \ ClassNotFoundException(code:0) ):尝试从全局命名空间加载类\“GearmanClient \” . \ n你忘了在/ var / www / stage / vendor /上的\“Mmoreram \ GearmanBundle \ Service \ GearmanClient \”的\“use \”语句mmoreram / gearman-bundle / Mmoreram / GearmanBundle / Service / GearmanClient.php:90)“} []

bundle无法在全局范围内加载本机GearmanClient() . 你能帮我解决这个问题吗?