| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | public function addTomorrowGame(): void |
||
| 25 | { |
||
| 26 | $tomorrow = new Datetime('tomorrow'); |
||
| 27 | $gameDay = $this->em->getRepository(GameDay::class)->findOneBy(array('day' => $tomorrow)); |
||
| 28 | if (!$gameDay) { |
||
| 29 | $games = $this->em->getRepository(Game::class)->getIds(); |
||
| 30 | $rand_key = array_rand($games, 1); |
||
| 31 | $game = $this->em->getRepository(Game::class)->findOneBy($games[$rand_key]); |
||
| 32 | $gameDay = new GameDay(); |
||
| 33 | $gameDay->setGame($game); |
||
| 34 | $gameDay->setDay($tomorrow); |
||
| 35 | $this->em->persist($gameDay); |
||
| 36 | $this->em->flush(); |
||
| 37 | } |
||
| 40 |