'if_exist|min_length[4]|max_length[250]', 'user_uid' => 'if_exist|numeric', 'site' => 'if_exist|min_length[4]', 'name' => 'if_exist|min_length[2]|max_length[20]', 'email' => 'if_exist|valid_email', 'status' => 'if_exist|in_list[use,unuse,standby]', 'updated_at' => 'if_exist|valid_date', 'created_at' => 'if_exist|valid_date', ]; public function getEntityByField($field, $value): ?UserSNSEntity { return $this->asObject(UserSNSEntity::class)->where($field, $value)->first(); } public function getEntity(int $uid): ?UserSNSEntity { return $this->getEntityByField($this->primaryKey, $uid); } public function create(array $datas): UserSNSEntity { $entity = new UserSNSEntity(); $entity->uid = $datas['id']; $entity->site = $this->getSiteName(); $entity->name = $datas['name']; $entity->email = $datas['email']; $entity->status = "standby"; return $this->create_process($entity); } public function modify(UserSNSEntity $entity, array $datas): UserSNSEntity { foreach ($datas as $field => $value) { if ($entity->$field != $datas[$field]) { $entity->$field = $value; } } return $this->modify_process($entity); } //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); } }