public function SymfonyFileLocator::findMappingFile in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/SymfonyFileLocator.php \Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator::findMappingFile()
Locates mapping file for the given class name.
Parameters
string $className:
Return value
string
Overrides FileLocator::findMappingFile
File
- vendor/
doctrine/ common/ lib/ Doctrine/ Common/ Persistence/ Mapping/ Driver/ SymfonyFileLocator.php, line 211
Class
- SymfonyFileLocator
- The Symfony File Locator makes a simplifying assumptions compared to the DefaultFileLocator. By assuming paths only contain entities of a certain namespace the mapping files consists of the short classname only.
Namespace
Doctrine\Common\Persistence\Mapping\DriverCode
public function findMappingFile($className) {
$defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension;
foreach ($this->paths as $path) {
if (!isset($this->prefixes[$path])) {
if (is_file($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->nsSeparator) . $this->fileExtension;
if (is_file($filename)) {
return $filename;
}
throw MappingException::mappingFileNotFound($className, $filename);
}
throw MappingException::mappingFileNotFound($className, substr($className, strrpos($className, '\\') + 1) . $this->fileExtension);
}