Components/DB/NoSQL/Drivers/MongoDB/MongoDBDriver.php
public function configure(array $configuration)
    {
        // allows to use the default options when a null value is passed
        if (array_key_exists('options', $configuration) && $configuration['options'] === null) {
            unset($configuration['options']);
        }

        $optionsResolver = new OptionsResolver();
        $optionsResolver
            ->setDefined(['host', 'database', 'options', 'driver_options'])
            ->setDefaults([
                'options' => ['connect' => false],
                'driver_options' => ['typeMap' => ['root' => 'array', 'document' => 'array', 'array' => 'array']],
            ])
            ->setRequired(['host', 'database'])
            ->setAllowedTypes('host', 'string')
            ->setAllowedTypes('database', 'string')
            ->setAllowedTypes('options', 'array')
            ->setAllowedTypes('driver_options', 'array')
        ;

        try {
            $this->configuration = $optionsResolver->resolve($configuration);
        } catch (\Exception $e) {
            throw new NoSQLDriverException('Wrong configuration: '.$e->getMessage(), $e->getCode(), $e);
        }
    }
public function configure(array $configuration)
    {
        // allows to use the default options when a null value is passed
        if (array_key_exists('options', $configuration) && $configuration['options'] === null) {
            unset($configuration['options']);
        }

        $optionsResolver = new OptionsResolver();
        $optionsResolver
            ->setDefined(['host', 'database', 'options', 'driver_options'])
            ->setDefaults([
                'options' => ['connect' => false],
                'driver_options' => ['typeMap' => ['root' => 'array', 'document' => 'array', 'array' => 'array']],
            ])
            ->setRequired(['host', 'database'])
            ->setAllowedTypes('host', 'string')
            ->setAllowedTypes('database', 'string')
            ->setAllowedTypes('options', 'array')
            ->setAllowedTypes('driver_options', 'array')
        ;

        try {
            $this->configuration = $optionsResolver->resolve($configuration);
        } catch (\Exception $e) {
            throw new NoSQLDriverException('Wrong configuration: '.$e->getMessage(), $e->getCode(), $e);
        }
    }
public function configure ( array $ configuration ) { // allows to use the default options when a null value is passed if ( array_key_exists ( 'options' , $ configuration ) && $ configuration [ 'options' ] === null ) { unset ( $ configuration [ 'options' ] ) ; } $ optionsResolver = new OptionsResolver ( ) ; $ optionsResolver -> setDefined ( [ 'host' , 'database' , 'options' , 'driver_options' ] ) -> setDefaults ( [ 'options' => [ 'connect' => false ] , 'driver_options' => [ 'typeMap' => [ 'root' => 'array' , 'document' => 'array' , 'array' => 'array' ] ] , ] ) -> setRequired ( [ 'host' , 'database' ] ) -> setAllowedTypes ( 'host' , 'string' ) -> setAllowedTypes ( 'database' , 'string' ) -> setAllowedTypes ( 'options' , 'array' ) -> setAllowedTypes ( 'driver_options' , 'array' ) ; try { $ this -> configuration = $ optionsResolver -> resolve ( $ configuration ) ; } catch ( \ Exception $ e ) { throw new NoSQLDriverException ( 'Wrong configuration: ' . $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } }
Define and apply the expected configuration for the driver.

@param array $configuration

@throws \Smartbox\Integration\FrameworkBundle\Components\DB\NoSQL\Exceptions\NoSQLDriverException
Define and apply the expected configuration for the driver .