Register ORM entity managers.

@param array $settings

@throws \RuntimeException
183341
protected function registerEntityManagers(array $settings)
    {
        if (array_key_exists('connection', $settings)) {
            $settings = [$settings];
        }

        foreach ($settings as $name => $config) {
            if (!is_string($name)) {
                $name = $this->getOption(static::RELATIONAL_MANAGER_NAME);
            }

            $this->addBuilder(new RelationalBuilder($config, $name));
        }
    }
1114358
protected function resolveSettings(array $settings = [])
    {
        $defaultSettings = [
            'allow-credentiails' => false,
            'allow-headers'      => [],
            'expose-headers'     => [],
            'origins'            => [],
            'methods'            => [],
            'max-age'            => 0,
        ];

        $this->config->set([
            'cors' => array_merge($defaultSettings, $this->config->pull('cors')),
        ]);
    }
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);
        });
    }
1109892
public function injectSettings(array $settings)
    {
        $this->settings = $settings['persistence'];
        if (!is_array($this->settings['doctrine'])) {
            throw new InvalidConfigurationException(sprintf('The Neos.Flow.persistence.doctrine settings need to be an array, %s given.', gettype($this->settings['doctrine'])), 1392800005);
        }
    }
1179044
public function resolve(array $settings = [])
    {
        return new YamlDriver(
            Arr::get($settings, 'paths'),
            Arr::get($settings, 'extension', YamlDriver::DEFAULT_FILE_EXTENSION)
        );
    }
826104
private function registerSettingsManager()
    {
        $this->singleton(Contracts\Manager::class, function ($app) {
            return new SettingsManager($app);
        });

        $this->singleton(Contracts\Store::class, function ($app) {
            /** @var \Arcanedev\LaravelSettings\Contracts\Manager $manager */
            $manager = $app[Contracts\Manager::class];

            return $manager->driver();
        });
    }
1163254
public function addSlave(array $setting)
    {
        $database = new Database($setting);
        $database->setMaster($this);
        $this->_slaves[] = $database;
    }
958219
public static function settings($settings=array())
		{
			self::$_readOnce 		= isset($settings['readOnce']) ? (boolean) $settings['readOnce'] : false;
			self::$_defaultReturn 	= (array_key_exists('defaultReturn',$settings)) ? $settings['defaultReturn'] : 'ST__EXCEPTION';
		}
1015780
private function applyOrders(array $settings): void
    {
        $data = $this->getSource();
        // Create empty column stack
        $orders = [];
        foreach ($settings as $column => $order) {
            $orders[$column] = [];
        }

        // Obtain a list of columns
        foreach ($data as $key => $row) {
            foreach ($settings as $column => $order) {
                $orders[$column][$key] = $row[$column];
            }
        }

        // Prepare array of arguments
        $funcArgs = [];
        foreach ($settings as $column => $order) {
            $funcArgs[] = $orders[$column];
            $funcArgs[] = ($order === Grid\Grid::ORDER_ASC) ? SORT_ASC : SORT_DESC;
        }
        $funcArgs[] = &$data;

        // Sort the data with volume descending, edition ascending
        // Add $data as the last parameter, to sort by the common key
        array_multisort(...$funcArgs);
        $this->setSource($data);
    }
1340132
protected function combineSettings(array $settings)/*# : array */
    {
        return array_replace(
            $this->getBuilder()->getSettings(), // builder settings
            $this->getBuilder()->getDialect()->dialectSettings(), // dialect
            $settings,  // user settings
            $this->getSettings() // statement settings
        );
    }
478278
private function applyOrders(array $settings): array
    {
        $orders = [];
        // Obtain a list of columns
        foreach ($settings as $column => $order) {
            $column = Proxy\Db::quoteIdentifier($column);
            $orders[] = $column . ' ' . $order;
        }
        return $orders;
    }
1139110
public function addSettings(array $settings)
    {
        foreach ($settings as $key => $value) {
            $this->addSetting($key, $value);
        }
    }
