public function makeSureHistoriesAreCorrect($interfaceHistoryModel) { // @TODO InterfaceHistoryModel type!!!!!! if ($interfaceHistoryModel instanceof \org\openacalendar\comments\models\AreaCommentHistoryModel) { $repo = new AreaCommentHistoryRepository(); $repo->ensureChangedFlagsAreSet($interfaceHistoryModel); } else { if ($interfaceHistoryModel instanceof \org\openacalendar\comments\models\EventCommentHistoryModel) { $repo = new EventCommentHistoryRepository(); $repo->ensureChangedFlagsAreSet($interfaceHistoryModel); } } }
protected function run() { $areaHistoryRepo = new AreaCommentHistoryRepository(); $stat = $this->app['db']->prepare("SELECT * FROM area_comment_history"); $stat->execute(); $count = 0; while ($data = $stat->fetch()) { $areaHistory = new AreaCommentHistoryModel(); $areaHistory->setFromDataBaseRow($data); $areaHistoryRepo->ensureChangedFlagsAreSet($areaHistory); ++$count; } return array('result' => 'ok', 'count' => $count); }