private static function pokemonFromResult($result) { $pokemonArr = array(); if ($result && mysqli_num_rows($result) > 0) { foreach ($result as $row) { $pokemon = new Pokemon($row); array_push($pokemonArr, $pokemon->serialize()); } } return $pokemonArr; }
public function getPokemon() { $result = Database::query(SQL::trainerPokemon($this->id)); $pokemonArr = array(); if (mysqli_num_rows($result) > 0) { foreach ($result as $row) { $pokemon = new Pokemon($row); array_push($pokemonArr, $pokemon->serialize()); } } return $pokemonArr; }