public function getBadges() { $result = Database::query(SQL::trainerBadges($this->id)); $badges = array(); if (mysqli_num_rows($result) > 0) { foreach ($result as $row) { $badge = new Badge($row); array_push($badges, $badge->serialize()); } } return $badges; }
private static function badgesForResult($result) { $badges = array(); if ($result && mysqli_num_rows($result) > 0) { foreach ($result as $row) { $badge = new Badge($row); array_push($badges, $badge->serialize()); } } return $badges; }