src/Norm/Norm.php
public static function createCollection($options)
    {
        $defaultConfig = isset(static::$collectionConfig['default'])
            ? static::$collectionConfig['default']
            : array();

        $config = null;

        if (isset(static::$collectionConfig['mapping'][$options['name']])) {
            $config =static::$collectionConfig['mapping'][$options['name']];
        } else {
            if (isset(static::$collectionConfig['resolvers']) and is_array(static::$collectionConfig['resolvers'])) {
                foreach (static::$collectionConfig['resolvers'] as $resolver => $resolverOpts) {
                    if (is_string($resolverOpts)) {
                        $resolver = $resolverOpts;
                        $resolverOpts = array();
                    }

                    $resolver = new $resolver($resolverOpts);
                    $config = $resolver->resolve($options);

                    if (isset($config)) {
                        break;
                    }
                }
            }
        }


        if (!isset($config)) {
            $config = array();
        }

        $config = array_merge_recursive($defaultConfig, $config);

        $options = array_merge_recursive($config, $options);

        if (isset($options['collection'])) {
            $Driver = $options['collection'];
            $collection = new $Driver($options);
        } else {
            $collection = new Collection($options);
        }

        return $collection;
    }
public static function createCollection($options)
    {
        $defaultConfig = isset(static::$collectionConfig['default'])
            ? static::$collectionConfig['default']
            : array();

        $config = null;

        if (isset(static::$collectionConfig['mapping'][$options['name']])) {
            $config =static::$collectionConfig['mapping'][$options['name']];
        } else {
            if (isset(static::$collectionConfig['resolvers']) and is_array(static::$collectionConfig['resolvers'])) {
                foreach (static::$collectionConfig['resolvers'] as $resolver => $resolverOpts) {
                    if (is_string($resolverOpts)) {
                        $resolver = $resolverOpts;
                        $resolverOpts = array();
                    }

                    $resolver = new $resolver($resolverOpts);
                    $config = $resolver->resolve($options);

                    if (isset($config)) {
                        break;
                    }
                }
            }
        }


        if (!isset($config)) {
            $config = array();
        }

        $config = array_merge_recursive($defaultConfig, $config);

        $options = array_merge_recursive($config, $options);

        if (isset($options['collection'])) {
            $Driver = $options['collection'];
            $collection = new $Driver($options);
        } else {
            $collection = new Collection($options);
        }

        return $collection;
    }
public static function createCollection ( $ options ) { $ defaultConfig = isset ( static :: $ collectionConfig [ 'default' ] ) ? static :: $ collectionConfig [ 'default' ] : array ( ) ; $ config = null ; if ( isset ( static :: $ collectionConfig [ 'mapping' ] [ $ options [ 'name' ] ] ) ) { $ config = static :: $ collectionConfig [ 'mapping' ] [ $ options [ 'name' ] ] ; } else { if ( isset ( static :: $ collectionConfig [ 'resolvers' ] ) and is_array ( static :: $ collectionConfig [ 'resolvers' ] ) ) { foreach ( static :: $ collectionConfig [ 'resolvers' ] as $ resolver => $ resolverOpts ) { if ( is_string ( $ resolverOpts ) ) { $ resolver = $ resolverOpts ; $ resolverOpts = array ( ) ; } $ resolver = new $ resolver ( $ resolverOpts ) ; $ config = $ resolver -> resolve ( $ options ) ; if ( isset ( $ config ) ) { break ; } } } } if ( ! isset ( $ config ) ) { $ config = array ( ) ; } $ config = array_merge_recursive ( $ defaultConfig , $ config ) ; $ options = array_merge_recursive ( $ config , $ options ) ; if ( isset ( $ options [ 'collection' ] ) ) { $ Driver = $ options [ 'collection' ] ; $ collection = new $ Driver ( $ options ) ; } else { $ collection = new Collection ( $ options ) ; } return $ collection ; }
Create collection by configuration.

@method createCollection

@param array $options

@return mixed|\Norm\Collection
Create collection by configuration .