/**
  * {@inheritDoc}
  */
 public function findMappingFile($className)
 {
     if (!$this->fileExists($className)) {
         throw MappingException::mappingFileNotFound($className, $this->paths[0]);
     }
     if (isset(self::$pathsMap[$className])) {
         $this->paths = self::$pathsMap[$className];
     }
     return $this->paths[0];
 }
Beispiel #2
0
 protected function _findMappingFile($className)
 {
     foreach ($this->_paths as $prefix => $path) {
         if (0 !== strpos($className, $prefix . '\\')) {
             continue;
         }
         $filename = $path . '/' . strtr(substr($className, strlen($prefix) + 1), '\\', '.') . $this->_fileExtension;
         if (file_exists($filename)) {
             return $filename;
         }
         throw MappingException::mappingFileNotFound($className, $filename);
     }
     throw MappingException::mappingFileNotFound($className, substr($className, strrpos($className, '\\') + 1) . $this->_fileExtension);
 }
Beispiel #3
0
    protected function _findMappingFile($className)
    {
        $defaultFileName = str_replace('\\', '.', $className) . $this->_fileExtension;
        foreach ($this->_paths as $path) {
            if (!isset($this->_prefixes[$path])) {
                if (file_exists($path . DIRECTORY_SEPARATOR . $defaultFileName)) {
                    return $path . DIRECTORY_SEPARATOR . $defaultFileName;
                }

                continue;
            }

            $prefix = $this->_prefixes[$path];

            if (0 !== strpos($className, $prefix.'\\')) {
                continue;
            }

            $filename = $path.'/'.strtr(substr($className, strlen($prefix)+1), '\\', '.').$this->_fileExtension;
            if (file_exists($filename)) {
                return $filename;
            }

            throw MappingException::mappingFileNotFound($className, $filename);
        }

        throw MappingException::mappingFileNotFound($className, substr($className, strrpos($className, '\\') + 1).$this->_fileExtension);
    }
 /**
  * Finds the mapping file for the class with the given name by searching
  * through the configured paths.
  *
  * @param $className
  * @return string The (absolute) file name.
  * @throws MappingException
  */
 protected function _findMappingFile($className)
 {
     $fileName = str_replace('\\', '.', $className) . $this->_fileExtension;
     // Check whether file exists
     foreach ((array) $this->_paths as $path) {
         if (file_exists($path . DIRECTORY_SEPARATOR . $fileName)) {
             return $path . DIRECTORY_SEPARATOR . $fileName;
         }
     }
     throw MappingException::mappingFileNotFound($className, $fileName);
 }