context = DatabaseConnection::i()->getContext(); $this->noSpamLogs = $this->context->table("noSpam_templates"); } private function toNoSpamLog(?ActiveRow $ar): ?NoSpamLog { return is_null($ar) ? NULL : new NoSpamLog($ar); } function get(int $id): ?NoSpamLog { return $this->toNoSpamLog($this->noSpamLogs->get($id)); } function getList(array $filter = []): \Traversable { foreach ($this->noSpamLogs->where($filter)->order("`id` DESC") as $log) yield new NoSpamLog($log); } }