Skip to content

Instantly share code, notes, and snippets.

@bakura10
Created January 4, 2014 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bakura10/8262026 to your computer and use it in GitHub Desktop.
Save bakura10/8262026 to your computer and use it in GitHub Desktop.
class DoctrineQueueFactory implements FactoryInterface
{
/**
* {@inheritDoc}
*/
public function createService(ServiceLocatorInterface $serviceLocator, $name = '', $requestedName = '')
{
$parentLocator = $serviceLocator->getServiceLocator();
/** @var $doctrineOptions \SlmQueueDoctrine\Options\DoctrineOptions */
$doctrineOptions = $parentLocator->get('SlmQueueDoctrine\Options\DoctrineOptions');
/** @var $connection \Doctrine\DBAL\Connection */
$connection = $parentLocator->get($doctrineOptions->getConnection());
$tableName = $doctrineOptions->getTableName();
$jobPluginManager = $parentLocator->get('SlmQueue\Job\JobPluginManager');
$moduleOptions = $parentLocator->get('SlmQueue\Options\ModuleOptions');
$queues = $moduleOptions->getQueuesOptions();
$queueOptions = new DoctrineQueueOptions(isset($queues[$requestedName]) ? $queues[$requestdNma] : array());
$queue = new DoctrineQueue($connection, $tableName, $requestedName, $jobPluginManager);
$config = $parentLocator->get('Config');
$options = isset($config['slm_queue']['queues'][$requestedName]) ? $config['slm_queue']['queues'][$requestedName] : array();
return $queue;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment