# \nre\modelsDatabaseModel

Default implementation of a database model.

## Summary

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

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

## Tags

author | coderkun olli@coderkun.de

## Properties

### $db

    $db : \nre\models\DatabaseDriver

Database connection

#### Type

\nre\models\DatabaseDriver

#

## Tags

static |

## Methods

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

#

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

### __construct()

    __construct(string  $type, array  $config)

Construct a new datamase model.

TODO Catch exception

#### Parameters

string | $type | Database type
array | $config | Connection settings

#### Throws

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

#

## 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\exceptions\DatamodelException
\nre\exceptions\DriverNotFoundException
\nre\exceptions\DriverNotValidException
\nre\exceptions\ModelNotValidException
\nre\exceptions\ModelNotFoundException

#

Inherited from
  \nre\core\Model

## Tags

None found

### loadDriver()

    loadDriver(string  $driverName)

Load the database driver.

#### Parameters

string | $driverName | Name of the database driver

#### Throws

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

#

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

#

## Tags

None found

### DatabaseModel.inc