# \hhu\z\modelsAvatarsModel

Model to interact with Avatars-tables.

## Summary

Methods
Properties
Constants
__construct()
load()
factory()
getAvatarById()
getAvatarByTypeAndLevel()
setAvatarForTypeAndLevel()
setAvatarPortraitForTypeAndLevel()
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/AvatarsModel.inc
Package
  Default
Class hierarchy
  \nre\core\Model
  \nre\models\DatabaseModel
  \hhu\z\Model
  \hhu\z\models\AvatarsModel

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

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

### getAvatarById()

    getAvatarById(integer  $avatarId) : array

Get an Avatar by its ID

#### Parameters

integer | $avatarId | ID of Avatar

#### Returns

array —

Avatar data

#

## Tags

None found

### getAvatarByTypeAndLevel()

    getAvatarByTypeAndLevel(integer  $seminaryId, string  $charactertypeUrl, integer  $xplevel) : array

Get an Avatar by its Character type and XP-level.

#### Parameters

integer | $seminaryId | ID of Seminary
string | $charactertypeUrl | URL-title of Character type
integer | $xplevel | XP-level

#### Returns

array —

Avatar data

#

## Tags

None found

### setAvatarForTypeAndLevel()

    setAvatarForTypeAndLevel(integer  $userId, integer  $charactertypeId, integer  $xplevelId, integer  $avatarpictureId)

Set the picture for an Avatar.

#### Parameters

integer | $userId | ID of creating user
integer | $charactertypeId | ID of Charactertype of Avatar
integer | $xplevelId | ID of XP-level of Avatar
integer | $avatarpictureId | ID of Avatar picture to set

#

## Tags

None found

### setAvatarPortraitForTypeAndLevel()

    setAvatarPortraitForTypeAndLevel(integer  $userId, integer  $charactertypeId, integer  $xplevelId, integer  $avatarpictureId)

Set the portrait picture for an Avatar.

#### Parameters

integer | $userId | ID of creating user
integer | $charactertypeId | ID of Charactertype of Avatar
integer | $xplevelId | ID of XP-level of Avatar
integer | $avatarpictureId | ID of Avatar portrait picture to set

#

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

### AvatarsModel.inc