Register Doctrine Configuration
516039
public function loadDoctrineConfiguration(): void
	{
		$builder = $this->getContainerBuilder();
		$config = $this->validateConfig($this->defaults['configuration'], $this->config['configuration']);

		$logger = $builder->addDefinition($this->prefix('logger'))
			->setType(LoggerChain::class)
			->setAutowired('self');

		$configuration = $builder->addDefinition($this->prefix('configuration'));
		$configuration->setFactory(Configuration::class)
			->setAutowired(false)
			->addSetup('setSQLLogger', [$this->prefix('@logger')]);

		// SqlLogger (append to chain)
		if ($config['sqlLogger'] !== null) {
			$logger->addSetup('addLogger', [$config['sqlLogger']]);
		}

		// ResultCacheImpl
		if ($config['resultCacheImpl'] !== null) {
			$configuration->addSetup('setResultCacheImpl', [$config['resultCacheImpl']]);
		}

		// FilterSchemaAssetsExpression
		if ($config['filterSchemaAssetsExpression'] !== null) {
			$configuration->addSetup('setFilterSchemaAssetsExpression', [$config['filterSchemaAssetsExpression']]);
		}

		// AutoCommit
		Validators::assert($config['autoCommit'], 'bool', 'configuration.autoCommit');
		$configuration->addSetup('setAutoCommit', [$config['autoCommit']]);
	}
480843
protected function registerSettings()
    {
        $this->app->singleton('jlourenco.settings', function ($app) {
            $config = $app['config']->get('jlourenco.base');

            $model = array_get($config, 'models.Settings');

            return new SettingsRepository($model);
        });
    }
198716
protected function registerCustomBindings(): void
    {
        $repositoryFactory = $this->app->make(IRepositoryFactory::class);

        foreach (config('laravel_repositories.bindings') as $className => $repository) {
            $repositoryFactory->register($className, $repository);
        }
    }
1035876
public function registerConfiguredProviders()
	{
		$manifestPath = $this->getCachedServicesPath();

		(new ProviderRepository($this, new Filesystem, $manifestPath))
					->load($this->config['app.providers']);
	}
303060
private function registerBase()
    {
        if (!empty($this['config']['cache']) && $this['config']['cache'] instanceof CacheInterface) {
            $this['cache'] = $this['config']['cache'];
        } else {
            $this['cache'] = function () {
                return new FilesystemCache(sys_get_temp_dir());
            };
        }

        $this['access_token'] = function () {
            return new AccessToken(
                $this['config']['appID'],
                $this['config']['appKey'],
                $this['config']['custID']
            );
        };

    }
256122
public function load(array $configs, ContainerBuilder $container)
    {
        parent::load($configs, $container);

        // Only load doctrine configuration if bundle is enabled
        if (array_key_exists('DoctrineBundle', $container->getParameter('kernel.bundles'))) {
            $doctrineLoader = new ServiceLoader($container);
            $doctrineLoader->loadFiles(__DIR__.'/../Resources/config/doctrine');
        }

        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $registry = $container->getDefinition(QueryHandlerRegistry::class);
        /** @var array $configurations */
        $configurations = $config['configurations'];
        foreach ($configurations as $code => $configuration) {
            $registry->addMethodCall('addRawQueryHandlerConfiguration', [$code, $configuration]);
        }
    }
