Exemplo n.º 1
0
 public static function createRandom()
 {
     $names = array('Uranus', 'Earth', 'Mars', 'Venus', 'Saturn', 'Pluto');
     shuffle($names);
     $oPlanet = new Planet();
     $oPlanet->setName($names[0]);
     $oPlanet->setType('Planet');
     $oPlanet->setUser(mt_rand(1, 10));
     $oPlanet->setAge(mt_rand(0, 5));
     $oPlanet->setWater(mt_rand(0, 1));
     $oPlanet->setOxygen(mt_rand(0, 1));
     $oPlanet->setGround(mt_rand(0, 1));
     $oPlanet->setItrium(mt_rand(0, 1));
     $oPlanet->setForest(mt_rand(0, 1));
     $oPlanet->setCivilisation(mt_rand(0, 1));
     $oPlanet->save();
 }