private function parseCreationForm(array &$data)
 {
     $game = array();
     if (isset($_POST['name']) && preg_match("/^([a-zA-Z0-9]+[a-zA-Z0-9' -]+[a-zA-Z0-9']+)?\$/", $_POST['name'])) {
         $game['name'] = $_POST['name'];
     }
     if (isset($_POST['players']) && preg_match("/[2-6]{1}/", $_POST['players'])) {
         $game['players'] = $_POST['players'];
     }
     $data['game'] = $game;
     // colors
     $colors = array();
     $iter = ModelColor::iterator();
     while ($iter->hasNext()) {
         $_Color = $iter->next();
         $color = array();
         $color['id'] = $_Color->getId();
         $color['name'] = $_Color->getName();
         $color['color'] = $_Color->getColor();
         $colors[] = $color;
     }
     $data['colors'] = $colors;
     return $data;
 }
 /**
  * @return array(int id => dict(id = int, color = string))
  */
 public function getFreeColors()
 {
     $colors_taken = array();
     $output = array();
     // array with taken colors
     $iter = ModelIsInGameInfo::iterator(null, $this->id);
     while ($iter->hasNext()) {
         $colors_taken[] = $iter->next()->getIdColor();
     }
     $iter = ModelColor::iterator();
     while ($iter->hasNext()) {
         $_Color = $iter->next();
         if (in_array($_Color->getId(), $colors_taken)) {
             continue;
         }
         $output[$_Color->getId()] = array('id' => $_Color->getId(), 'color' => $_Color->getName());
     }
     return $output;
 }
 /**
  * @return ModelColor
  */
 public function getColor()
 {
     return ModelColor::getModelColor($this->id_color);
 }