177907
private function registerServices(ContainerBuilder $container, $config)
    {
        if ($config['annotation']['enabled']) {
            $this->verifyDoctrineBridgeExists('annotation');
            $container->register('cache.service.annotation', DoctrineCacheBridge::class)
                ->setFactory([DoctrineBridgeFactory::class, 'get'])
                ->addArgument(new Reference($config['annotation']['service_id']))
                ->addArgument($config['annotation'])
                ->addArgument(['annotation']);
        }

        if ($config['serializer']['enabled']) {
            $this->verifyDoctrineBridgeExists('serializer');
            $container->register('cache.service.serializer', DoctrineCacheBridge::class)
                ->setFactory([DoctrineBridgeFactory::class, 'get'])
                ->addArgument(new Reference($config['serializer']['service_id']))
                ->addArgument($config['serializer'])
                ->addArgument(['serializer']);
        }

        if ($config['validation']['enabled']) {
            $container->register('cache.service.validation', SymfonyValidatorBridge::class)
                ->setFactory([ValidationFactory::class, 'get'])
                ->addArgument(new Reference($config['validation']['service_id']))
                ->addArgument($config['validation']);
        }

        if ($config['session']['enabled']) {
            $container->register('cache.service.session', Psr6SessionHandler::class)
                ->setFactory([SessionHandlerFactory::class, 'get'])
                ->addArgument(new Reference($config['session']['service_id']))
                ->addArgument($config['session']);
        }

        if ($config['router']['enabled']) {
            $container->register('cache.service.router', CachingRouter::class)
                ->setFactory([RouterFactory::class, 'get'])
                ->setDecoratedService('router', null, 10)
                ->addArgument(new Reference($config['router']['service_id']))
                ->addArgument(new Reference('cache.service.router.inner'))
                ->addArgument($config['router']);
        }
    }
1369341
public function registerApplicationConfig()
    {
        $this->singleton(ApplicationConfig::class, function () {
            return new ApplicationConfig($this->getConfigFiles());
        });

        $this->alias(ApplicationConfig::class, 'config');
    }
1112753
private function processEntityManager()
	{
		$builder = $this->getContainerBuilder();

		$configuration = $builder->addDefinition($this->prefix('configuration'))
			->setClass(Configuration::class)
			->addSetup('$service->setMetadataDriverImpl($this->getService(?))', [$this->prefix('metadata.driver')])
			->addSetup('$service->setMetadataCacheImpl(?)', ['@' . $this->prefix('cache.metadata')])
			->addSetup('$service->setQueryCacheImpl(?)', ['@' . $this->prefix('cache.query')])
			->addSetup('$service->setResultCacheImpl(?)', ['@' . $this->prefix('cache.result')])
			->addSetup('$service->setHydrationCacheImpl(?)', ['@' . $this->prefix('cache.hydration')])
			->addSetup('$service->setProxyDir(?)', [$this->config['proxyDir']])
			->addSetup('$service->setProxyNamespace(?)', [$this->config['proxyNamespace']])
			->addSetup('$service->setNamingStrategy(?)', [new \Nette\DI\Statement('Doctrine\ORM\Mapping\UnderscoreNamingStrategy')])
			->addSetup('$service->setQuoteStrategy(?)', [new \Nette\DI\Statement('Doctrine\ORM\Mapping\DefaultQuoteStrategy')])
			->addSetup('$service->setAutoGenerateProxyClasses(?)', [1])
			->addSetup('$service->setEntityListenerResolver(?)', ['@' . $this->prefix('entityListenerResolver')]);

		$entityManager = $builder->addDefinition($this->prefix('entityManager'))
			->setClass(EntityManager::class)
			->setFactory(EntityManager::class . '::create', [
				'@' . $this->prefix('connection'),
				'@' . $this->prefix('configuration'),
				'@' . $this->prefix('eventManager')
			]);
	}
61790
public function register()
    {
        $this->container->bind('config', new Repository(
            new FileLoader(
                new Filesystem,
                $this->container->appPath().'/config'
            ),
            new Resolver,
            $this->container->os()
        ));
    }
27864
private function registerConfig()
    {
        /**
         * @param Container $di
         * @return Config
         */
        $this->getContainer()[Config::CONTAINER_ID] = function(Container $di){
            /* @var ConfigLoaderInterface $loader */
            $loader = $di[ConfigLoaderInterface::CONTAINER_ID];
            $params = $loader->load();
            $config = new Config();
            $config->setParams($params);
            return $config;
        };
    }
