class_name .= "Zone"; $this->layout = LAYOUTS['admin']; $this->title = lang("{$this->class_name}.title"); $this->session = $this->session_AuthTrait(); helper($this->class_name); } final protected function getModel(): ZoneModel { if ($this->_model === null) { $this->_model = new ZoneModel(); } return $this->_model; } final protected function getAccountModel(): AccountModel { if ($this->_accountModel === null) { $this->_accountModel = new AccountModel(); } return $this->_accountModel; } protected function getFormFieldOption(string $field, array $options = []): array { switch ($field) { case ZoneModel::PARENT: $options = [ DEFAULTS['EMPTY'] => lang($this->_className . '.label.' . $field) . ' 선택', ...$this->getAccountModel()->getFilterFieldOption($field, $options) ]; break; default: $options = parent::getFormFieldOption($field, $options); break; } return $options; } protected function create_init(): void { $this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'status', 'type']; $this->filter_fields = [$this->getModel()::PARENT, 'status', 'type']; $this->action = 'create'; $this->getModel()->setAction($this->action); } public function create_form(): RedirectResponse|string { return $this->create_form_process(); } protected function create_process_submit(): ZoneEntity { $account_entity = $this->getAccountModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]); $zone = new Zone($account_entity); return $zone->create($this->formDatas); } public function create(): RedirectResponse { return parent::create_process(); } }