From a3d4b8c722c35dcd50611b2c17350988bc98a031 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 10 Sep 2012 11:05:30 -0400 Subject: [PATCH] Todo for consistency. --- .../application/models/ShowInstance.php | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index afbacdadf..906f59ff9 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -167,26 +167,33 @@ class Application_Model_ShowInstance $con = Propel::getConnection(); $instance_id = $this->getShowInstanceId(); - $sql = "SELECT starts from cc_schedule" - ." WHERE instance_id = $instance_id" - ." ORDER BY starts" - ." LIMIT 1"; - - $scheduleStarts = $con->query($sql)->fetchColumn(0); + $sql = << $instance_id ), 'column' ); if ($scheduleStarts) { $scheduleStartsEpoch = strtotime($scheduleStarts); - $showStartsEpoch = strtotime($this->getShowInstanceStart()); + $showStartsEpoch = strtotime($this->getShowInstanceStart()); $diff = $showStartsEpoch - $scheduleStartsEpoch; if ($diff != 0) { - $sql = "UPDATE cc_schedule" - ." SET starts = starts + INTERVAL '$diff' second," - ." ends = ends + INTERVAL '$diff' second" - ." WHERE instance_id = $instance_id"; - - $con->exec($sql); + $sql = << $diff, + ':diff2' => $diff, + ':instanceId' => $instance_id ), 'execute'); } } Application_Model_RabbitMq::PushSchedule();