addClassName('Board'); } public function getFormFields(): array { return [ 'category', 'worker_uid', 'title', 'status', 'content', ]; } public function getFormFilters(): array { return [ 'user_uid', 'worker_uid', 'category', 'status', ]; } public function getIndexFields(): array { return [ 'category', 'title', 'worker_uid', 'user_uid', 'status', 'created_at', ]; } public function getBatchjobFields(): array { return ['user_uid', 'category', 'status']; } public function getFormOption(string $field, array $options = []): array { switch ($field) { case 'worker_uid': $options = $this->getUserService()->getEntities(); break; default: $options = parent::getFormOption($field, $options); break; } if (!is_array($options)) { throw new \Exception(__FUNCTION__ . "에서 {$field}의 options 값들이 array가 아닙니다.\n" . var_export($options, true)); } return $options; } //기본 기능부분 public function latest(array $where, int $limit = 3): array { //관리자정보 $userEntities = $this->getUserService()->getEntities(); $this->getModel()->limit($limit); $datas = []; foreach ($this->getEntities($where) as $entity) { $datas[] = [ 'title' => "", 'created_at' => date('Y-m-d H:m', strtotime($entity->getCreatedAT())), 'user' => $userEntities[$entity->getUserUID()]->getTitle(), ]; } return $datas; } }