mirror of
https://github.com/Karaka-Management/oms-Dashboard.git
synced 2026-02-17 18:58:40 +00:00
new datamapper mostly implemented
This commit is contained in:
parent
a93208441a
commit
c8415d5b87
|
|
@ -47,6 +47,6 @@ final class Installer extends InstallerAbstract
|
||||||
parent::install($dbPool, $info, $cfgHandler);
|
parent::install($dbPool, $info, $cfgHandler);
|
||||||
|
|
||||||
$board = new DashboardBoard();
|
$board = new DashboardBoard();
|
||||||
DashboardBoardMapper::create($board);
|
DashboardBoardMapper::create()->execute($board);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,10 @@ final class BackendController extends Controller
|
||||||
$view->setTemplate('/Modules/Dashboard/Theme/Backend/dashboard');
|
$view->setTemplate('/Modules/Dashboard/Theme/Backend/dashboard');
|
||||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000301001, $request, $response));
|
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000301001, $request, $response));
|
||||||
|
|
||||||
$board = DashboardBoardMapper::getFor($request->header->account, 'account');
|
$board = DashboardBoardMapper::get()->where('account', $request->header->account)->execute();
|
||||||
|
|
||||||
if ($board instanceof NullDashboardBoard) {
|
if ($board instanceof NullDashboardBoard) {
|
||||||
$board = DashboardBoardMapper::get(1);
|
$board = DashboardBoardMapper::get()->where('id', 1)->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
$panels = [];
|
$panels = [];
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ declare(strict_types=1);
|
||||||
namespace Modules\Dashboard\Models;
|
namespace Modules\Dashboard\Models;
|
||||||
|
|
||||||
use Modules\Admin\Models\AccountMapper;
|
use Modules\Admin\Models\AccountMapper;
|
||||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mapper class.
|
* Mapper class.
|
||||||
|
|
@ -25,7 +25,7 @@ use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
* @link https://orange-management.org
|
* @link https://orange-management.org
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
final class DashboardBoardMapper extends DataMapperAbstract
|
final class DashboardBoardMapper extends DataMapperFactory
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Columns.
|
* Columns.
|
||||||
|
|
@ -33,7 +33,7 @@ final class DashboardBoardMapper extends DataMapperAbstract
|
||||||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static array $columns = [
|
public const COLUMNS = [
|
||||||
'dashboard_board_id' => ['name' => 'dashboard_board_id', 'type' => 'int', 'internal' => 'id'],
|
'dashboard_board_id' => ['name' => 'dashboard_board_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'dashboard_board_title' => ['name' => 'dashboard_board_title', 'type' => 'string', 'internal' => 'title'],
|
'dashboard_board_title' => ['name' => 'dashboard_board_title', 'type' => 'string', 'internal' => 'title'],
|
||||||
'dashboard_board_status' => ['name' => 'dashboard_board_status', 'type' => 'int', 'internal' => 'status'],
|
'dashboard_board_status' => ['name' => 'dashboard_board_status', 'type' => 'int', 'internal' => 'status'],
|
||||||
|
|
@ -46,7 +46,7 @@ final class DashboardBoardMapper extends DataMapperAbstract
|
||||||
* @var array<string, array{mapper:string, table:string, self?:?string, external?:?string, column?:string}>
|
* @var array<string, array{mapper:string, table:string, self?:?string, external?:?string, column?:string}>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static array $hasMany = [
|
public const HAS_MANY = [
|
||||||
'components' => [
|
'components' => [
|
||||||
'mapper' => DashboardComponentMapper::class,
|
'mapper' => DashboardComponentMapper::class,
|
||||||
'table' => 'dashboard_component',
|
'table' => 'dashboard_component',
|
||||||
|
|
@ -61,7 +61,7 @@ final class DashboardBoardMapper extends DataMapperAbstract
|
||||||
* @var array<string, array{mapper:string, external:string}>
|
* @var array<string, array{mapper:string, external:string}>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static array $belongsTo = [
|
public const BELONGS_TO = [
|
||||||
'account' => [
|
'account' => [
|
||||||
'mapper' => AccountMapper::class,
|
'mapper' => AccountMapper::class,
|
||||||
'external' => 'dashboard_board_account',
|
'external' => 'dashboard_board_account',
|
||||||
|
|
@ -74,7 +74,7 @@ final class DashboardBoardMapper extends DataMapperAbstract
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static string $table = 'dashboard_board';
|
public const TABLE = 'dashboard_board';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Primary field name.
|
* Primary field name.
|
||||||
|
|
@ -82,5 +82,5 @@ final class DashboardBoardMapper extends DataMapperAbstract
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static string $primaryField = 'dashboard_board_id';
|
public const PRIMARYFIELD ='dashboard_board_id';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\Dashboard\Models;
|
namespace Modules\Dashboard\Models;
|
||||||
|
|
||||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mapper class.
|
* Mapper class.
|
||||||
|
|
@ -24,7 +24,7 @@ use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
* @link https://orange-management.org
|
* @link https://orange-management.org
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
final class DashboardComponentMapper extends DataMapperAbstract
|
final class DashboardComponentMapper extends DataMapperFactory
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Columns.
|
* Columns.
|
||||||
|
|
@ -32,7 +32,7 @@ final class DashboardComponentMapper extends DataMapperAbstract
|
||||||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static array $columns = [
|
public const COLUMNS = [
|
||||||
'dashboard_component_id' => ['name' => 'dashboard_component_id', 'type' => 'int', 'internal' => 'id'],
|
'dashboard_component_id' => ['name' => 'dashboard_component_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'dashboard_component_order' => ['name' => 'dashboard_component_order', 'type' => 'int', 'internal' => 'order'],
|
'dashboard_component_order' => ['name' => 'dashboard_component_order', 'type' => 'int', 'internal' => 'order'],
|
||||||
'dashboard_component_module' => ['name' => 'dashboard_component_module', 'type' => 'string', 'internal' => 'module'],
|
'dashboard_component_module' => ['name' => 'dashboard_component_module', 'type' => 'string', 'internal' => 'module'],
|
||||||
|
|
@ -46,7 +46,7 @@ final class DashboardComponentMapper extends DataMapperAbstract
|
||||||
* @var array<string, array{mapper:string, external:string}>
|
* @var array<string, array{mapper:string, external:string}>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static array $belongsTo = [
|
public const BELONGS_TO = [
|
||||||
'board' => [
|
'board' => [
|
||||||
'mapper' => DashboardBoardMapper::class,
|
'mapper' => DashboardBoardMapper::class,
|
||||||
'external' => 'dashboard_component_board',
|
'external' => 'dashboard_component_board',
|
||||||
|
|
@ -59,7 +59,7 @@ final class DashboardComponentMapper extends DataMapperAbstract
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static string $table = 'dashboard_component';
|
public const TABLE = 'dashboard_component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Primary field name.
|
* Primary field name.
|
||||||
|
|
@ -67,5 +67,5 @@ final class DashboardComponentMapper extends DataMapperAbstract
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static string $primaryField = 'dashboard_component_id';
|
public const PRIMARYFIELD ='dashboard_component_id';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ require_once __DIR__ . '/../vendor/autoload.php';
|
||||||
require_once __DIR__ . '/Autoloader.php';
|
require_once __DIR__ . '/Autoloader.php';
|
||||||
|
|
||||||
use phpOMS\DataStorage\Database\DatabasePool;
|
use phpOMS\DataStorage\Database\DatabasePool;
|
||||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
use phpOMS\DataStorage\Session\HttpSession;
|
use phpOMS\DataStorage\Session\HttpSession;
|
||||||
|
|
||||||
$CONFIG = [
|
$CONFIG = [
|
||||||
|
|
@ -329,7 +329,7 @@ $GLOBALS['dbpool']->create('delete', $CONFIG['db']['core']['masters']['delete'])
|
||||||
$GLOBALS['dbpool']->create('insert', $CONFIG['db']['core']['masters']['insert']);
|
$GLOBALS['dbpool']->create('insert', $CONFIG['db']['core']['masters']['insert']);
|
||||||
$GLOBALS['dbpool']->create('schema', $CONFIG['db']['core']['masters']['schema']);
|
$GLOBALS['dbpool']->create('schema', $CONFIG['db']['core']['masters']['schema']);
|
||||||
|
|
||||||
DataMapperAbstract::setConnection($GLOBALS['dbpool']->get());
|
DataMapperFactory::db($GLOBALS['dbpool']->get());
|
||||||
|
|
||||||
$GLOBALS['frameworkpath'] = '/phpOMS/';
|
$GLOBALS['frameworkpath'] = '/phpOMS/';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user