public function getModelInstance($fileType, $parentType)
    {
        if (! isset($this->supportedFileModels[$this->getFileTypeIdentifier($fileType, $parentType)])) {
            throw new FileException(
                sprintf("Unsupported file type '%s' for parent type '%s'", $fileType, $parentType)
            );
        }

        $className = $this->supportedFileModels[$this->getFileTypeIdentifier($fileType, $parentType)];

        $instance = new $className;

        if (! $instance instanceof FileModelInterface) {
            throw new FileException(
                sprintf(
                    "Wrong class type for file type '%s', parent type '%s'. Class '%s' should implements FileModelInterface",
                    $fileType,
                    $parentType,
                    $className
                )
            );
        }

        return $instance;
    }
public function getModelInstance($fileType, $parentType)
    {
        if (! isset($this->supportedFileModels[$this->getFileTypeIdentifier($fileType, $parentType)])) {
            throw new FileException(
                sprintf("Unsupported file type '%s' for parent type '%s'", $fileType, $parentType)
            );
        }

        $className = $this->supportedFileModels[$this->getFileTypeIdentifier($fileType, $parentType)];

        $instance = new $className;

        if (! $instance instanceof FileModelInterface) {
            throw new FileException(
                sprintf(
                    "Wrong class type for file type '%s', parent type '%s'. Class '%s' should implements FileModelInterface",
                    $fileType,
                    $parentType,
                    $className
                )
            );
        }

        return $instance;
    }
public function getModelInstance ( $ fileType , $ parentType ) { if ( ! isset ( $ this -> supportedFileModels [ $ this -> getFileTypeIdentifier ( $ fileType , $ parentType ) ] ) ) { throw new FileException ( sprintf ( "Unsupported file type '%s' for parent type '%s'" , $ fileType , $ parentType ) ) ; } $ className = $ this -> supportedFileModels [ $ this -> getFileTypeIdentifier ( $ fileType , $ parentType ) ] ; $ instance = new $ className ; if ( ! $ instance instanceof FileModelInterface ) { throw new FileException ( sprintf ( "Wrong class type for file type '%s', parent type '%s'. Class '%s' should implements FileModelInterface" , $ fileType , $ parentType , $ className ) ) ; } return $ instance ; }
Create a new FileModelInterface instance, from the supportedFileModels table

@param string $fileType   the file type, such as document, image, etc.
@param string $parentType the parent type, such as product, category, etc.

@return FileModelInterface a file model interface instance

@throws FileException if the file type is not supported, or if the class does not implements FileModelInterface
Create a new FileModelInterface instance from the supportedFileModels table