propel changes for playlist.

This commit is contained in:
naomiaro 2010-11-11 20:48:53 -05:00
parent f7dc117417
commit e1b6ee8d46
4 changed files with 66 additions and 67 deletions

View file

@ -16,14 +16,16 @@ require_once('Common.php');
class CcFiles extends BaseCcFiles {
public function getDbLength()
{
return Common::getTimeInSub($this, 'LENGTH');
}
{
return $this->length;
}
public function setDbLength($time)
{
return Common::setTimeInSub($this, 'LENGTH', $time);
}
public function setDbLength($time)
{
$this->length = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::LENGTH;
return Common::setTimeInSub($this, 'LENGTH', $time);
}
} // CcFiles

View file

@ -17,53 +17,63 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
public function getDbFadein()
{
return Common::getTimeInSub($this, 'FADEIN');
return $this->fadein;
}
public function setDbFadein($time)
{
return Common::setTimeInSub($this, 'FADEIN', $time);
}
{
$this->fadein = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN;
return Common::setTimeInSub($this, 'FADEIN', $time);
}
public function getDbFadeout()
{
return Common::getTimeInSub($this, 'FADEOUT');
}
{
return $this->fadeout;
}
public function setDbFadeout($time)
{
return Common::setTimeInSub($this, 'FADEOUT', $time);
}
{
$this->fadeout = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT;
return Common::setTimeInSub($this, 'FADEOUT', $time);
}
public function getDbCuein()
{
return Common::getTimeInSub($this, 'CUEIN');
}
{
return $this->cuein;
}
public function setDbCuein($time)
{
return Common::setTimeInSub($this, 'CUEIN', $time);
}
{
$this->cuein = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
return Common::setTimeInSub($this, 'CUEIN', $time);
}
public function getDbCueout()
{
return Common::getTimeInSub($this, 'CUEOUT');
}
{
return $this->cueout;
}
public function setDbCueout($time)
{
return Common::setTimeInSub($this, 'CUEOUT', $time);
}
public function setDbCueout($time)
{
$this->cueout = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
return Common::setTimeInSub($this, 'CUEOUT', $time);
}
public function getDbCliplength()
{
return Common::getTimeInSub($this, 'CLIPLENGTH');
}
{
return $this->cliplength;
}
public function setDbCliplength($time)
{
return Common::setTimeInSub($this, 'CLIPLENGTH', $time);
}
public function setDbCliplength($time)
{
$this->cliplength = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
return Common::setTimeInSub($this, 'CLIPLENGTH', $time);
}

View file

@ -4,32 +4,16 @@ class Common {
public static function setTimeInSub($row, $col, $time)
{
$class = get_class($row).'Peer';
$con = Propel::getConnection($class::DATABASE_NAME);
$class = get_class($row).'Peer';
$con = Propel::getConnection($class::DATABASE_NAME);
$sql = 'UPDATE '.$class::TABLE_NAME
. ' SET '.$col.' = :f1'
. ' WHERE ' .$class::ID. ' = :p1';
$stmt = $con->prepare($sql);
$stmt->bindValue(':f1', $time);
$stmt->bindValue(':p1', $row->getDbId());
$stmt->execute();
$sql = 'UPDATE '.$class::TABLE_NAME
. ' SET '.$col.' = :f1'
. ' WHERE ' .$class::ID. ' = :p1';
$stmt = $con->prepare($sql);
$stmt->bindValue(':f1', $time);
$stmt->bindValue(':p1', $row->getDbId());
$stmt->execute();
}
public static function getTimeInSub($row, $col)
{
$class = get_class($row).'Peer';
$con = Propel::getConnection($class::DATABASE_NAME);
$sql = 'SELECT '.$col
. ' FROM '.$class::TABLE_NAME
. ' WHERE ' .$class::ID. ' = :p1';
$stmt = $con->prepare($sql);
$stmt->bindValue(':p1', $row->getDbId());
$stmt->execute();
return $stmt->fetchColumn();
}
}