Setup Eloquent ORM Service Provider.

@param Application $app
@source https://github.com/illuminate/database
548191
public function register(Application $app)
    {
        $this->eloquent = new EloquentCapsule();
        $config = Database::getDatabaseConfiguration();

        /*
         | We will loop over all connections
         | and set connection
         */
        foreach ($config as $key => $c) {
            $this->setConnection($c);
        }

        $this->eloquent->setEventDispatcher(new Dispatcher(new Container()));
        // Make this Capsule instance available globally via static methods... (optional)
        $this->eloquent->setAsGlobal();
        // Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
        $this->eloquent->bootEloquent();
    }
745453
public function register(Application $app)
    {
        $this->registerTranslationMessages($app);
        $this->registerWriters($app);
        $this->registerDependenciesOnXsltExtension($app);

        $app->register(new \phpDocumentor\Plugin\Graphs\ServiceProvider());
        $app->register(new \phpDocumentor\Plugin\Twig\ServiceProvider());
    }
290492
protected function setEnvironment(Application $app, ?string $env = null): void
    {
        $app->detectEnvironment(function () use ($env) {
            return $env ?: env('APP_ENV', 'production');
        });
    }
937988
public function bootstrap(Application $app)
    {
        foreach ($app['config']->get('supports', []) as $feature => $value)
        {
            if ($value === 'automatic-feed-links')
            {
                add_theme_support($value);
            }
            else
            {
                add_theme_support($feature, $value);
            }
        }
    }
720723
public function bootstrap(Application $app)
    {
        $uri = $app->make('config')->get('app.url', 'http://localhost');

        $components = parse_url($uri);

        $server = $_SERVER;

        if (isset($components['path'])) {
            $server = array_merge($server, [
                'SCRIPT_FILENAME' => $components['path'],
                'SCRIPT_NAME' => $components['path']
            ]);
        }

        $app->instance('request', Request::create(
            $uri,
            'GET',
            [],
            [],
            [],
            $server
        ));
    }
1118118
public function register(Application $app)
    {
        /** @var Translator $translator  */
        $translator = $app['translator'];

        /** @var Collection $writerCollection */
        $writerCollection = $app['transformer.writer.collection'];

        $writerCollection['twig'] = new Writer\Twig();
        $writerCollection['twig']->setTranslator($translator);
    }
688259
public function boot(Application $app)
    {
        if ($app['capsule.options']['bootEloquent']) {
            $app->before(function () use ($app) {
                $app['capsule'];
            }, Application::EARLY_EVENT);
        }
    }
285237
public function setApp(Application $app)
    {
        $this->app = $app;
        AppSingleton::set($app);
        $this->pathResolver = $app['path_resolver'];

        // if RM is passed directly into Application c.v.a won't be set
        // but if called later then we don't want to override the value if someone else has changed it,
        // unless disableApacheChecks has been called.
        $default = true;
        if (isset($this->app['config.validator.apache_enabled'])) {
            $default = $this->app['config.validator.apache_enabled'];
        }
        $this->app['config.validator.apache_enabled'] = function () use ($default) {
            return $this->disableApacheChecks ? false : $default;
        };
    }
35360
public function bootstrap(Application $app)
    {
        $app['actions']->listen(
            'init',
            function () use ($app) {

                $this->extractWordpressClasses($app);

                $this->setDefaultPermalinkStructure($app);

                $this->bootstrapRoutes($app['router']);
            }
        );
    }
184657
public function registerInterfaceBindings(Application $app)
    {
        $app->bind(ClientInterface::class, FluentClient::class);
        $app->bind(ScopeInterface::class, FluentScope::class);
        $app->bind(SessionInterface::class, FluentSession::class);
        $app->bind(AuthCodeInterface::class, FluentAuthCode::class);
        $app->bind(AccessTokenInterface::class, FluentAccessToken::class);
        $app->bind(RefreshTokenInterface::class, FluentRefreshToken::class);
    }
1105719
public function setApplication($app)
    {
        Argument::i()->test(1, 'string');

        $this->application = $app;
        return $this->setData($this->message);
    }
