I'm facing some problems with the GearmanBundle, since after the process of installation succeeded, I can find all my jobs and workers:
$ 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
As you can se, my gearman is installed on php:
$ php -i | grep gearman | grep enabled
gearman support => enabled
But when I call this:
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.';
}
It returns me this message:
request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\ClassNotFoundException: "Attempted to load class "GearmanClient" from the global namespace. Did you forget a "use" statement for "Mmoreram\GearmanBundle\Service\GearmanClient"?" at /var/www/stage/vendor/mmoreram/gearman-bundle/Mmoreram/GearmanBundle/Service/GearmanClient.php line 90 {"exception":"[object] (Symfony\Component\Debug\Exception\ClassNotFoundException(code: 0): Attempted to load class \"GearmanClient\" from the global namespace. Did you forget a \"use\" statement for \"Mmoreram\GearmanBundle\Service\GearmanClient\"? at /var/www/stage/vendor/mmoreram/gearman-bundle/Mmoreram/GearmanBundle/Service/GearmanClient.php:90)"} []
The bundle can't load the native GearmanClient() on global scope. Can you help me with this ?