CC-4249: Playlist: Playlist's length doesn't update if it contains a smart playlist which the length is changed
-fixed
This commit is contained in:
parent
38173bd3a2
commit
bf69f23343
|
@ -451,6 +451,10 @@ EOT;
|
||||||
$this->block->save($this->con);
|
$this->block->save($this->con);
|
||||||
|
|
||||||
$this->con->commit();
|
$this->con->commit();
|
||||||
|
|
||||||
|
//check if block is in any playlists and update the playlist's length
|
||||||
|
Application_Model_Playlist::updatePlaylistsLengthWithBlock($this->id, $this->getLength());
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->con->rollback();
|
$this->con->rollback();
|
||||||
throw $e;
|
throw $e;
|
||||||
|
@ -562,6 +566,11 @@ EOT;
|
||||||
$this->block->save($this->con);
|
$this->block->save($this->con);
|
||||||
|
|
||||||
$this->con->commit();
|
$this->con->commit();
|
||||||
|
|
||||||
|
|
||||||
|
//check if block is in any playlists and update the playlist's length
|
||||||
|
Application_Model_Playlist::updatePlaylistsLengthWithBlock($this->id, $this->getLength());
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->con->rollback();
|
$this->con->rollback();
|
||||||
throw $e;
|
throw $e;
|
||||||
|
|
|
@ -913,6 +913,26 @@ SQL;
|
||||||
{
|
{
|
||||||
CcPlaylistcontentsQuery::create()->findByDbPlaylistId($this->id)->delete();
|
CcPlaylistcontentsQuery::create()->findByDbPlaylistId($this->id)->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* After items get deleted/added from/to a block
|
||||||
|
* this function updates the length of playlists
|
||||||
|
* that contain that block
|
||||||
|
*/
|
||||||
|
public static function updatePlaylistsLengthWithBlock($p_blockId, $p_blockLength) {
|
||||||
|
$playlists = CcPlaylistQuery::create()->find();
|
||||||
|
foreach ($playlists as $pl) {
|
||||||
|
$contents = CcPlaylistcontentsQuery::create()->findByDbPlaylistId($pl->getDbId());
|
||||||
|
//check if the block is in each playlist
|
||||||
|
foreach ($contents as $item) {
|
||||||
|
if ($item->getDbBlockId() == $p_blockId) {
|
||||||
|
$item->setDbCliplength($p_blockLength);
|
||||||
|
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
|
||||||
|
$item->save($con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // class Playlist
|
} // class Playlist
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue