cfmgrv4 init...3
This commit is contained in:
parent
a4c262bfaf
commit
36322a95de
@ -77,7 +77,9 @@ abstract class MVController extends CommonController
|
||||
return $formDatas;
|
||||
}
|
||||
// 생성
|
||||
protected function create_form_process(): void {}
|
||||
protected function create_form_process(): void
|
||||
{
|
||||
}
|
||||
final protected function create_form_procedure(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
@ -108,7 +110,7 @@ abstract class MVController extends CommonController
|
||||
{
|
||||
$this->create_validate($this->action, $this->fields);
|
||||
$this->formDatas = $this->getFormDatas();
|
||||
$this->entity = $this->getModel()->create(formDatas: $this->formDatas);
|
||||
$this->entity = $this->getModel()->create($this->formDatas);
|
||||
}
|
||||
protected function create_process_result(): RedirectResponse|string
|
||||
{
|
||||
@ -124,7 +126,7 @@ abstract class MVController extends CommonController
|
||||
$this->create_process();
|
||||
$this->getModel()->transCommit();
|
||||
$this->message = "{$this->class_name} : 생성작업이 완료되었습니다.";
|
||||
log_message("notice", $this->message);
|
||||
log_message("notice", $this->message);
|
||||
return $this->create_process_result();
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
@ -192,7 +194,7 @@ abstract class MVController extends CommonController
|
||||
$this->modify_process($uid);
|
||||
$this->getModel()->transCommit();
|
||||
$this->message = "{$this->class_name} : 수정작업이 완료되었습니다.";
|
||||
log_message("notice", $this->message);
|
||||
log_message("notice", $this->message);
|
||||
return $this->modify_process_result();
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
@ -225,7 +227,7 @@ abstract class MVController extends CommonController
|
||||
}
|
||||
$this->getModel()->transCommit();
|
||||
$this->message = "{$this->class_name} : 일괄처리작업이 완료되었습니다.";
|
||||
log_message("notice", $this->message);
|
||||
log_message("notice", $this->message);
|
||||
// 이전 URL로 리다이렉트
|
||||
return redirect()->to($this->myauth->popPreviousUrl())->with('error', $this->message);
|
||||
} catch (\Exception $e) {
|
||||
@ -246,7 +248,7 @@ abstract class MVController extends CommonController
|
||||
$this->modify_process($uid);
|
||||
$this->getModel()->transCommit();
|
||||
$this->message = "{$this->class_name} : 단일필드작업이 완료되었습니다.";
|
||||
log_message("notice", $this->message);
|
||||
log_message("notice", $this->message);
|
||||
// 이전 URL로 리다이렉트
|
||||
return redirect()->to($this->myauth->popPreviousUrl())->with('error', $this->message);
|
||||
} catch (\Exception $e) {
|
||||
@ -302,7 +304,7 @@ abstract class MVController extends CommonController
|
||||
$this->delete_process($uid);
|
||||
$this->getModel()->transCommit();
|
||||
$this->message = "{$this->class_name} : 삭제작업이 완료되었습니다.";
|
||||
log_message("notice", $this->message);
|
||||
log_message("notice", $this->message);
|
||||
// 이전 URL로 리다이렉트
|
||||
return redirect()->to($this->myauth->popPreviousUrl())->with('error', $this->message);
|
||||
} catch (\Exception $e) {
|
||||
@ -328,7 +330,7 @@ abstract class MVController extends CommonController
|
||||
}
|
||||
$this->getModel()->transCommit();
|
||||
$this->message = "{$this->class_name} : 일괄삭제처리작업이 완료되었습니다.";
|
||||
log_message("notice", $this->message);
|
||||
log_message("notice", $this->message);
|
||||
// 이전 URL로 리다이렉트
|
||||
return redirect()->to($this->myauth->popPreviousUrl())->with('error', $this->message);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
10
app/Services/Common.php
Normal file
10
app/Services/Common.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
abstract class Common
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
43
app/Services/User.php
Normal file
43
app/Services/User.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\UserModel;
|
||||
use App\Entities\UserEntity;
|
||||
|
||||
class User extends Common
|
||||
{
|
||||
private ?UserModel $_model = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getModel(): UserModel
|
||||
{
|
||||
if ($this->_model === null) {
|
||||
$this->_model = new UserModel();
|
||||
}
|
||||
return $this->_model;
|
||||
}
|
||||
|
||||
public function find(array $wheres): ?UserEntity
|
||||
{
|
||||
return $this->getModel()->where($wheres)->first();
|
||||
}
|
||||
public function findAll(array $wheres = []): array
|
||||
{
|
||||
return $this->getModel()->where($wheres)->findAll();
|
||||
}
|
||||
public function create(array $formDatas): UserEntity
|
||||
{
|
||||
return $this->getModel()->create($formDatas);
|
||||
}
|
||||
public function modify(UserEntity $entity, array $formDatas): UserEntity
|
||||
{
|
||||
return $this->getModel()->modify($entity, $formDatas);
|
||||
}
|
||||
public function delete(array $wheres): void
|
||||
{
|
||||
$this->getModel()->where($wheres)->delete();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user