private function getCollectionDefinition($name, array $defaultDefinition = null)
    {
        if (isset($this->mapping[$name])) {
            $classDefinition = $this->mapping[$name];
        } elseif ($this->regexpMapping) {
            foreach ($this->regexpMapping as $collectionNamePattern => $regexpMappingClassDefinition) {
                if (preg_match($collectionNamePattern, $name, $matches)) {
                    $classDefinition = clone $regexpMappingClassDefinition;
                    $classDefinition->setOption('regexp', $matches);
                    break;
                }
            }
        }

        // mapping not configured - use default
        if (!isset($classDefinition)) {
            if (!empty($this->mapping['*'])) {
                $classDefinition = clone $this->mapping['*'];
                $collectionClass = $classDefinition->getClass()
                    . '\\'
                    . implode('\\', array_map('ucfirst', explode('.', $name)));
                $classDefinition->setClass($collectionClass);
            } else {
                $classDefinition = new Definition();
                if ($defaultDefinition) {
                    $classDefinition->merge($defaultDefinition);
                }
            }
        }

        // check if class exists
        if (!class_exists($classDefinition->getClass())) {
            throw new Exception(
                'Class ' . $classDefinition->getClass() . ' not found while map collection name to class'
            );
        }

        return $classDefinition;
    }
private function getCollectionDefinition($name, array $defaultDefinition = null)
    {
        if (isset($this->mapping[$name])) {
            $classDefinition = $this->mapping[$name];
        } elseif ($this->regexpMapping) {
            foreach ($this->regexpMapping as $collectionNamePattern => $regexpMappingClassDefinition) {
                if (preg_match($collectionNamePattern, $name, $matches)) {
                    $classDefinition = clone $regexpMappingClassDefinition;
                    $classDefinition->setOption('regexp', $matches);
                    break;
                }
            }
        }

        // mapping not configured - use default
        if (!isset($classDefinition)) {
            if (!empty($this->mapping['*'])) {
                $classDefinition = clone $this->mapping['*'];
                $collectionClass = $classDefinition->getClass()
                    . '\\'
                    . implode('\\', array_map('ucfirst', explode('.', $name)));
                $classDefinition->setClass($collectionClass);
            } else {
                $classDefinition = new Definition();
                if ($defaultDefinition) {
                    $classDefinition->merge($defaultDefinition);
                }
            }
        }

        // check if class exists
        if (!class_exists($classDefinition->getClass())) {
            throw new Exception(
                'Class ' . $classDefinition->getClass() . ' not found while map collection name to class'
            );
        }

        return $classDefinition;
    }
private function getCollectionDefinition ( $ name , array $ defaultDefinition = null ) { if ( isset ( $ this -> mapping [ $ name ] ) ) { $ classDefinition = $ this -> mapping [ $ name ] ; } elseif ( $ this -> regexpMapping ) { foreach ( $ this -> regexpMapping as $ collectionNamePattern => $ regexpMappingClassDefinition ) { if ( preg_match ( $ collectionNamePattern , $ name , $ matches ) ) { $ classDefinition = clone $ regexpMappingClassDefinition ; $ classDefinition -> setOption ( 'regexp' , $ matches ) ; break ; } } } // mapping not configured - use default if ( ! isset ( $ classDefinition ) ) { if ( ! empty ( $ this -> mapping [ '*' ] ) ) { $ classDefinition = clone $ this -> mapping [ '*' ] ; $ collectionClass = $ classDefinition -> getClass ( ) . '\\' . implode ( '\\' , array_map ( 'ucfirst' , explode ( '.' , $ name ) ) ) ; $ classDefinition -> setClass ( $ collectionClass ) ; } else { $ classDefinition = new Definition ( ) ; if ( $ defaultDefinition ) { $ classDefinition -> merge ( $ defaultDefinition ) ; } } } // check if class exists if ( ! class_exists ( $ classDefinition -> getClass ( ) ) ) { throw new Exception ( 'Class ' . $ classDefinition -> getClass ( ) . ' not found while map collection name to class' ) ; } return $ classDefinition ; }
Get class name mapped to collection

@param string        $name               name of collection
@param array         $defaultDefinition  definition used when no definition found for defined class
@throws Exception
@return string|array                     name of class or array of class definition
Get class name mapped to collection