DependencyInjection/Compiler/RegisterJobsPass.php
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition($this->registryService) && !$container->hasAlias($this->registryService)) {
            return;
        }

        $customLogLevels = $container->getParameter('abc.job.logging.level');
        $registry        = $container->findDefinition('abc.job.registry');

        foreach ($container->findTaggedServiceIds($this->jobTag) as $id => $tags) {
            $def = $container->getDefinition($id);
            if (!$def->isPublic()) {
                throw new \InvalidArgumentException(sprintf('The service "%s" must be public as jobs are lazy-loaded.', $id));
            }

            foreach ($tags as $tag) {
                if (!isset($tag['type'])) {
                    throw new \InvalidArgumentException(sprintf('Service "%s" must define the "type" attribute on "%s" tags.', $id, $this->jobTag));
                }

                if (!isset($tag['method'])) {
                    throw new \InvalidArgumentException(sprintf('Service "%s" must define the "method" attribute on "%s" tags.', $id, $this->jobTag));
                }

                $logLevel  = isset($customLogLevels[$tag['type']]) ? $this->levelToMonologConst($customLogLevels[$tag['type']]) : null;
                $jobTypeId = 'abc.job.type.' . $tag['type'];

                $definition = $this->createType(
                    $id,
                    $tag['type'],
                    array(new Reference($id), $tag['method']),
                    $logLevel
                );

                $container->setDefinition($jobTypeId, $definition);

                $registry->addMethodCall('register', array(new Reference($jobTypeId), true));
            }
        }

        // there as a reason this listener was registered here, what was it?
        if ($container->hasParameter('abc.job.adapter') && $container->getParameter('abc.job.adapter') == 'sonata') {
            $pass = new RegisterSonataListenersPass();
            $pass->process($container);
        }
    }
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition($this->registryService) && !$container->hasAlias($this->registryService)) {
            return;
        }

        $customLogLevels = $container->getParameter('abc.job.logging.level');
        $registry        = $container->findDefinition('abc.job.registry');

        foreach ($container->findTaggedServiceIds($this->jobTag) as $id => $tags) {
            $def = $container->getDefinition($id);
            if (!$def->isPublic()) {
                throw new \InvalidArgumentException(sprintf('The service "%s" must be public as jobs are lazy-loaded.', $id));
            }

            foreach ($tags as $tag) {
                if (!isset($tag['type'])) {
                    throw new \InvalidArgumentException(sprintf('Service "%s" must define the "type" attribute on "%s" tags.', $id, $this->jobTag));
                }

                if (!isset($tag['method'])) {
                    throw new \InvalidArgumentException(sprintf('Service "%s" must define the "method" attribute on "%s" tags.', $id, $this->jobTag));
                }

                $logLevel  = isset($customLogLevels[$tag['type']]) ? $this->levelToMonologConst($customLogLevels[$tag['type']]) : null;
                $jobTypeId = 'abc.job.type.' . $tag['type'];

                $definition = $this->createType(
                    $id,
                    $tag['type'],
                    array(new Reference($id), $tag['method']),
                    $logLevel
                );

                $container->setDefinition($jobTypeId, $definition);

                $registry->addMethodCall('register', array(new Reference($jobTypeId), true));
            }
        }

        // there as a reason this listener was registered here, what was it?
        if ($container->hasParameter('abc.job.adapter') && $container->getParameter('abc.job.adapter') == 'sonata') {
            $pass = new RegisterSonataListenersPass();
            $pass->process($container);
        }
    }
{@inheritdoc}