public function handleOpen($id)
 {
     $game = $this->games->find($id);
     if (!$game) {
         $this->sendJson(['status' => 'error', 'message' => 'Game not found.']);
     }
     $this->template->platforms = [];
     $this->template->selected_game = $game;
     $this->redrawControl('gameModal');
 }
 public function processForm(Form $form, $values)
 {
     $game = $this->games->find($values['id_game']);
     if (!$game) {
         $form['id_game']->addError("Hra nebyla nalezena");
         return;
     }
     $pictures = [];
     /** @var FileUpload $upload */
     foreach ($values['pictures'] as $upload) {
         $path = $this->imageManager->put($upload);
         if (!$path) {
             $form->addError("Obrázek {$upload->name} se nepodařilo nahrát");
             continue;
         }
         $picture = new Picture();
         $picture->path = $path;
         $picture->game = $game;
         $pictures[] = $picture;
     }
     $this->onSave($form, $pictures, $game);
 }