Properties

$db

$db : \nre\models\DatabaseDriver

Database connection

Type

\nre\models\DatabaseDriver

Methods

__construct()

__construct() 

Construct a new QuesttopicsModel.

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

getQuesttopicByUrl()

getQuesttopicByUrl(integer  $seminaryId, string  $questtopicUrl) : array

Get a Questtopic by its URL.

Parameters

integer $seminaryId

ID of Seminary

string $questtopicUrl

URL-Title of Questtopic

Returns

array —

Questtopic data

getQuesttopicById()

getQuesttopicById(integer  $questtopicId) : array

Get a Questtopic by its ID.

Parameters

integer $questtopicId

ID of Questtopic

Returns

array —

Questtopic data

getQuesttopicsForSeminary()

getQuesttopicsForSeminary(integer  $seminaryId) : array

Get all Questtopics for a Seminary.

Parameters

integer $seminaryId

ID of Seminary

Returns

array —

List of Questtopics

getQuestCountForQuesttopic()

getQuestCountForQuesttopic(integer  $questtopicId) : integer

Get count of Quests that are linked to a Questtopic.

Parameters

integer $questtopicId

ID of Questtopic

Returns

integer —

Count of Quests

getCharacterQuestCountForQuesttopic()

getCharacterQuestCountForQuesttopic(integer  $questtopicId, integer  $characterId) : integer

Get count of Quests that are linked to a Questtopic and are unlocked by a Character.

Parameters

integer $questtopicId

ID of Questtopic

integer $characterId

ID of Character

Returns

integer —

Count of Quests

getSubtopicsForQuesttopic()

getSubtopicsForQuesttopic(integer  $questtopicId) : array

Get alle Questsubtopics for a Questtopic.

Parameters

integer $questtopicId

ID of Questtopic

Returns

array —

List of Questsubtopics for this Questtopic

getQuestsubtopicsForQuest()

getQuestsubtopicsForQuest(integer  $questId) : array

Get all Questsubtopics for a Quest.

Parameters

integer $questId

ID of Quest

Returns

array —

List of Questsubtopics

setQuestsubtopicsForQuest()

setQuestsubtopicsForQuest(integer  $questId, array  $questsubtopicIds) 

Set Questsubtopics for a Quest.

Parameters

integer $questId

ID of Quest to set subtopics for

array $questsubtopicIds

List of IDs of subtopics to set

questtopicTitleExists()

questtopicTitleExists(string  $title, integer  $questtopicId = null) : boolean

Check if a Questtopic title already exists.

Parameters

string $title

Questtopic title to check

integer $questtopicId

Do not check this ID (for editing)

Returns

boolean —

Whether Questtopic title exists or not

createQuesttopic()

createQuesttopic(integer  $userId, integer  $seminaryId, string  $title) : integer

Create a new Questtopic for a Seminary.

Parameters

integer $userId

ID of creating user

integer $seminaryId

ID of Seminary

string $title

Title for new Questtopic

Returns

integer —

ID of newly created Questtopic

editQuesttopic()

editQuesttopic(integer  $questtopicId, string  $title) 

Edit a Questtopic.

Parameters

integer $questtopicId

ID of Questtopic to edit

string $title

New title of Questtopic

deleteQuesttopic()

deleteQuesttopic(integer  $questtopicId) 

Delete a Questtopic.

Parameters

integer $questtopicId

ID of Questtopic to delete

questsubtopicTitleExists()

questsubtopicTitleExists(integer  $questtopicId, string  $title, integer  $questsubtopicId = null) : boolean

Check if a Questsubtopic title already exists.

Parameters

integer $questtopicId

ID of Questtopic

string $title

Questsubtopic title to check

integer $questsubtopicId

Do not check this ID (for editing)

Returns

boolean —

Whether Questsubtopic title exists or not

createQuestsubtopic()

createQuestsubtopic(integer  $userId, integer  $questtopicId, string  $title) : integer

Create a new Questsubtopic for a Questtopic.

Parameters

integer $userId

ID of creating user

integer $questtopicId

ID of Qusttopic

string $title

Title for new Questtopic

Returns

integer —

ID of newly created Questsubtopic

editQuestsubtopic()

editQuestsubtopic(integer  $questsubtopicId, string  $title) 

Edit a Questsubtopic.

Parameters

integer $questsubtopicId

ID of Questsubtopic to edit

string $title

New title of Questsubtopic

deleteQuestsubtopic()

deleteQuestsubtopic(  $questtopicId) 

Delete a Questsubtopic.

Parameters

$questtopicId

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