table = 'tw_user_sns'; $this->allowedFields = [...$this->allowedFields, 'user_uid', 'site', 'id', 'name', 'email', 'detail', 'status']; $this->validationRules = [ ...$this->validationRules, 'user_uid' => 'if_exist|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]', 'site' => 'required|string', 'id' => 'required|string', 'name' => 'required|string', 'email' => 'required|valid_email', 'detail' => 'if_exist|string', 'status' => 'required|string', ]; } public function getEntity($uid): UserSNSEntity { $entity = $this->asObject(UserSNSEntity::class)->where([$this->primaryKey => $uid])->first(); return $entity ?: throw new \Exception("{$uid}의 해당 데이터가 없습니다.\n "); } public function getEntitys($where): array { return $this->asObject(UserSNSEntity::class)->where($where)->findAll(); } public function create(array $formDatas): UserSNSEntity { return $this->create_process(new UserSNSEntity(), $formDatas); } public function modify(UserSNSEntity $entity, array $formDatas): UserSNSEntity { return $this->modify_process($entity, $formDatas); } //Index관련 public function setIndexWordFilter(string $word) { parent::setIndexWordFilter($word); $this->orLike('name', $word, 'both'); $this->orLike('email', $word, 'both'); //befor , after , both } public function setIndexOrderBy($field, $order = 'ASC') { $this->orderBy("name", "ASC"); parent::setIndexOrderBy($field, $order); } }