This commit is contained in:
Naomi 2013-09-30 13:59:08 -04:00
parent 0dd5458269
commit 1fa13eed13
3 changed files with 36 additions and 36 deletions

View file

@ -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;
}
}