| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | public function __construct(SettingsRepository $settingsRepository, EntityManagerInterface $entityManager) |
||
| 15 | { |
||
| 16 | $settings = $settingsRepository->getTheSingleRow(); |
||
| 17 | if ($settings === null) { |
||
| 18 | // Minuscule chance of a race condition but in that worst-case scenario |
||
| 19 | // we'll always bring back the first row from the database when we |
||
| 20 | // getTheSingleRow() so all that will happen is that an extra row |
||
| 21 | // will languish in the database forever. |
||
| 22 | $settings = new Settings(); |
||
| 23 | $entityManager->persist($settings); |
||
| 24 | $entityManager->flush(); |
||
| 25 | } |
||
| 26 | $this->settings = $settings; |
||
| 27 | } |
||
| 59 | } |