private function loadServices(Config $config, $serviceId, callable $recipe = null)
    {
        if (false === $this->runRecipe($config, $recipe)) {
            $directories = array_unique(array_merge(
                            BundleConfigDirectory::getDirectories(
                                    $this->application->getBaseRepository(),
                                    $this->application->getContext(),
                                    $this->application->getEnvironment(),
                                    str_replace('bundle.', '', $serviceId)
                            ), BundleConfigDirectory::getDirectories(
                                    $this->application->getBaseRepository(),
                                    $this->application->getContext(),
                                    $this->application->getEnvironment(),
                                    basename(dirname($config->getBaseDir()))
            )));
            array_unshift($directories, $this->getConfigDirByBundleBaseDir(dirname($config->getBaseDir())));

            foreach ($directories as $directory) {
                $filepath = $directory.DIRECTORY_SEPARATOR.'services.xml';
                if (is_file($filepath) && is_readable($filepath)) {
                    try {
                        ServiceLoader::loadServicesFromXmlFile($this->container, $directory);
                    } catch (\Exception $e) {
                        // nothing to do
                    }
                }

                $filepath = $directory.DIRECTORY_SEPARATOR.'services.yml';
                if (is_file($filepath) && is_readable($filepath)) {
                    try {
                        ServiceLoader::loadServicesFromYamlFile($this->container, $directory);
                    } catch (\Exception $e) {
                        // nothing to do
                    }
                }
            }
        }
    }
private function loadServices(Config $config, $serviceId, callable $recipe = null)
    {
        if (false === $this->runRecipe($config, $recipe)) {
            $directories = array_unique(array_merge(
                            BundleConfigDirectory::getDirectories(
                                    $this->application->getBaseRepository(),
                                    $this->application->getContext(),
                                    $this->application->getEnvironment(),
                                    str_replace('bundle.', '', $serviceId)
                            ), BundleConfigDirectory::getDirectories(
                                    $this->application->getBaseRepository(),
                                    $this->application->getContext(),
                                    $this->application->getEnvironment(),
                                    basename(dirname($config->getBaseDir()))
            )));
            array_unshift($directories, $this->getConfigDirByBundleBaseDir(dirname($config->getBaseDir())));

            foreach ($directories as $directory) {
                $filepath = $directory.DIRECTORY_SEPARATOR.'services.xml';
                if (is_file($filepath) && is_readable($filepath)) {
                    try {
                        ServiceLoader::loadServicesFromXmlFile($this->container, $directory);
                    } catch (\Exception $e) {
                        // nothing to do
                    }
                }

                $filepath = $directory.DIRECTORY_SEPARATOR.'services.yml';
                if (is_file($filepath) && is_readable($filepath)) {
                    try {
                        ServiceLoader::loadServicesFromYamlFile($this->container, $directory);
                    } catch (\Exception $e) {
                        // nothing to do
                    }
                }
            }
        }
    }
private function loadServices ( Config $ config , $ serviceId , callable $ recipe = null ) { if ( false === $ this -> runRecipe ( $ config , $ recipe ) ) { $ directories = array_unique ( array_merge ( BundleConfigDirectory :: getDirectories ( $ this -> application -> getBaseRepository ( ) , $ this -> application -> getContext ( ) , $ this -> application -> getEnvironment ( ) , str_replace ( 'bundle.' , '' , $ serviceId ) ) , BundleConfigDirectory :: getDirectories ( $ this -> application -> getBaseRepository ( ) , $ this -> application -> getContext ( ) , $ this -> application -> getEnvironment ( ) , basename ( dirname ( $ config -> getBaseDir ( ) ) ) ) ) ) ; array_unshift ( $ directories , $ this -> getConfigDirByBundleBaseDir ( dirname ( $ config -> getBaseDir ( ) ) ) ) ; foreach ( $ directories as $ directory ) { $ filepath = $ directory . DIRECTORY_SEPARATOR . 'services.xml' ; if ( is_file ( $ filepath ) && is_readable ( $ filepath ) ) { try { ServiceLoader :: loadServicesFromXmlFile ( $ this -> container , $ directory ) ; } catch ( \ Exception $ e ) { // nothing to do } } $ filepath = $ directory . DIRECTORY_SEPARATOR . 'services.yml' ; if ( is_file ( $ filepath ) && is_readable ( $ filepath ) ) { try { ServiceLoader :: loadServicesFromYamlFile ( $ this -> container , $ directory ) ; } catch ( \ Exception $ e ) { // nothing to do } } } } }
Loads bundle services into application's dependency injection container.

@param Config        $config
@param string        $serviceId
@param callable|null $recipe
Loads bundle services into application s dependency injection container .