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

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

View file

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

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