1079499
public function register(Application $app)
    {
        Assertion::isInstanceOf($app, \Alchemy\Phrasea\Application::class);

        $app['setup.validate-config'] = $app->protect(function (Request $request) use ($app) {
            if (0 === strpos($request->getPathInfo(), '/setup')) {
                if (!$app['phraseanet.configuration-tester']->isInstalled()) {
                    if (!$app['phraseanet.configuration-tester']->isBlank()) {
                        if ('setup_upgrade_instructions' !== $app['request']->attributes->get('_route')) {
                            return $app->redirectPath('setup_upgrade_instructions');
                        }
                    }
                } elseif (!$app['phraseanet.configuration-tester']->isBlank()) {
                    return $app->redirectPath('homepage');
                }
            } else {
                if (false === strpos($request->getPathInfo(), '/include/minify')) {
                    $app['firewall']->requireSetup();
                }
            }
        });
    }
261541
public function incoming(Application $app) {

        $route = $app->getService('router')
            ->findHttpRoute($this);

        /** Route is a callback execution */
        if (!empty($route->offsetGet('action'))) {
            //Route is a callback execution
            $app::getContainer()->offsetSet(
                'callback',
                $route
            );
	    
	    return;
        }

        /** Route is a service execution */
        //Set active unit
        $app->setActiveUnit(
            Application::APPLICATION_UNIT_NAMESPACE . $route->get('unit')
        );

        //Set active service
        if (!class_exists(
            $app->getActiveUnit() .
            Application::APPLICATION_SERVICES_TRAIL .
            $route->get('service'))
        ) {
            throw new \Nuki\Exceptions\Base('No available service has been found for the provided unit');
        }
        $app->setActiveService($route->get('service'));

        //Set active process
        $process = $this->buildProcess(
            $route->get('process'),
            $app->getActiveUnit() . Application::APPLICATION_SERVICES_TRAIL . $app->getActiveService()
        );
        $app->setActiveProcess($process);

        //Add params from service call to params-handler
        /** @var Params $paramsHandler */
        $paramsHandler = $app->getService('params-handler');

        $paramsHandler->add('route-params', $route->get('params'));
    }
284762
public function register(Application $app)
    {
        parent::register($app);

        $app->register(
            new \Silex\Provider\DoctrineServiceProvider(),
            ['db.options' => $app['config']['db.options']]
        );
        $app->register(
            new DoctrineOrmServiceProvider(),
            $app['config']['orm.options']
        );

        if (getenv('MIGRATION_COMMANDS')) {
            $app->register(new MigrationServiceProvider(), [
                'db.migrations.path' =>$app['config']['migrations.directory'],
            ]);
        }

        $app['orm.em'] = $app->extend('orm.em', function(EntityManagerInterface $em) use($app) {
            if (file_exists(APP_PATH.'/vendor/apitude/apitude/src/Annotations/APIAnnotations.php')) {
                AnnotationRegistry::registerFile(APP_PATH.'/vendor/apitude/apitude/src/Annotations/APIAnnotations.php');
            }
            /** @var Configuration $config */
            $config = $em->getConfiguration();
            $config->setMetadataCacheImpl($app['cache']);
            $config->addCustomHydrationMode('simple', SimpleHydrator::class);

            /** @var MappingDriverChain $driver */
            $driver = $config->getMetadataDriverImpl();

            // gedmo initialization
            $reader = new AnnotationReader();
            $cache = new CachedReader($reader, $app['cache']);
            DoctrineExtensions::registerAbstractMappingIntoDriverChainORM(
                $driver,
                $cache
            );

            return $em;
        });
    }
95834
public function bootstrap(Application $app)
    {
        $this->app = $app;

        error_reporting(-1);

        set_error_handler([$this, 'handleError']);

        set_exception_handler([$this, 'handleException']);

        register_shutdown_function([$this, 'handleShutdown']);

        if (! $app->environment('testing')) {
            ini_set('display_errors', 'Off');
        }
    }
245572
protected function injectInitialServices(ApplicationInterface $app)
    {
        $app->getServicesFactory()->registerService(
            ['id' => 'application', 'instance' => $app],
            
            // all those are here for convenience only since 'application' gives access to all of them
            ['id' => 'config', 'instance' => $app->getConfig()],
            ['id' => 'events-handler', 'instance' => $app->getEventsHandler()]
        )
        ;
    }
720230
public function register(Application $app)
    {
        $app['db'] = $app->share(function ($app) {
            return new Adapter($app['config']->load('db'));
        });

        $app['db.transaction'] = $app->share(function ($app) {
            return new Transaction($app['db']);
        });

        $app->initializer(
            'Synapse\\Db\\TransactionAwareInterface',
            function ($object, $app) {
                $object->setTransaction($app['db.transaction']);
                return $object;
            }
        );

        $this->registerMapperInitializer($app);
    }