1112117
public function register(ServiceProviderInterface $provider, $settings = [])
    {
        $provider->register($this);
        foreach ($settings as $key => $value) {
            $this->set($key, $value);
        }

        return $this;
    }
548838
protected function setUpEntityManagers()
    {
        $managers    = [];
        $connections = [];

        foreach ($this->config['managers'] as $manager => $settings) {
            $managerName    = IlluminateRegistry::getManagerNamePrefix() . $manager;
            $connectionName = IlluminateRegistry::getConnectionNamePrefix() . $manager;

            // Bind manager
            $this->app->singleton($managerName, function () use ($settings) {

                $manager = EntityManager::create(
                    ConnectionManager::resolve(array_get($settings, 'connection')),
                    MetaDataManager::resolve(array_get($settings, 'meta'))
                );

                $configuration = $manager->getConfiguration();

                // Listeners
                if (isset($settings['events']['listeners'])) {
                    foreach ($settings['events']['listeners'] as $event => $listener) {
                        $manager->getEventManager()->addEventListener($event, $listener);
                    }
                }

                // Subscribers
                if (isset($settings['events']['subscribers'])) {
                    foreach ($settings['events']['subscribers'] as $subscriber) {
                        $manager->getEventManager()->addEventSubscriber($subscriber);
                    }
                }

                // Filters
                if (isset($settings['filters'])) {
                    foreach ($settings['filters'] as $name => $filter) {
                        $configuration->getMetadataDriverImpl()->addFilter($name, $filter);
                        $manager->getFilters()->enable($name);
                    }
                }

                // Paths
                $configuration->getMetadataDriverImpl()->addPaths(
                    array_get($settings, 'paths', [])
                );

                // Repository
                $configuration->setDefaultRepositoryClassName(
                    array_get($settings, 'repository', \Doctrine\ORM\EntityRepository::class)
                );

                $configuration->setAutoGenerateProxyClasses(
                    array_get($settings, 'proxies.auto_generate', false)
                );

                if ($namespace = array_get($settings, 'proxies.namespace', false)) {
                    $configuration->setProxyNamespace($namespace);
                }

                return $manager;
            });

            // Bind connection
            $this->app->singleton($connectionName, function ($app) use ($manager) {
                $app->make(IlluminateRegistry::getManagerNamePrefix() . $manager)->getConnection();
            });

            $managers[$manager]    = $manager;
            $connections[$manager] = $manager;
        }

        return [$managers, $connections];
    }
94212
public function load(array $settings = null)
    {
        $classVars = array_keys(get_class_vars(get_class($this)));

        foreach ($settings as $name => $value) {
            if (in_array($name, $this->blacklistConfig, true)) {
                continue;
            }

            if (in_array($name, $classVars, true)) {
                $method = 'set' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase($name);
                if (method_exists($this, $method)) {
                    $this->configMapping += $this->configHelper->getNewSettingPath($name);
                    $this->{$method}($this->castToType($value, $name));
                } else {
                    $this->logger->debug(
                        'The evaluated method "' . $method . '" is not available in class ' . __CLASS__
                    );
                }
            } else {
                if (array_key_exists($name, $this->additionalSettings)) {
                    $this->additionalSettings[$name] = $value;
                } else {
                    $this->logger->debug(
                        'The given setting property "' . $name . '" is not available in class ' . __CLASS__
                    );
                }
            }
        }
    }
538913
protected function registerCouchDBDocumentManagers(array $settings)
    {
        if (array_key_exists('connection', $settings)) {
            $settings = [$settings];
        }

        foreach ($settings as $name => $config) {
            if (!is_string($name)) {
                $name = $this->getOption(static::COUCHDB_MANAGER_NAME);
            }

            $this->addBuilder(new CouchDBBuilder($config, $name));
        }
    }
361369
private function registerSettingsStore()
    {
        $this->bind('arcanedev.settings.store', function(Application $app) {
            return $app->make('arcanedev.settings.manager')->driver();
        });

        $this->bind(
            \Arcanedev\Settings\Contracts\Store::class,
            'arcanedev.settings.store'
        );
    }