\hhu\z\modelsUploadsModel

Model to handle files to upload.

Summary

Methods
Properties
Constants
__construct()
load()
factory()
uploadSeminaryFile()
getSeminaryuploadById()
getSeminaryuploadByUrl()
No public properties found
No constants found
No protected methods found
$db
N/A
loadDriver()
connect()
getClassName()
loadModels()
No private properties found
N/A

Properties

$db

$db : \nre\models\DatabaseDriver

Database connection

Type

\nre\models\DatabaseDriver

Methods

__construct()

__construct() 

Construct a new UploadsModel.

TODO Catch exception

load()

load(string  $modelName) 

Load the class of a Model.

Parameters

string $modelName

Name of the Model to load

Throws

\nre\exceptions\ModelNotFoundException
\nre\exceptions\ModelNotValidException

factory()

factory(string  $modelName) 

Instantiate a Model (Factory Pattern).

Parameters

string $modelName

Name of the Model to instantiate

uploadSeminaryFile()

uploadSeminaryFile(integer  $userId, integer  $seminaryId, string  $name, string  $filename, string  $tmpFilename, string  $mimetype) : mixed

Upload a file and create a database record.

Parameters

integer $userId

ID of user that uploads the file

integer $seminaryId

ID of Seminary

string $name

Name of file to upload

string $filename

Filename of file to upload

string $tmpFilename

Name of temporary uploaded file

string $mimetype

Mimetype of file to upload

Returns

mixed —

ID of database record or false

getSeminaryuploadById()

getSeminaryuploadById(  $seminaryuploadId) : array

Get an upload by its ID.

Parameters

$seminaryuploadId

Throws

\nre\exceptions\IdNotFoundException

Returns

array —

Upload data

getSeminaryuploadByUrl()

getSeminaryuploadByUrl(integer  $seminaryId,   $seminaryuploadUrl) : array

Get an upload by its URL.

Parameters

integer $seminaryId

ID of Seminary

$seminaryuploadUrl

Throws

\nre\exceptions\IdNotFoundException

Returns

array —

Upload data

loadDriver()

loadDriver(string  $driverName) 

Load the database driver.

Parameters

string $driverName

Name of the database driver

Throws

\nre\exceptions\DriverNotFoundException
\nre\exceptions\DriverNotValidException

connect()

connect(string  $driverName, array  $config) 

Establish a connection to the database.

Parameters

string $driverName

Name of the database driver

array $config

Connection settings

Throws

\nre\exceptions\DatamodelException

getClassName()

getClassName(string  $modelName) : string

Determine the classname for the given Model name.

Parameters

string $modelName

Model name to get classname of

Returns

string —

Classname fore the Model name

loadModels()

loadModels() 

Load the Models of this Model.

Throws

\nre\exceptions\DatamodelException
\nre\exceptions\DriverNotFoundException
\nre\exceptions\DriverNotValidException
\nre\exceptions\ModelNotValidException
\nre\exceptions\ModelNotFoundException