id = $id; } public function has_id() : bool { return $this->id !== null; } public function get_id() : int { if (!$this->has_id()) { $exception = "\n\n"; $exception .= 'Database item which ID trying to be loaded, has '; $exception .= 'no ID. That mean it could not exists, in the '; $exception .= 'database, because only items which not exists in '; $exception .= 'the database has not own ID.'; $exception .= "\n\n"; throw new \exception($exception); } return $this->id; } private ?int $id; }