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