720866
protected function configure(): void
    {
        // First command : Test the DB Connexion
        $this->setName($this->command)
            ->setDescription(
                'Generate configuration for the Anonymizer'
            )->setHelp(
                'This command will connect to a DB and extract a list of tables / fields to a yaml file'.PHP_EOL.
                "Usage: neuralyzer <info>{$this->command} -u app -p app -f neuralyzer.yml</info>"
            )->addOption(
                'driver',
                'D',
                InputOption::VALUE_REQUIRED,
                'Driver (check Doctrine documentation to have the list)',
                'pdo_mysql'
            )->addOption(
                'host',
                'H',
                InputOption::VALUE_REQUIRED,
                'Host',
                '127.0.0.1'
            )->addOption(
                'db',
                'd',
                InputOption::VALUE_REQUIRED,
                'Database Name'
            )->addOption(
                'user',
                'u',
                InputOption::VALUE_REQUIRED,
                'User Name',
                get_current_user()
            )->addOption(
                'password',
                'p',
                InputOption::VALUE_REQUIRED,
                "Password (or it'll be prompted)"
            )->addOption(
                'file',
                'f',
                InputOption::VALUE_REQUIRED,
                'File',
                'neuralyzer.yml'
            )->addOption(
                'protect',
                null,
                InputOption::VALUE_NONE,
                'Protect IDs and other fields'
            )->addOption(
                'ignore-table',
                null,
                InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
                'Table to ignore. Can be repeated'
            )->addOption(
                'ignore-field',
                null,
                InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
                'Field to ignore. Regexp in the form "table.field". Can be repeated'
            );
    }
1051371
public function addDsmParamsToConfig(Configuration $doctrineConfig, ConfigInterface $config): void
    {
        $paths          = $this->getPathInformation($config);
        $namingStrategy = $config->get(ConfigInterface::PARAM_DOCTRINE_NAMING_STRATEGY);
        $driver         = new StaticPHPDriver($paths);
        $doctrineConfig->setMetadataDriverImpl($driver);
        $doctrineConfig->setNamingStrategy($namingStrategy);
    }
1144281
public function loadConfiguration(): void
	{
		$builder = $this->getContainerBuilder();
		$config = $this->validateConfig($this->defaults);

		Validators::assertField($config, 'middlewares', 'array');

		// Register middleware chain builder
		$chain = $builder->addDefinition($this->prefix('chain'))
			->setAutowired(false);

		if ($config['debug'] !== true) {
			$chain->setFactory(ChainBuilder::class);
		} else {
			$chain->setFactory(DebugChainBuilder::class);

			$builder->addDefinition($this->prefix('middlewaresPanel'))
				->setFactory(MiddlewaresPanel::class, [$chain]);
		}
	}
404593
protected function registerConfigPublishCommand()
    {
        $this->app->bindShared('config.publisher', function($app)
        {
            $path = $app['path'] .DS .'Config';

            $publisher = new ConfigPublisher($app['files'], $app['config'], $path);

            return $publisher;
        });

        $this->app->bindShared('command.config.publish', function($app)
        {
            $configPublisher = $app['config.publisher'];

            return new ConfigPublishCommand($configPublisher);
        });
    }
1354237
public function setup()
    {
        $app = $this->getApplication();

        $options = $app->config('doctrine');
        if (is_array($options)) {
            $this->setOptions($this->options, $options);
        }

        $proxyDir = $this->getOption('proxy_path');
        $cache = DoctrineCacheFactory::configureCache($this->getOption('cache_driver'));

        $config = Setup::createConfiguration(!!$app->config('debug'), $proxyDir, $cache);
        $config->setNamingStrategy(new UnderscoreNamingStrategy());

        $this->setupAnnotationMetadata();

        if (!$this->setupMetadataDriver($config)) {
            throw new \RuntimeException('No Metadata Driver defined');
        }
        $config->setAutoGenerateProxyClasses($this->getOption('auto_generate_proxies', true) == true);

        $connection = $this->getOption('connection');

        $app->container->singleton(
            'entityManager',
            function () use ($connection, $config) {
                return EntityManager::create($connection, $config);
            }
        );
    }
214788
private function registerDatabaseConfig()
    {
        $this->app->bindShared('config/database', function ($app) {
            $loader = $app->make('Concrete\Core\Config\DatabaseLoader');
            $saver = $app->make('Concrete\Core\Config\DatabaseSaver');

            return $app->build('Concrete\Core\Config\Repository\Repository', array($loader, $saver, $app->environment()));
        });
    }