| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function createFixtures($season) |
||
| 31 | {
|
||
| 32 | /** @var League $league */ |
||
| 33 | $league = $this->entityManager->getRepository('CoreBundle:League')->findOneBy(array());
|
||
| 34 | $generator = new Generator(count($league->getTeams())); |
||
| 35 | $matches = $generator->createFixtures(); |
||
| 36 | $listOfTeams = $league->getTeams(); |
||
| 37 | |||
| 38 | foreach ($matches as $match) {
|
||
| 39 | $fixture = new Fixture(); |
||
| 40 | $fixture->setSeason($season); |
||
| 41 | $fixture->setWeek($match->getWeek()); |
||
| 42 | $fixture->setTeamHome($listOfTeams[$match->getTeamHome() - 1]); |
||
| 43 | $fixture->setTeamAway($listOfTeams[$match->getTeamAway() - 1]); |
||
| 44 | $fixture->setLeague($league); |
||
| 45 | |||
| 46 | $this->entityManager->persist($fixture); |
||
| 47 | } |
||
| 48 | $this->entityManager->flush(); |
||
| 49 | } |
||
| 50 | } |
||
| 51 |