diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index c48e82b0c..992408bf3 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -1075,7 +1075,7 @@ class ApiController extends Zend_Controller_Action $webstream_metadata->setDbLiquidsoapData($data_title); $webstream_metadata->save(); - $historyService = new Application_Service_HistoryService(); + $historyService = new Application_Service_HistoryService(); $historyService->insertWebstreamMetadata($media_id, $startDT, $data_arr); } } diff --git a/airtime_mvc/application/models/airtime/CcPlayoutHistoryMetaData.php b/airtime_mvc/application/models/airtime/CcPlayoutHistoryMetaData.php index b55de6043..9eb4958a2 100644 --- a/airtime_mvc/application/models/airtime/CcPlayoutHistoryMetaData.php +++ b/airtime_mvc/application/models/airtime/CcPlayoutHistoryMetaData.php @@ -15,20 +15,20 @@ */ class CcPlayoutHistoryMetaData extends BaseCcPlayoutHistoryMetaData { - /** - * Set the value of [value] column. - * - * @param string $v new value - * @return CcPlayoutHistoryMetaData The current object (for fluent API support) - */ - public function setDbValue($v) + /** + * Set the value of [value] column. + * + * @param string $v new value + * @return CcPlayoutHistoryMetaData The current object (for fluent API support) + */ + public function setDbValue($v) { - //make sure the metadata isn't longer than the DB field. + //make sure the metadata isn't longer than the DB field. $v = substr($v, 0, 128); - parent::setDbValue($v); - - return $this; + parent::setDbValue($v); + + return $this; } // setDbValue() } // CcPlayoutHistoryMetaData diff --git a/airtime_mvc/application/services/HistoryService.php b/airtime_mvc/application/services/HistoryService.php index d273e1fb9..5566a1acd 100644 --- a/airtime_mvc/application/services/HistoryService.php +++ b/airtime_mvc/application/services/HistoryService.php @@ -511,43 +511,43 @@ class Application_Service_HistoryService public function insertWebstreamMetadata($schedId, $startDT, $data) { - $this->con->beginTransaction(); - + $this->con->beginTransaction(); + try { $item = CcScheduleQuery::create()->findPK($schedId, $this->con); - //TODO figure out how to combine these all into 1 query. - $showInstance = $item->getCcShowInstances($this->con); + //TODO figure out how to combine these all into 1 query. + $showInstance = $item->getCcShowInstances($this->con); $show = $showInstance->getCcShow($this->con); $webstream = $item->getCcWebstream($this->con); - $metadata = array(); + $metadata = array(); $metadata["showname"] = $show->getDbName(); $metadata[MDATA_KEY_TITLE] = $data->title; - $metadata[MDATA_KEY_CREATOR] = $webstream->getDbName(); - - $history = new CcPlayoutHistory(); + $metadata[MDATA_KEY_CREATOR] = $webstream->getDbName(); + + $history = new CcPlayoutHistory(); $history->setDbStarts($startDT); - $history->setDbEnds(null); - $history->setDbInstanceId($item->getDbInstanceId()); - - foreach ($metadata as $key => $val) { - $meta = new CcPlayoutHistoryMetaData(); - $meta->setDbKey($key); - $meta->setDbValue($val); - - $history->addCcPlayoutHistoryMetaData($meta); - } - + $history->setDbEnds(null); + $history->setDbInstanceId($item->getDbInstanceId()); + + foreach ($metadata as $key => $val) { + $meta = new CcPlayoutHistoryMetaData(); + $meta->setDbKey($key); + $meta->setDbValue($val); + + $history->addCcPlayoutHistoryMetaData($meta); + } + $history->save($this->con); - $this->con->commit(); - } - catch (Exception $e) { - $this->con->rollback(); - throw $e; + $this->con->commit(); + } + catch (Exception $e) { + $this->con->rollback(); + throw $e; } }