Search code examples
phpsymfonypsr-0

Filename of workers in Symfony Gearman bundle


On Symfony, I use Gearman to queue some jobs with Ulabox GearmanBundle as the application-side library.

I read how a worker should be created in the readme of the bundle, and understood that I should create a class in the src/Acme/DemoBundle/Gearman/Worker. What I didn't understood is: how should I name the file ?


Solution

  • As of PSR-0, which is the PHP autoloading convention, you class should be in a file with the same name than your class.

    Example: \Acme\DemoBundle\Gearman\Worker\FooWorker will be contained in the file Acme/DemoBundle/Gearman/Worker/FooWorker.php

    Take the time to read the linked spec, as it have more examples.