attributes)) { return $this->attributes[$key]; } return parent::__get($key); } /** * 중요: Entity에 값이 들어오는 "모든 경로" (new Entity($data), fill(), $entity->field=...) * 에서 공통 규칙을 적용하기 위해 __set을 정의. */ final public function __set(string $key, $value = null) { if (array_key_exists($key, $this->attributes)) { return $this->attributes[$key] = $value; } parent::__set($key, $value); } final public function getPK(): int|string { $field = constant("static::PK"); return $this->attributes[$field] ?? ""; } final public function getTitle(): string { $field = constant("static::TITLE"); return $this->attributes[$field] ?? ""; } public function getCustomTitle(): string { return $this->getTitle(); } final public function getStatus(): string { return $this->attributes['status'] ?? ""; } final public function getUpdatedAt(): string { return $this->attributes['updated_at'] ?? ""; } final public function getCreatedAt(): string { return $this->attributes['created_at'] ?? ""; } final public function getDeletedAt(): string { return $this->attributes['deleted_at'] ?? ""; } }