clean up shows endpoint, remove dependency on Show model
This commit is contained in:
parent
a27ca2f583
commit
174cf79d84
|
@ -1394,13 +1394,12 @@ class ApiController extends Zend_Controller_Action
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
if (empty($showId)) {
|
if (empty($showId)) {
|
||||||
$shows = Application_Model_Show::getDistinctShows();
|
$shows = CcShowQuery::create()->find();
|
||||||
foreach($shows as $baseShow) {
|
foreach($shows as $show) {
|
||||||
$show = new Application_Model_Show($baseShow->getDbId());
|
|
||||||
$results[] = $show->getShowInfo();
|
$results[] = $show->getShowInfo();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$show = new Application_Model_Show($showId);
|
$show = CcShowQuery::create()->findPK($showId);
|
||||||
$results[] = $show->getShowInfo();
|
$results[] = $show->getShowInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -786,28 +786,6 @@ SQL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* returns show specific info (not related to isntance)
|
|
||||||
*/
|
|
||||||
public function getShowInfo()
|
|
||||||
{
|
|
||||||
$info = array();
|
|
||||||
if ($this->getId() == null) {
|
|
||||||
return $info;
|
|
||||||
} else {
|
|
||||||
$ccShow = CcShowQuery::create()->findPK($this->_showId);
|
|
||||||
$info['name'] = $ccShow->getDbName();
|
|
||||||
$info['id'] = $ccShow->getDbId();
|
|
||||||
$info['url'] = $ccShow->getDbUrl();
|
|
||||||
$info['genre'] = $ccShow->getDbGenre();
|
|
||||||
$info['description'] = $ccShow->getDbDescription();
|
|
||||||
$info['color'] = $ccShow->getDbColor();
|
|
||||||
$info['background_color'] = $ccShow->getDbBackgroundColor();
|
|
||||||
$info['linked'] = $ccShow->getDbLinked();
|
|
||||||
return $info;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Only used for shows that are repeating. Note that this will return
|
/* Only used for shows that are repeating. Note that this will return
|
||||||
* true even for dates that only have a "modified" show instance (does not
|
* true even for dates that only have a "modified" show instance (does not
|
||||||
* check if the "modified_instance" column is set to true). This is intended
|
* check if the "modified_instance" column is set to true). This is intended
|
||||||
|
@ -1482,8 +1460,4 @@ SQL;
|
||||||
return array($start, $end);
|
return array($start, $end);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDistinctShows() {
|
|
||||||
$shows = CcShowQuery::create()->find();
|
|
||||||
return $shows;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,4 +304,23 @@ class CcShow extends BaseCcShow {
|
||||||
->filterByDbId($instanceId, Criteria::NOT_EQUAL)
|
->filterByDbId($instanceId, Criteria::NOT_EQUAL)
|
||||||
->find();
|
->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getShowInfo()
|
||||||
|
{
|
||||||
|
$info = array();
|
||||||
|
if ($this->getDbId() == null) {
|
||||||
|
return $info;
|
||||||
|
} else {
|
||||||
|
$info['name'] = $this->getDbName();
|
||||||
|
$info['id'] = $this->getDbId();
|
||||||
|
$info['url'] = $this->getDbUrl();
|
||||||
|
$info['genre'] = $this->getDbGenre();
|
||||||
|
$info['description'] = $this->getDbDescription();
|
||||||
|
$info['color'] = $this->getDbColor();
|
||||||
|
$info['background_color'] = $this->getDbBackgroundColor();
|
||||||
|
$info['linked'] = $this->getDbLinked();
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} // CcShow
|
} // CcShow
|
||||||
|
|
Loading…
Reference in New Issue