Exemple #1
0
 public function indexAction()
 {
     $bootstrap = $this->getInvokeArg('bootstrap');
     $em = $bootstrap->getResource('doctrine');
     $gameRepository = new GameRepository($em);
     $this->view->games = $gameRepository->getAllGames();
 }
 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();
 }
Exemple #3
0
<?php

set_include_path(realpath(dirname(__FILE__)));
use BBM\Pitcher, BBM\StartingLineup, BBM\Team, BBM\Game, BBM\GameRepository, BBM\BettingPlanService, BBM\Strategies\RecentGameStrategy;
$gameRepository = new GameRepository();
// Create a set of games
$games = $gameRepository->getAllGames();
$strategies = array(new RecentGameStrategy());
// Return a Betting Plan
$plan = new BBM\BettingPlanService($games, $strategies);
// Apply the betting plan
$plan->applyToGames($games);
//echo $royH . "\n";
function __autoload($class)
{
    $className = str_replace('\\', '/', $class);
    require_once $className . '.php';
}