CC-3174 : showbuilder

overriding some propel setter/getters to support subseconds
or using fades in ss.uuuuuu time as a default.
This commit is contained in:
Naomi Aro 2012-02-07 13:29:50 +01:00
parent d9947b622a
commit f651024a6e
8 changed files with 244 additions and 300 deletions

View file

@ -4,7 +4,7 @@
/**
* Base class that represents a row from the 'cc_playlistcontents' table.
*
*
*
*
* @package propel.generator.airtime.om
*/
@ -137,7 +137,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Get the [id] column value.
*
*
* @return int
*/
public function getDbId()
@ -147,7 +147,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Get the [playlist_id] column value.
*
*
* @return int
*/
public function getDbPlaylistId()
@ -157,7 +157,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Get the [file_id] column value.
*
*
* @return int
*/
public function getDbFileId()
@ -167,7 +167,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Get the [position] column value.
*
*
* @return int
*/
public function getDbPosition()
@ -177,7 +177,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Get the [optionally formatted] temporal [cliplength] column value.
*
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
@ -210,7 +210,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Get the [optionally formatted] temporal [cuein] column value.
*
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
@ -243,7 +243,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Get the [optionally formatted] temporal [cueout] column value.
*
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
@ -276,7 +276,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Get the [optionally formatted] temporal [fadein] column value.
*
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
@ -289,8 +289,6 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
return null;
}
try {
$dt = new DateTime($this->fadein);
} catch (Exception $x) {
@ -309,7 +307,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Get the [optionally formatted] temporal [fadeout] column value.
*
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
@ -342,7 +340,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Set the value of [id] column.
*
*
* @param int $v new value
* @return CcPlaylistcontents The current object (for fluent API support)
*/
@ -362,7 +360,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Set the value of [playlist_id] column.
*
*
* @param int $v new value
* @return CcPlaylistcontents The current object (for fluent API support)
*/
@ -386,7 +384,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Set the value of [file_id] column.
*
*
* @param int $v new value
* @return CcPlaylistcontents The current object (for fluent API support)
*/
@ -410,7 +408,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Set the value of [position] column.
*
*
* @param int $v new value
* @return CcPlaylistcontents The current object (for fluent API support)
*/
@ -430,7 +428,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Sets the value of [cliplength] column to a normalized version of the date/time value specified.
*
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @return CcPlaylistcontents The current object (for fluent API support)
@ -466,7 +464,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$currNorm = ($this->cliplength !== null && $tmpDt = new DateTime($this->cliplength)) ? $tmpDt->format('H:i:s') : null;
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
if ( ($currNorm !== $newNorm) // normalized values don't match
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
)
{
@ -480,7 +478,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Sets the value of [cuein] column to a normalized version of the date/time value specified.
*
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @return CcPlaylistcontents The current object (for fluent API support)
@ -516,7 +514,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$currNorm = ($this->cuein !== null && $tmpDt = new DateTime($this->cuein)) ? $tmpDt->format('H:i:s') : null;
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
if ( ($currNorm !== $newNorm) // normalized values don't match
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
)
{
@ -530,7 +528,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Sets the value of [cueout] column to a normalized version of the date/time value specified.
*
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @return CcPlaylistcontents The current object (for fluent API support)
@ -566,7 +564,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$currNorm = ($this->cueout !== null && $tmpDt = new DateTime($this->cueout)) ? $tmpDt->format('H:i:s') : null;
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
if ( ($currNorm !== $newNorm) // normalized values don't match
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
)
{
@ -580,7 +578,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Sets the value of [fadein] column to a normalized version of the date/time value specified.
*
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @return CcPlaylistcontents The current object (for fluent API support)
@ -616,7 +614,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$currNorm = ($this->fadein !== null && $tmpDt = new DateTime($this->fadein)) ? $tmpDt->format('H:i:s') : null;
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
if ( ($currNorm !== $newNorm) // normalized values don't match
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
)
{
@ -630,7 +628,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
/**
* Sets the value of [fadeout] column to a normalized version of the date/time value specified.
*
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @return CcPlaylistcontents The current object (for fluent API support)
@ -666,7 +664,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$currNorm = ($this->fadeout !== null && $tmpDt = new DateTime($this->fadeout)) ? $tmpDt->format('H:i:s') : null;
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
if ( ($currNorm !== $newNorm) // normalized values don't match
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
)
{
@ -838,7 +836,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
if ($con === null) {
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$con->beginTransaction();
try {
$ret = $this->preDelete($con);
@ -880,7 +878,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
if ($con === null) {
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$con->beginTransaction();
$isInsert = $this->isNew();
try {
@ -1133,7 +1131,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
* type constants.
*
* @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME.
* @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
* @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
@ -1528,7 +1526,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
}
// aggregate_column_relation behavior
/**
* Update the aggregate column in the related CcPlaylist object
*

View file

@ -1,31 +0,0 @@
<?php
require_once('Common.php');
/**
* Skeleton subclass for representing a row from the 'cc_files' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.campcaster
*/
class CcFiles extends BaseCcFiles {
public function getDbLength()
{
return $this->length;
}
public function setDbLength($time)
{
$this->length = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::LENGTH;
return Common::setTimeInSub($this, 'LENGTH', $time);
}
} // CcFiles

View file

@ -1,48 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_playlist' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.campcaster
*/
class CcPlaylist extends BaseCcPlaylist {
public function computeLastPosition()
{
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
$sql = 'SELECT MAX('.CcPlaylistcontentsPeer::POSITION.') AS pos'
. ' FROM ' .CcPlaylistcontentsPeer::TABLE_NAME
. ' WHERE ' .CcPlaylistcontentsPeer::PLAYLIST_ID. ' = :p1';
$stmt = $con->prepare($sql);
$stmt->bindValue(':p1', $this->getDbId());
$stmt->execute();
return $stmt->fetchColumn();
}
public function computeLength()
{
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
$sql = 'SELECT SUM('.CcPlaylistcontentsPeer::CLIPLENGTH.') AS length'
. ' FROM ' .CcPlaylistcontentsPeer::TABLE_NAME
. ' WHERE ' .CcPlaylistcontentsPeer::PLAYLIST_ID. ' = :p1';
$stmt = $con->prepare($sql);
$stmt->bindValue(':p1', $this->getDbId());
$stmt->execute();
return $stmt->fetchColumn();
}
} // CcPlaylist

View file

@ -1,81 +0,0 @@
<?php
require_once('Common.php');
/**
* Skeleton subclass for representing a row from the 'cc_playlistcontents' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.campcaster
*/
class CcPlaylistcontents extends BaseCcPlaylistcontents {
public function getDbFadein()
{
return $this->fadein;
}
public function setDbFadein($time)
{
$this->fadein = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN;
Common::setTimeInSub($this, 'FADEIN', $time);
}
public function getDbFadeout()
{
return $this->fadeout;
}
public function setDbFadeout($time)
{
$this->fadeout = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT;
Common::setTimeInSub($this, 'FADEOUT', $time);
}
public function getDbCuein()
{
return $this->cuein;
}
public function setDbCuein($time)
{
$this->cuein = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
Common::setTimeInSub($this, 'CUEIN', $time);
}
public function getDbCueout()
{
return $this->cueout;
}
public function setDbCueout($time)
{
$this->cueout = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
Common::setTimeInSub($this, 'CUEOUT', $time);
}
public function getDbCliplength()
{
return $this->cliplength;
}
public function setDbCliplength($time)
{
$this->cliplength = $time;
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
Common::setTimeInSub($this, 'CLIPLENGTH', $time);
}
} // CcPlaylistcontents

View file

@ -1,19 +0,0 @@
<?php
class Common {
public static function setTimeInSub($row, $col, $time)
{
$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();
}
}