Files
nibiru-framework.com/core/f/db.php
Stephan Kasdorf aff8730316 CORE UPDATE: Minor update concerning the autoloading class in the core, now it is also possible to give a loading order through the configuration
Minor update concerning the form factory classes in the core, now some javascript events are implemented as well, another update concerning functinoallity will follow soon.
             Update on the example configuration file, implementing the autoloading order of interfaces, moduels and traits.
             Update for multidatabase support, see the documentation on http://www.nibiru-framework.com
2018-08-28 11:50:22 +02:00

54 lines
1.1 KiB
PHP

<?php
namespace Nibiru\Factory;
/**
* Created by PhpStorm.
* User: kasdorf
* Date: 10.11.17
* Time: 09:24
*/
class Db
{
const DATABASE_DRIVER_NS = "driver";
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;
}
}