예제 #1
0
 protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
 {
     $em = $this->getHelper('em')->getEntityManager();
     $gameRepository = new GameRepository($em);
     $games = $gameRepository->getAllGames(2);
     $count = 0;
     foreach ($games as $game) {
         $plays = $game->getPlays();
         foreach ($plays as $play) {
             $event = $play->getEvent();
             if ($event->isPlay()) {
                 $matchup = new PitchingMatchup();
                 $matchup->setGame($play->getGame());
                 $matchup->setPitcher($play->getPitcher());
                 $matchup->setBatter($play->getBatter());
                 $matchup->setEvent($event);
                 $em->persist($matchup);
                 //$output->writeln($matchup);
                 $count++;
             }
         }
         $em->flush();
         //$em->clear();
     }
     $em->flush();
 }
예제 #2
0
 public function setPitcher(\BBM\Player $pitcher)
 {
     $this->_load();
     return parent::setPitcher($pitcher);
 }