dbmsv2 init...1
This commit is contained in:
parent
b113977ec0
commit
8bd5a50748
@ -4,8 +4,8 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"width": 3000,
|
"width": 3000,
|
||||||
"height": 3000,
|
"height": 3000,
|
||||||
"scrollTop": -1726.3031,
|
"scrollTop": -1512.3031,
|
||||||
"scrollLeft": -455.9114,
|
"scrollLeft": -1646.9114,
|
||||||
"zoomLevel": 0.76,
|
"zoomLevel": 0.76,
|
||||||
"show": 511,
|
"show": 511,
|
||||||
"database": 4,
|
"database": 4,
|
||||||
|
|||||||
@ -44,7 +44,7 @@ abstract class CommonModel extends Model
|
|||||||
protected $afterFind = [];
|
protected $afterFind = [];
|
||||||
protected $beforeDelete = [];
|
protected $beforeDelete = [];
|
||||||
protected $afterDelete = [];
|
protected $afterDelete = [];
|
||||||
|
protected $isDebug = false;
|
||||||
protected function __construct()
|
protected function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -149,7 +149,7 @@ abstract class CommonModel extends Model
|
|||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
public function create(array $formDatas): mixed
|
public function create(array $formDatas, bool $isDebug = false): mixed
|
||||||
{
|
{
|
||||||
// LogCollector::debug("입력내용");
|
// LogCollector::debug("입력내용");
|
||||||
// LogCollector::debug(var_export($formDatas, true));
|
// LogCollector::debug(var_export($formDatas, true));
|
||||||
@ -164,6 +164,9 @@ abstract class CommonModel extends Model
|
|||||||
$convertedFormDatas[$field] = $value;
|
$convertedFormDatas[$field] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->isDebug) {
|
||||||
|
dd($convertedFormDatas);
|
||||||
|
}
|
||||||
// 최종 저장 시 오류 발생하면
|
// 최종 저장 시 오류 발생하면
|
||||||
if (!$this->save($convertedFormDatas)) {
|
if (!$this->save($convertedFormDatas)) {
|
||||||
$message = sprintf(
|
$message = sprintf(
|
||||||
@ -187,7 +190,7 @@ abstract class CommonModel extends Model
|
|||||||
}
|
}
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
public function modify(mixed $entity, array $formDatas): mixed
|
public function modify(mixed $entity, array $formDatas, bool $isDebug = false): mixed
|
||||||
{
|
{
|
||||||
// 저장하기 전에 데이터 값 변경이 필요한 Field
|
// 저장하기 전에 데이터 값 변경이 필요한 Field
|
||||||
// LogCollector::debug("[{$entity->getPK()}/{$entity->getTitle()}] 변경 전 내용");
|
// LogCollector::debug("[{$entity->getPK()}/{$entity->getTitle()}] 변경 전 내용");
|
||||||
@ -204,6 +207,9 @@ abstract class CommonModel extends Model
|
|||||||
$entity->$field = $value;
|
$entity->$field = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->isDebug) {
|
||||||
|
dd($entity);
|
||||||
|
}
|
||||||
//수정일추가
|
//수정일추가
|
||||||
$entity->setUpdatedAt(date("Y-m-d H:i:s"));
|
$entity->setUpdatedAt(date("Y-m-d H:i:s"));
|
||||||
// 최종 저장 시 오류 발생하면
|
// 최종 저장 시 오류 발생하면
|
||||||
|
|||||||
@ -40,6 +40,9 @@ class ServerModel extends EquipmentModel
|
|||||||
case "serviceinfo_uid":
|
case "serviceinfo_uid":
|
||||||
$rule = "permit_empty|numeric";
|
$rule = "permit_empty|numeric";
|
||||||
break;
|
break;
|
||||||
|
case "title":
|
||||||
|
$rule = "required|trim|string";
|
||||||
|
break;
|
||||||
case "price":
|
case "price":
|
||||||
case "amount":
|
case "amount":
|
||||||
$rule = "required|numeric";
|
$rule = "required|numeric";
|
||||||
|
|||||||
@ -11,6 +11,7 @@ abstract class CommonService
|
|||||||
private $_model = null;
|
private $_model = null;
|
||||||
private $_classNames = [];
|
private $_classNames = [];
|
||||||
private $_serviceDatas = [];
|
private $_serviceDatas = [];
|
||||||
|
protected $isDebug = false;
|
||||||
protected function __construct(Model $model)
|
protected function __construct(Model $model)
|
||||||
{
|
{
|
||||||
$this->_model = $model;
|
$this->_model = $model;
|
||||||
@ -196,14 +197,28 @@ abstract class CommonService
|
|||||||
//생성
|
//생성
|
||||||
public function create(array $formDatas): mixed
|
public function create(array $formDatas): mixed
|
||||||
{
|
{
|
||||||
|
if ($this->isDebug) {
|
||||||
|
echo $this->getClassName() . "=>" . __METHOD__;
|
||||||
|
echo var_dump($formDatas);
|
||||||
|
}
|
||||||
$entity = $this->getModel()->create($formDatas);
|
$entity = $this->getModel()->create($formDatas);
|
||||||
|
if ($this->isDebug) {
|
||||||
|
dd($entity);
|
||||||
|
}
|
||||||
LogCollector::info("[{$entity->getTitle()}]" . MESSAGES["CREATED"] . ":");
|
LogCollector::info("[{$entity->getTitle()}]" . MESSAGES["CREATED"] . ":");
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
//수정
|
//수정
|
||||||
public function modify(mixed $entity, array $formDatas): mixed
|
public function modify(mixed $entity, array $formDatas): mixed
|
||||||
{
|
{
|
||||||
|
if ($this->isDebug) {
|
||||||
|
echo $this->getClassName() . "=>" . __METHOD__;
|
||||||
|
echo var_dump($formDatas);
|
||||||
|
}
|
||||||
$entity = $this->getModel()->modify($entity, $formDatas);
|
$entity = $this->getModel()->modify($entity, $formDatas);
|
||||||
|
if ($this->isDebug) {
|
||||||
|
dd($entity);
|
||||||
|
}
|
||||||
LogCollector::info("[{$entity->getTitle()}]" . MESSAGES["UPDATED"] . ":");
|
LogCollector::info("[{$entity->getTitle()}]" . MESSAGES["UPDATED"] . ":");
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,13 +109,13 @@ class ServerPartService extends EquipmentService
|
|||||||
{
|
{
|
||||||
$entities = [];
|
$entities = [];
|
||||||
foreach (SERVER['PARTTYPES'] as $partType) {
|
foreach (SERVER['PARTTYPES'] as $partType) {
|
||||||
$entities[] = parent::create(
|
$serverPartFormDatas = $this->getFormDatasByServer(
|
||||||
$this->getFormDatasByServer(
|
$serverEntity,
|
||||||
$serverEntity,
|
$partType,
|
||||||
$partType,
|
$formDatas
|
||||||
$formDatas
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
$this->isDebug = true;
|
||||||
|
$entities[] = parent::create($serverPartFormDatas);
|
||||||
}
|
}
|
||||||
return $entities;
|
return $entities;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -179,7 +179,6 @@ class ServerService extends EquipmentService
|
|||||||
public function create(array $formDatas): ServerEntity
|
public function create(array $formDatas): ServerEntity
|
||||||
{
|
{
|
||||||
$entity = parent::create($formDatas);
|
$entity = parent::create($formDatas);
|
||||||
dd($entity);
|
|
||||||
//ServerPart정보 생성
|
//ServerPart정보 생성
|
||||||
foreach ($this->getServerPartService()->createByServer($entity, $formDatas) as $serverPartEntity) {
|
foreach ($this->getServerPartService()->createByServer($entity, $formDatas) as $serverPartEntity) {
|
||||||
$entity->addServerPartEntity($serverPartEntity->getType(), $serverPartEntity);
|
$entity->addServerPartEntity($serverPartEntity->getType(), $serverPartEntity);
|
||||||
|
|||||||
@ -15,19 +15,26 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php foreach (SERVER['PARTTYPES'] as $type): ?>
|
<tr>
|
||||||
<tr>
|
<td>부품정보</td>
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("partinfo_uid_{$type}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$type}"), $viewDatas) ?></th>
|
<td>
|
||||||
<td nowrap class="text-start">
|
<table class="table table-bordered">
|
||||||
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$type}", old("partinfo_uid_{$type}") ?? ($viewDatas['control']['field_default_values']["partinfo_uid_{$type}"] ?? null), $viewDatas) ?>
|
<?php foreach (SERVER['PARTTYPES'] as $type): ?>
|
||||||
<?= form_dropdown("partinfo_uid_{$type}_cnt", $viewDatas['serverinfopartinfo_cnt_range'], old("partinfo_uid_{$type}_cnt") ?? 1) . "개" ?>
|
<tr>
|
||||||
<?php if ($type === "DISK"): ?>
|
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("partinfo_uid_{$type}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$type}"), $viewDatas) ?></th>
|
||||||
<?= form_dropdown("partinfo_uid_{$type}_extra", $viewDatas['serverinfopartinfo_extra_options'], old("partinfo_uid_{$type}_extra") ?? null) ?>
|
<td nowrap class="text-start">
|
||||||
<?php endif ?>
|
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$type}", old("partinfo_uid_{$type}") ?? ($viewDatas['control']['field_default_values']["partinfo_uid_{$type}"] ?? null), $viewDatas) ?>
|
||||||
<span><?= validation_show_error("partinfo_uid_{$type}"); ?></span>
|
<?= form_dropdown("partinfo_uid_{$type}_cnt", $viewDatas['serverinfopartinfo_cnt_range'], old("partinfo_uid_{$type}_cnt") ?? 1) . "개" ?>
|
||||||
</td>
|
<?php if ($type === "DISK"): ?>
|
||||||
</tr>
|
<?= form_dropdown("partinfo_uid_{$type}_extra", $viewDatas['serverinfopartinfo_extra_options'], old("partinfo_uid_{$type}_extra") ?? null) ?>
|
||||||
<?php endforeach; ?>
|
<?php endif ?>
|
||||||
|
<span><?= validation_show_error("partinfo_uid_{$type}"); ?></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
|
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
|
||||||
<?= form_close(); ?>
|
<?= form_close(); ?>
|
||||||
|
|||||||
@ -15,19 +15,26 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php foreach (SERVER['PARTTYPES'] as $type): ?>
|
<tr>
|
||||||
<tr>
|
<td>부품정보</td>
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("partinfo_uid_{$type}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$type}"), $viewDatas) ?></th>
|
<td>
|
||||||
<td nowrap class="text-start">
|
<table class="table table-bordered">
|
||||||
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$type}", old("partinfo_uid_{$type}") ?? ($viewDatas['entity']->getServerPartEntity($type)->getPartInfoUID()), $viewDatas) ?>
|
<?php foreach (SERVER['PARTTYPES'] as $type): ?>
|
||||||
<?= form_dropdown("partinfo_uid_{$type}_cnt", $viewDatas['serverinfopartinfo_cnt_range'], old("partinfo_uid_{$type}_cnt") ?? $viewDatas['entity']->getServerPartEntity($type)->getCnt()) . "개" ?>
|
<tr>
|
||||||
<?php if ($type === "DISK"): ?>
|
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("partinfo_uid_{$type}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$type}"), $viewDatas) ?></th>
|
||||||
<?= form_dropdown("partinfo_uid_{$type}_extra", $viewDatas['serverinfopartinfo_extra_options'], old("partinfo_uid_{$type}_extra") ?? $viewDatas['entity']->getServerPartEntity($type)->getExtra()) ?>
|
<td nowrap class="text-start">
|
||||||
<?php endif ?>
|
<?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$type}", old("partinfo_uid_{$type}") ?? ($viewDatas['entity']->getServerPartEntity($type)->getPartInfoUID()), $viewDatas) ?>
|
||||||
<span><?= validation_show_error("partinfo_uid_{$type}"); ?></span>
|
<?= form_dropdown("partinfo_uid_{$type}_cnt", $viewDatas['serverinfopartinfo_cnt_range'], old("partinfo_uid_{$type}_cnt") ?? $viewDatas['entity']->getServerPartEntity($type)->getCnt()) . "개" ?>
|
||||||
</td>
|
<?php if ($type === "DISK"): ?>
|
||||||
</tr>
|
<?= form_dropdown("partinfo_uid_{$type}_extra", $viewDatas['serverinfopartinfo_extra_options'], old("partinfo_uid_{$type}_extra") ?? $viewDatas['entity']->getServerPartEntity($type)->getExtra()) ?>
|
||||||
<?php endforeach; ?>
|
<?php endif ?>
|
||||||
|
<span><?= validation_show_error("partinfo_uid_{$type}"); ?></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
|
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
|
||||||
<?= form_close(); ?>
|
<?= form_close(); ?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user