Files
nibiru-framework.com/core/f/db.php
Stephan Kasdorf c9f29ce086 Version 0.3.5 beta
2018-03-14 16:37:09 +01:00

53 lines
1.0 KiB
PHP

<?php
namespace Nibiru\Factory;
/**
* Created by PhpStorm.
* User: kasdorf
* Date: 10.11.17
* Time: 09:24
*/
class Db
{
protected static $_model = null;
/**
* @desc loads the database model through the correct Factory,
* all database functionallity has to be run trough this
* factory
* @param string $modelName
* @return null
* @throws \Exception
*/
public static function loadModel( $modelName = "")
{
try {
if( $modelName != "" )
{
self::_setModel( $modelName );
return self::getModel();
}
} catch(\Exception $e)
{
throw new \Exception( $e->getMessage() );
}
}
/**
* @return null
*/
protected static function getModel()
{
return self::$_model;
}
/**
* @param null $model
*/
private static function _setModel( $model )
{
$fmodel = "\\Nibiru\\Model\\".$model;
self::$_model = new $fmodel;
}
}