uri_path .= strtolower($this->getService()->getClassName()) . '/'; $this->class_path = $this->getService()->getClassPath(); $this->title = lang("{$this->getService()->getClassPath()}.title"); $this->helper = $this->getHelper(); } public function getService(): ClientService { if (!$this->_service) { $this->_service = new ClientService($this->request); } return $this->_service; } public function getHelper(): mixed { if (!$this->_helper) { $this->_helper = new ClientHelper($this->request); } return $this->_helper; } //Index,FieldForm관련 protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation { switch ($field) { case 'role': //아래 Rule Array는 필드명.* checkbox를 사용 $validation->setRule("{$field}.*", $field, $rule); break; default: $validation = parent::setValidation($validation, $action, $field, $rule); break; } return $validation; } protected function create_process(): ClientEntity { $entity = parent::create_process(); //Account정보 $temps = []; $temps['clientinfo_uid'] = $entity->getPK(); $temps['title'] = "첫가입"; $temps['alias'] = $entity->getTitle(); $temps['amount'] = $this->formDatas['account_balance'] ?? 0; $temps['status'] = lang("{$this->getAccountService()->getClassPath()}.DEFAULTS.status"); $this->getAccountService()->create($temps, new AccountEntity()); //Coupon정보 $temps = []; $temps['clientinfo_uid'] = $entity->getPK(); $temps['title'] = "첫가입"; $temps['amount'] = $this->formDatas['coupon_balance'] ?? 0; $temps['status'] = lang("{$this->getCouponService()->getClassPath()}.DEFAULTS.status"); $this->getCouponService()->create($temps, new CouponEntity()); //Point정보 $temps = []; $temps['clientinfo_uid'] = $entity->getPK(); $temps['title'] = "첫가입"; $temps['amount'] = $this->formDatas['point_balance'] ?? 0; $temps['status'] = lang("{$this->getPointService()->getClassPath()}.DEFAULTS.status"); $this->getPointService()->create($temps, new CouponEntity()); return $entity; } //Index,FieldForm관련. //View관련 protected function view_process($uid): mixed { $fields = [ 'fields' => [$this->getService()->getModel()->getTitleField(), 'email', 'phone', 'role', 'account_balance', 'coupon_balance', 'point_balance', 'status'], ]; $this->init('view', $fields); return parent::view_process($uid); } protected function index_process(): array { $fields = [ 'fields' => [$this->getService()->getModel()->getTitleField(), 'email', 'phone', 'role', 'account_balance', 'coupon_balance', 'point_balance', 'status'], ]; $this->init('index', $fields); return parent::index_process(); } }