'if_exist|numeric', 'user_id' => 'if_exist|trim|string', 'passwd' => 'if_exist|trim|string', // 'confirmpassword' => 'if_exist|trim|matches[passwd]', 'user_name' => 'if_exist|trim|string', 'user_state' => 'if_exist|trim|string', 'user_email' => 'if_exist|trim|valid_email', 'user_level' => 'if_exist|numeric', 'user_point' => 'if_exist|numeric', // 'proxied' => 'if_exist|in_list[on,off]', // 'fixed' => 'if_exist|in_list[on,off]', // 'locked' => 'if_exist|in_list[on,off]', // 'updated_at' => 'if_exist|valid_date', // 'created_at' => 'if_exist|valid_date', ]; public function __construct() { parent::__construct(); } public function getPK(): string { return $this->primaryKey; } public function getEntityByPK(int $uid): null|UserEntity { $this->where($this->getPK(), $uid); return $this->getEntity(); } public function getEntityByID(string $id): null|UserEntity { $this->where('user_id', $id); return $this->getEntity(); } public function setPoint(UserEntity $entity, int $point): UserEntity { if ($entity->getPoint() != $point) { $old_point = $entity->getPoint(); $entity->setPoint($point); $entity = $this->setEntity($entity); log_message("notice", __FUNCTION__ . "=>{$entity}의 Point가 {$old_point}에서 {$entity->getPoint()}로 변경되었습니다."); } return $entity; } final public function setLevel(UserEntity $entity, int $level): UserEntity { if ($entity->getLevel() != $level) { $old_level = $entity->getLevel(); $entity->setLevel($level); $entity = $this->setEntity($entity); log_message("notice", __FUNCTION__ . "=>{$entity}의 Level이 {$old_level}에서 {$entity->getLevel()}로 변경되었습니다."); } return $entity; } }