From 7bb55fadbd10400b8d7ca6b46f45d35a01acde10 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 23 Jun 2016 22:59:33 +0200 Subject: [PATCH] SyncruleController: base logic on SyncRule --- application/controllers/SyncruleController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/application/controllers/SyncruleController.php b/application/controllers/SyncruleController.php index ef71c95f..c0e33ea7 100644 --- a/application/controllers/SyncruleController.php +++ b/application/controllers/SyncruleController.php @@ -25,8 +25,9 @@ class SyncruleController extends ActionController public function runAction() { $id = $this->params->get('id'); - $sync = new Sync(SyncRule::load($id, $this->db())); - if ($runId = $sync->apply()) { + $rule = SyncRule::load($id, $this->db()); + if ($rule->applyChanges()) { + $runId = $rule->getCurrentSyncRunId(); Notification::success('Source has successfully been synchronized'); $this->redirectNow( Url::fromPath( @@ -38,6 +39,8 @@ class SyncruleController extends ActionController ) ); } else { + Notification::error('Synchronization failed'); + $this->redirectNow('director/list/syncrule'); } }