protected function run() { $importURLHistoryRepo = new ImportURLHistoryRepository(); $stat = $this->app['db']->prepare("SELECT * FROM import_url_history"); $stat->execute(); $count = 0; while ($data = $stat->fetch()) { $importURLHistory = new ImportURLHistoryModel(); $importURLHistory->setFromDataBaseRow($data); $importURLHistoryRepo->ensureChangedFlagsAreSet($importURLHistory); ++$count; } return array('result' => 'ok', 'count' => $count); }
protected function makeSureHistoriesAreCorrect($contentsToSend) { $eventHistoryRepository = new EventHistoryRepository(); $groupHistoryRepository = new GroupHistoryRepository(); $areaHistoryRepository = new AreaHistoryRepository(); $venueHistoryRepository = new VenueHistoryRepository(); $importURLHistoryRepository = new ImportURLHistoryRepository(); foreach ($contentsToSend as $contentToSend) { foreach ($contentToSend->getHistories() as $history) { $found = false; if ($history instanceof \models\EventHistoryModel) { $eventHistoryRepository->ensureChangedFlagsAreSet($history); $found = true; } elseif ($history instanceof \models\GroupHistoryModel) { $groupHistoryRepository->ensureChangedFlagsAreSet($history); $found = true; } elseif ($history instanceof \models\VenueHistoryModel) { $venueHistoryRepository->ensureChangedFlagsAreSet($history); $found = true; } elseif ($history instanceof \models\AreaHistoryModel) { $areaHistoryRepository->ensureChangedFlagsAreSet($history); $found = true; } elseif ($history instanceof \models\ImportURLHistoryModel) { $importURLHistoryRepository->ensureChangedFlagsAreSet($history); $found = true; } if (!$found) { foreach ($this->app['extensions']->getExtensions() as $extension) { $extension->makeSureHistoriesAreCorrect($history); } } } } }