private function cleanupConnections()
    {
        foreach (['runtime', 'generator'] as $section) {
            if (!isset($this->config[$section]['connections']) || count($this->config[$section]['connections']) === 0) {
                $this->config[$section]['connections'] = array_keys($this->config['database']['connections']);
            }

            if (!isset($this->config[$section]['defaultConnection'])) {
                //The previous `array_keys` instruction has moved the pointer to the last element of the array, so the last
                //connection is set as default, instead of the first one. To avoid this, we reset the array.
                reset($this->config['database']['connections']);
                $this->config[$section]['defaultConnection'] = key($this->config['database']['connections']);
            }

            foreach ($this->config[$section]['connections'] as $connection) {
                if (!array_key_exists($connection, $this->config['database']['connections'])) {
                    throw new InvalidConfigurationException("`$connection` isn't a valid configured connection (Section: propel.$section.connections). ".
                        "Please, check your configured connections in `propel.database.connections` section of your configuration file.");
                }
            }

            if (!array_key_exists($defaultConnection = $this->config[$section]['defaultConnection'], $this->config['database']['connections'])) {
                throw new InvalidConfigurationException("`$defaultConnection` isn't a valid configured connection (Section: propel.$section.defaultConnection). ".
                    "Please, check your configured connections in `propel.database.connections` section of your configuration file.");
            }
        }
    }
private function cleanupConnections()
    {
        foreach (['runtime', 'generator'] as $section) {
            if (!isset($this->config[$section]['connections']) || count($this->config[$section]['connections']) === 0) {
                $this->config[$section]['connections'] = array_keys($this->config['database']['connections']);
            }

            if (!isset($this->config[$section]['defaultConnection'])) {
                //The previous `array_keys` instruction has moved the pointer to the last element of the array, so the last
                //connection is set as default, instead of the first one. To avoid this, we reset the array.
                reset($this->config['database']['connections']);
                $this->config[$section]['defaultConnection'] = key($this->config['database']['connections']);
            }

            foreach ($this->config[$section]['connections'] as $connection) {
                if (!array_key_exists($connection, $this->config['database']['connections'])) {
                    throw new InvalidConfigurationException("`$connection` isn't a valid configured connection (Section: propel.$section.connections). ".
                        "Please, check your configured connections in `propel.database.connections` section of your configuration file.");
                }
            }

            if (!array_key_exists($defaultConnection = $this->config[$section]['defaultConnection'], $this->config['database']['connections'])) {
                throw new InvalidConfigurationException("`$defaultConnection` isn't a valid configured connection (Section: propel.$section.defaultConnection). ".
                    "Please, check your configured connections in `propel.database.connections` section of your configuration file.");
            }
        }
    }
private function cleanupConnections ( ) { foreach ( [ 'runtime' , 'generator' ] as $ section ) { if ( ! isset ( $ this -> config [ $ section ] [ 'connections' ] ) || count ( $ this -> config [ $ section ] [ 'connections' ] ) === 0 ) { $ this -> config [ $ section ] [ 'connections' ] = array_keys ( $ this -> config [ 'database' ] [ 'connections' ] ) ; } if ( ! isset ( $ this -> config [ $ section ] [ 'defaultConnection' ] ) ) { //The previous `array_keys` instruction has moved the pointer to the last element of the array, so the last //connection is set as default, instead of the first one. To avoid this, we reset the array. reset ( $ this -> config [ 'database' ] [ 'connections' ] ) ; $ this -> config [ $ section ] [ 'defaultConnection' ] = key ( $ this -> config [ 'database' ] [ 'connections' ] ) ; } foreach ( $ this -> config [ $ section ] [ 'connections' ] as $ connection ) { if ( ! array_key_exists ( $ connection , $ this -> config [ 'database' ] [ 'connections' ] ) ) { throw new InvalidConfigurationException ( "`$connection` isn't a valid configured connection (Section: propel.$section.connections). " . "Please, check your configured connections in `propel.database.connections` section of your configuration file." ) ; } } if ( ! array_key_exists ( $ defaultConnection = $ this -> config [ $ section ] [ 'defaultConnection' ] , $ this -> config [ 'database' ] [ 'connections' ] ) ) { throw new InvalidConfigurationException ( "`$defaultConnection` isn't a valid configured connection (Section: propel.$section.defaultConnection). " . "Please, check your configured connections in `propel.database.connections` section of your configuration file." ) ; } } }
If not defined, set `runtime` and `generator` connections, based on `database.connections` property.
Check if runtime and generator connections are correctly defined.
If not defined set runtime and generator connections based on database . connections property . Check if runtime and generator connections are correctly defined .