Automation init...1

This commit is contained in:
최준흠 2024-09-06 20:46:03 +09:00
parent 630e213e3e
commit fdab7f4307
3 changed files with 3 additions and 1 deletions

View File

@ -49,7 +49,6 @@ abstract class CommonModel extends Model
{ {
parent::__construct(); parent::__construct();
$this->setFields($fields); $this->setFields($fields);
$this->setRules($this->getFields());
} }
abstract public function getTitleField(): string; abstract public function getTitleField(): string;
@ -69,6 +68,7 @@ abstract class CommonModel extends Model
final public function setFields(array $fields): void final public function setFields(array $fields): void
{ {
$this->allowedFields = $fields; $this->allowedFields = $fields;
$this->setRules($this->allowedFields);
} }
final public function getRules(array $options): array //options=>except or only final public function getRules(array $options): array //options=>except or only
{ {

View File

@ -58,6 +58,7 @@ abstract class BoardModel extends CommonModel
$entity = $this->create_process($entity); $entity = $this->create_process($entity);
//GID값이 PK랑 같은 값 전달 후 Entity 수정 //GID값이 PK랑 같은 값 전달 후 Entity 수정
$entity->gid = $entity->getPK(); $entity->gid = $entity->getPK();
$this->setFields(["gid"]);
return $this->modify_process($entity); return $this->modify_process($entity);
} }

View File

@ -61,6 +61,7 @@ class UserModel extends CommonModel
$entity = $this->create_process($entity); $entity = $this->create_process($entity);
//GID값이 PK랑 같은 값 전달 후 Entity 수정 //GID값이 PK랑 같은 값 전달 후 Entity 수정
$entity->gid = $entity->getPK(); $entity->gid = $entity->getPK();
$this->setFields(["gid"]);
return $this->modify_process($entity); return $this->modify_process($entity);
} }