CC-3174 : showbuilder
throwing an exception if playlist doesn't exist.
This commit is contained in:
parent
0afa904ffe
commit
1deebedf11
airtime_mvc/application/models
|
@ -54,6 +54,10 @@ class Application_Model_Playlist {
|
||||||
{
|
{
|
||||||
if (isset($id)) {
|
if (isset($id)) {
|
||||||
$this->pl = CcPlaylistQuery::create()->findPK($id);
|
$this->pl = CcPlaylistQuery::create()->findPK($id);
|
||||||
|
|
||||||
|
if (is_null($this->_pl)){
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->pl = new CcPlaylist();
|
$this->pl = new CcPlaylist();
|
||||||
|
@ -206,7 +210,7 @@ class Application_Model_Playlist {
|
||||||
$contentsToUpdate = CcPlaylistcontentsQuery::create()
|
$contentsToUpdate = CcPlaylistcontentsQuery::create()
|
||||||
->filterByDbPlaylistId($this->id)
|
->filterByDbPlaylistId($this->id)
|
||||||
->orderByDbPosition()
|
->orderByDbPosition()
|
||||||
->find();
|
->find($this->con);
|
||||||
|
|
||||||
$pos = $afterItem->getDbPosition() + 1;
|
$pos = $afterItem->getDbPosition() + 1;
|
||||||
}
|
}
|
||||||
|
@ -279,12 +283,12 @@ class Application_Model_Playlist {
|
||||||
|
|
||||||
CcPlaylistcontentsQuery::create()
|
CcPlaylistcontentsQuery::create()
|
||||||
->findPKs($p_items)
|
->findPKs($p_items)
|
||||||
->delete();
|
->delete($this->con);
|
||||||
|
|
||||||
$contents = CcPlaylistcontentsQuery::create()
|
$contents = CcPlaylistcontentsQuery::create()
|
||||||
->filterByDbPlaylistId($this->id)
|
->filterByDbPlaylistId($this->id)
|
||||||
->orderByDbPosition()
|
->orderByDbPosition()
|
||||||
->find();
|
->find($this->con);
|
||||||
|
|
||||||
//reset the positions of the remaining items.
|
//reset the positions of the remaining items.
|
||||||
for ($i = 0; $i < count($contents); $i++) {
|
for ($i = 0; $i < count($contents); $i++) {
|
||||||
|
|
Loading…
Reference in New Issue