Doctrine\OXM\OXMException::mappingNotFound PHP Method

mappingNotFound() public static method

public static mappingNotFound ( $className, $fieldName )
    public static function mappingNotFound($className, $fieldName)
    {
        return new self("No mapping found for field '{$fieldName}' in class '{$className}'.");
    }

Usage Example

 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 OXMException::mappingNotFound($className, $filename);
     }
     throw OXMException::mappingNotFound($className, substr($className, strrpos($className, '\\') + 1) . $this->fileExtension);
 }