# \hhu\z\modelsCharactertypesModel

Model to interact with Charactertypes-table.

## Summary

Methods
Properties
Constants
__construct()
load()
factory()
getCharacterTypesForSeminary()
getCharactertypeByUrl()
getCharactertypeById()
charactertypeNameExists()
createCharactertype()
editCharactertype()
deleteCharactertype()
No public properties found
No constants found
No protected methods found
$db
N/A
loadDriver()
connect()
getClassName()
loadModels()
No private properties found
N/A

File
  models/CharactertypesModel.inc
Package
  Default
Class hierarchy
  \nre\core\Model
  \nre\models\DatabaseModel
  \hhu\z\Model
  \hhu\z\models\CharactertypesModel

## Tags

author | Oliver Hanraths oliver.hanraths@uni-duesseldorf.de

## Properties

### $db

    $db : \nre\models\DatabaseDriver

Database connection

#### Type

\nre\models\DatabaseDriver

#

Inherited from
  \nre\models\DatabaseModel

## Tags

static |

## Methods

### __construct()

    __construct()

Construct a new CharactertypesModel.

TODO Catch exception

#

## Tags

None found

### load()

    load(string  $modelName)

Load the class of a Model.

#### Parameters

string | $modelName | Name of the Model to load

#### Throws

\nre\core\ModelNotFoundException
\nre\core\ModelNotValidException

#

static

Inherited from
  \nre\core\Model

## Tags

None found

### factory()

    factory(string  $modelName)

Instantiate a Model (Factory Pattern).

#### Parameters

string | $modelName | Name of the Model to instantiate

#

static

Inherited from
  \nre\core\Model

## Tags

None found

### getCharacterTypesForSeminary()

    getCharacterTypesForSeminary(integer  $seminaryId) : array

Get all Character types of a Seminary.

#### Parameters

integer | $seminaryId | ID of Seminary to get types of

#### Returns

array —

Character types

#

## Tags

None found

### getCharactertypeByUrl()

    getCharactertypeByUrl(integer  $seminaryId,   $charactertypeUrl) : array

Get Character type by its URL.

#### Parameters

integer | $seminaryId | ID of Seminary
| $charactertypeUrl |

#### Returns

array —

Character type data

#

## Tags

None found

### getCharactertypeById()

    getCharactertypeById(string  $charactertypeId) : array

Get Character type by its ID.

#### Parameters

string | $charactertypeId | ID of Character type

#### Returns

array —

Character type data

#

## Tags

None found

### charactertypeNameExists()

    charactertypeNameExists(integer  $seminaryId, string  $name, integer  $charactertypeId = null) : boolean

Check if a Charactertype name already exists.

#### Parameters

integer | $seminaryId | ID of Seminary
string | $name | Charactertype name to check
integer | $charactertypeId | Do not check this ID (for editing)

#### Returns

boolean —

Whether Charactertype name exists or not

#

## Tags

None found

### createCharactertype()

    createCharactertype(integer  $userId, integer  $seminaryId, string  $name) : integer

Create a new Charactertype for a Seminary.

#### Parameters

integer | $userId | ID of creating user
integer | $seminaryId | ID of Seminary
string | $name | Name for new Charactertype

#### Returns

integer —

ID of newly created Charactertype

#

## Tags

None found

### editCharactertype()

    editCharactertype(integer  $charactertypeId, string  $name)

Edit a Charactertype.

#### Parameters

integer | $charactertypeId | ID of Charactertype to edit
string | $name | New name of Charactertype

#

## Tags

None found

### deleteCharactertype()

    deleteCharactertype(integer  $charactertypeId)

Delete a Charactertype.

#### Parameters

integer | $charactertypeId | ID of Charactertype to delete

#

## Tags

None found

### loadDriver()

    loadDriver(string  $driverName)

Load the database driver.

#### Parameters

string | $driverName | Name of the database driver

#### Throws

\nre\models\DriverNotFoundException
\nre\models\DriverNotValidException

#

Inherited from
  \nre\models\DatabaseModel

## Tags

None found

### 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\models\DatamodelException

#

Inherited from
  \nre\models\DatabaseModel

## Tags

None found

### 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

#

static

Inherited from
  \nre\core\Model

## Tags

None found

### loadModels()

    loadModels()

Load the Models of this Model.

#### Throws

\nre\core\DatamodelException
\nre\core\DriverNotFoundException
\nre\core\DriverNotValidException
\nre\core\ModelNotValidException
\nre\core\ModelNotFoundException

#

Inherited from
  \nre\core\Model

## Tags

None found

### CharactertypesModel.inc