CC-3174 : showbuilder

changing cues/cliplengths to be interval column type.
This commit is contained in:
Naomi Aro 2012-03-01 11:48:57 +01:00
parent a9cdb512b9
commit b7e5bfe4aa
10 changed files with 132 additions and 731 deletions

View File

@ -35,39 +35,6 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
return parent::getDbFadeout($format);
}
/**
* Just changing the default format to return subseconds
*
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getDbCuein($format = 'H:i:s.u')
{
return parent::getDbCuein($format);
}
/**
* Just changing the default format to return subseconds
*
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getDbCueout($format = 'H:i:s.u')
{
return parent::getDbCueout($format);
}
/**
* Just changing the default format to return subseconds
*
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getDbCliplength($format = 'H:i:s.u')
{
return parent::getDbCliplength($format);
}
/**
*
* @param String in format SS.uuuuuu, Datetime, or DateTime accepted string.
@ -124,88 +91,4 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
return $this;
} // setDbFadeout()
/**
* 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)
*/
public function setDbCuein($v)
{
if ($v instanceof DateTime) {
$dt = $v;
}
else {
try {
$dt = new DateTime($v);
}
catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
}
$this->cuein = $dt->format('H:i:s.u');
$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
return $this;
} // setDbCuein()
/**
* 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)
*/
public function setDbCueout($v)
{
if ($v instanceof DateTime) {
$dt = $v;
}
else {
try {
$dt = new DateTime($v);
}
catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
}
$this->cueout = $dt->format('H:i:s.u');
$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
return $this;
} // setDbCueout()
/**
* 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)
*/
public function setDbCliplength($v)
{
if ($v instanceof DateTime) {
$dt = $v;
}
else {
try {
$dt = new DateTime($v);
} catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
}
$this->cliplength = $dt->format('H:i:s.u');
$this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
return $this;
} // setDbCliplength()
} // CcPlaylistcontents

View File

@ -15,11 +15,6 @@
*/
class CcSchedule extends BaseCcSchedule {
public function getDbClipLength($format = 'H:i:s.u')
{
return parent::getDbClipLength($format);
}
/**
* Get the [optionally formatted] temporal [starts] column value.
*
@ -104,28 +99,6 @@ class CcSchedule extends BaseCcSchedule {
return parent::getDbFadeout($format);
}
/**
* Just changing the default format to return subseconds
*
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getDbCueIn($format = 'H:i:s.u')
{
return parent::getDbCuein($format);
}
/**
* Just changing the default format to return subseconds
*
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getDbCueOut($format = 'H:i:s.u')
{
return parent::getDbCueout($format);
}
/**
*
* @param String in format SS.uuuuuu, Datetime, or DateTime accepted string.
@ -182,89 +155,6 @@ class CcSchedule extends BaseCcSchedule {
return $this;
} // setDbFadeout()
/**
* 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)
*/
public function setDbCueIn($v)
{
if ($v instanceof DateTime) {
$dt = $v;
}
else {
try {
$dt = new DateTime($v);
}
catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
}
$this->cue_in = $dt->format('H:i:s.u');
$this->modifiedColumns[] = CcSchedulePeer::CUE_IN;
return $this;
} // setDbCuein()
/**
* 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)
*/
public function setDbCueout($v)
{
if ($v instanceof DateTime) {
$dt = $v;
}
else {
try {
$dt = new DateTime($v);
}
catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
}
$this->cue_out = $dt->format('H:i:s.u');
$this->modifiedColumns[] = CcSchedulePeer::CUE_OUT;
return $this;
} // setDbCueout()
/**
* 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)
*/
public function setDbClipLength($v)
{
if ($v instanceof DateTime) {
$dt = $v;
}
else {
try {
$dt = new DateTime($v);
} catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
}
$this->clip_length = $dt->format('H:i:s.u');
$this->modifiedColumns[] = CcSchedulePeer::CLIP_LENGTH;
return $this;
} // setDbCliplength()
/**
* Sets the value of [starts] column to a normalized version of the date/time value specified.
*

View File

@ -42,9 +42,9 @@ class CcPlaylistcontentsTableMap extends TableMap {
$this->addForeignKey('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', 'cc_playlist', 'ID', false, null, null);
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null);
$this->addColumn('CLIPLENGTH', 'DbCliplength', 'TIME', false, null, '00:00:00');
$this->addColumn('CUEIN', 'DbCuein', 'TIME', false, null, '00:00:00');
$this->addColumn('CUEOUT', 'DbCueout', 'TIME', false, null, '00:00:00');
$this->addColumn('CLIPLENGTH', 'DbCliplength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('CUEIN', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('CUEOUT', 'DbCueout', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('FADEIN', 'DbFadein', 'TIME', false, null, '00:00:00');
$this->addColumn('FADEOUT', 'DbFadeout', 'TIME', false, null, '00:00:00');
// validators

View File

@ -42,11 +42,11 @@ class CcScheduleTableMap extends TableMap {
$this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
$this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
$this->addColumn('CLIP_LENGTH', 'DbClipLength', 'TIME', false, null, '00:00:00');
$this->addColumn('CLIP_LENGTH', 'DbClipLength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('FADE_IN', 'DbFadeIn', 'TIME', false, null, '00:00:00');
$this->addColumn('FADE_OUT', 'DbFadeOut', 'TIME', false, null, '00:00:00');
$this->addColumn('CUE_IN', 'DbCueIn', 'TIME', false, null, '00:00:00');
$this->addColumn('CUE_OUT', 'DbCueOut', 'TIME', false, null, '00:00:00');
$this->addColumn('CUE_IN', 'DbCueIn', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('CUE_OUT', 'DbCueOut', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('MEDIA_ITEM_PLAYED', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false);
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null);
// validators

View File

@ -176,102 +176,33 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
}
/**
* Get the [optionally formatted] temporal [cliplength] column value.
* Get the [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.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
* @return string
*/
public function getDbCliplength($format = '%X')
public function getDbCliplength()
{
if ($this->cliplength === null) {
return null;
}
try {
$dt = new DateTime($this->cliplength);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cliplength, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
return $this->cliplength;
}
/**
* Get the [optionally formatted] temporal [cuein] column value.
* Get the [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.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
* @return string
*/
public function getDbCuein($format = '%X')
public function getDbCuein()
{
if ($this->cuein === null) {
return null;
}
try {
$dt = new DateTime($this->cuein);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cuein, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
return $this->cuein;
}
/**
* Get the [optionally formatted] temporal [cueout] column value.
* Get the [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.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
* @return string
*/
public function getDbCueout($format = '%X')
public function getDbCueout()
{
if ($this->cueout === null) {
return null;
}
try {
$dt = new DateTime($this->cueout);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cueout, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
return $this->cueout;
}
/**
@ -429,151 +360,61 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
} // setDbPosition()
/**
* Sets the value of [cliplength] column to a normalized version of the date/time value specified.
* Set the value of [cliplength] column.
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @param string $v new value
* @return CcPlaylistcontents The current object (for fluent API support)
*/
public function setDbCliplength($v)
{
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
// -- which is unexpected, to say the least.
if ($v === null || $v === '') {
$dt = null;
} elseif ($v instanceof DateTime) {
$dt = $v;
} else {
// some string/numeric value passed; we normalize that so that we can
// validate it.
try {
if (is_numeric($v)) { // if it's a unix timestamp
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
// We have to explicitly specify and then change the time zone because of a
// DateTime bug: http://bugs.php.net/bug.php?id=43003
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
} else {
$dt = new DateTime($v);
}
} catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
if ($v !== null) {
$v = (string) $v;
}
if ( $this->cliplength !== null || $dt !== null ) {
// (nested ifs are a little easier to read in this case)
$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
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
)
{
$this->cliplength = ($dt ? $dt->format('H:i:s') : null);
$this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
}
} // if either are not null
if ($this->cliplength !== $v || $this->isNew()) {
$this->cliplength = $v;
$this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
}
return $this;
} // setDbCliplength()
/**
* Sets the value of [cuein] column to a normalized version of the date/time value specified.
* Set the value of [cuein] column.
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @param string $v new value
* @return CcPlaylistcontents The current object (for fluent API support)
*/
public function setDbCuein($v)
{
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
// -- which is unexpected, to say the least.
if ($v === null || $v === '') {
$dt = null;
} elseif ($v instanceof DateTime) {
$dt = $v;
} else {
// some string/numeric value passed; we normalize that so that we can
// validate it.
try {
if (is_numeric($v)) { // if it's a unix timestamp
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
// We have to explicitly specify and then change the time zone because of a
// DateTime bug: http://bugs.php.net/bug.php?id=43003
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
} else {
$dt = new DateTime($v);
}
} catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
if ($v !== null) {
$v = (string) $v;
}
if ( $this->cuein !== null || $dt !== null ) {
// (nested ifs are a little easier to read in this case)
$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
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
)
{
$this->cuein = ($dt ? $dt->format('H:i:s') : null);
$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
}
} // if either are not null
if ($this->cuein !== $v || $this->isNew()) {
$this->cuein = $v;
$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
}
return $this;
} // setDbCuein()
/**
* Sets the value of [cueout] column to a normalized version of the date/time value specified.
* Set the value of [cueout] column.
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @param string $v new value
* @return CcPlaylistcontents The current object (for fluent API support)
*/
public function setDbCueout($v)
{
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
// -- which is unexpected, to say the least.
if ($v === null || $v === '') {
$dt = null;
} elseif ($v instanceof DateTime) {
$dt = $v;
} else {
// some string/numeric value passed; we normalize that so that we can
// validate it.
try {
if (is_numeric($v)) { // if it's a unix timestamp
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
// We have to explicitly specify and then change the time zone because of a
// DateTime bug: http://bugs.php.net/bug.php?id=43003
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
} else {
$dt = new DateTime($v);
}
} catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
if ($v !== null) {
$v = (string) $v;
}
if ( $this->cueout !== null || $dt !== null ) {
// (nested ifs are a little easier to read in this case)
$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
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
)
{
$this->cueout = ($dt ? $dt->format('H:i:s') : null);
$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
}
} // if either are not null
if ($this->cueout !== $v || $this->isNew()) {
$this->cueout = $v;
$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
}
return $this;
} // setDbCueout()

View File

@ -282,29 +282,20 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
/**
* Filter the query on the cliplength column
*
* @param string|array $dbCliplength The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $dbCliplength The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
*/
public function filterByDbCliplength($dbCliplength = null, $comparison = null)
{
if (is_array($dbCliplength)) {
$useMinMax = false;
if (isset($dbCliplength['min'])) {
$this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbCliplength['max'])) {
$this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
if (null === $comparison) {
if (is_array($dbCliplength)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbCliplength)) {
$dbCliplength = str_replace('*', '%', $dbCliplength);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength, $comparison);
@ -313,29 +304,20 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
/**
* Filter the query on the cuein column
*
* @param string|array $dbCuein The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $dbCuein The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
*/
public function filterByDbCuein($dbCuein = null, $comparison = null)
{
if (is_array($dbCuein)) {
$useMinMax = false;
if (isset($dbCuein['min'])) {
$this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbCuein['max'])) {
$this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
if (null === $comparison) {
if (is_array($dbCuein)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbCuein)) {
$dbCuein = str_replace('*', '%', $dbCuein);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein, $comparison);
@ -344,29 +326,20 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
/**
* Filter the query on the cueout column
*
* @param string|array $dbCueout The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $dbCueout The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
*/
public function filterByDbCueout($dbCueout = null, $comparison = null)
{
if (is_array($dbCueout)) {
$useMinMax = false;
if (isset($dbCueout['min'])) {
$this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbCueout['max'])) {
$this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
if (null === $comparison) {
if (is_array($dbCueout)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbCueout)) {
$dbCueout = str_replace('*', '%', $dbCueout);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout, $comparison);

View File

@ -236,36 +236,13 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
}
/**
* Get the [optionally formatted] temporal [clip_length] column value.
* Get the [clip_length] 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.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
* @return string
*/
public function getDbClipLength($format = '%X')
public function getDbClipLength()
{
if ($this->clip_length === null) {
return null;
}
try {
$dt = new DateTime($this->clip_length);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->clip_length, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
return $this->clip_length;
}
/**
@ -335,69 +312,23 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
}
/**
* Get the [optionally formatted] temporal [cue_in] column value.
* Get the [cue_in] 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.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
* @return string
*/
public function getDbCueIn($format = '%X')
public function getDbCueIn()
{
if ($this->cue_in === null) {
return null;
}
try {
$dt = new DateTime($this->cue_in);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cue_in, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
return $this->cue_in;
}
/**
* Get the [optionally formatted] temporal [cue_out] column value.
* Get the [cue_out] 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.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
* @return string
*/
public function getDbCueOut($format = '%X')
public function getDbCueOut()
{
if ($this->cue_out === null) {
return null;
}
try {
$dt = new DateTime($this->cue_out);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cue_out, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
return $this->cue_out;
}
/**
@ -563,51 +494,21 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
} // setDbFileId()
/**
* Sets the value of [clip_length] column to a normalized version of the date/time value specified.
* Set the value of [clip_length] column.
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @param string $v new value
* @return CcSchedule The current object (for fluent API support)
*/
public function setDbClipLength($v)
{
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
// -- which is unexpected, to say the least.
if ($v === null || $v === '') {
$dt = null;
} elseif ($v instanceof DateTime) {
$dt = $v;
} else {
// some string/numeric value passed; we normalize that so that we can
// validate it.
try {
if (is_numeric($v)) { // if it's a unix timestamp
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
// We have to explicitly specify and then change the time zone because of a
// DateTime bug: http://bugs.php.net/bug.php?id=43003
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
} else {
$dt = new DateTime($v);
}
} catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
if ($v !== null) {
$v = (string) $v;
}
if ( $this->clip_length !== null || $dt !== null ) {
// (nested ifs are a little easier to read in this case)
$currNorm = ($this->clip_length !== null && $tmpDt = new DateTime($this->clip_length)) ? $tmpDt->format('H:i:s') : null;
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
)
{
$this->clip_length = ($dt ? $dt->format('H:i:s') : null);
$this->modifiedColumns[] = CcSchedulePeer::CLIP_LENGTH;
}
} // if either are not null
if ($this->clip_length !== $v || $this->isNew()) {
$this->clip_length = $v;
$this->modifiedColumns[] = CcSchedulePeer::CLIP_LENGTH;
}
return $this;
} // setDbClipLength()
@ -713,101 +614,41 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
} // setDbFadeOut()
/**
* Sets the value of [cue_in] column to a normalized version of the date/time value specified.
* Set the value of [cue_in] column.
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @param string $v new value
* @return CcSchedule The current object (for fluent API support)
*/
public function setDbCueIn($v)
{
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
// -- which is unexpected, to say the least.
if ($v === null || $v === '') {
$dt = null;
} elseif ($v instanceof DateTime) {
$dt = $v;
} else {
// some string/numeric value passed; we normalize that so that we can
// validate it.
try {
if (is_numeric($v)) { // if it's a unix timestamp
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
// We have to explicitly specify and then change the time zone because of a
// DateTime bug: http://bugs.php.net/bug.php?id=43003
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
} else {
$dt = new DateTime($v);
}
} catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
if ($v !== null) {
$v = (string) $v;
}
if ( $this->cue_in !== null || $dt !== null ) {
// (nested ifs are a little easier to read in this case)
$currNorm = ($this->cue_in !== null && $tmpDt = new DateTime($this->cue_in)) ? $tmpDt->format('H:i:s') : null;
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
)
{
$this->cue_in = ($dt ? $dt->format('H:i:s') : null);
$this->modifiedColumns[] = CcSchedulePeer::CUE_IN;
}
} // if either are not null
if ($this->cue_in !== $v || $this->isNew()) {
$this->cue_in = $v;
$this->modifiedColumns[] = CcSchedulePeer::CUE_IN;
}
return $this;
} // setDbCueIn()
/**
* Sets the value of [cue_out] column to a normalized version of the date/time value specified.
* Set the value of [cue_out] column.
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @param string $v new value
* @return CcSchedule The current object (for fluent API support)
*/
public function setDbCueOut($v)
{
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
// -- which is unexpected, to say the least.
if ($v === null || $v === '') {
$dt = null;
} elseif ($v instanceof DateTime) {
$dt = $v;
} else {
// some string/numeric value passed; we normalize that so that we can
// validate it.
try {
if (is_numeric($v)) { // if it's a unix timestamp
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
// We have to explicitly specify and then change the time zone because of a
// DateTime bug: http://bugs.php.net/bug.php?id=43003
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
} else {
$dt = new DateTime($v);
}
} catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
if ($v !== null) {
$v = (string) $v;
}
if ( $this->cue_out !== null || $dt !== null ) {
// (nested ifs are a little easier to read in this case)
$currNorm = ($this->cue_out !== null && $tmpDt = new DateTime($this->cue_out)) ? $tmpDt->format('H:i:s') : null;
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
)
{
$this->cue_out = ($dt ? $dt->format('H:i:s') : null);
$this->modifiedColumns[] = CcSchedulePeer::CUE_OUT;
}
} // if either are not null
if ($this->cue_out !== $v || $this->isNew()) {
$this->cue_out = $v;
$this->modifiedColumns[] = CcSchedulePeer::CUE_OUT;
}
return $this;
} // setDbCueOut()

View File

@ -290,29 +290,20 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
/**
* Filter the query on the clip_length column
*
* @param string|array $dbClipLength The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $dbClipLength The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcScheduleQuery The current query, for fluid interface
*/
public function filterByDbClipLength($dbClipLength = null, $comparison = null)
{
if (is_array($dbClipLength)) {
$useMinMax = false;
if (isset($dbClipLength['min'])) {
$this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $dbClipLength['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbClipLength['max'])) {
$this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $dbClipLength['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
if (null === $comparison) {
if (is_array($dbClipLength)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbClipLength)) {
$dbClipLength = str_replace('*', '%', $dbClipLength);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $dbClipLength, $comparison);
@ -383,29 +374,20 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
/**
* Filter the query on the cue_in column
*
* @param string|array $dbCueIn The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $dbCueIn The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcScheduleQuery The current query, for fluid interface
*/
public function filterByDbCueIn($dbCueIn = null, $comparison = null)
{
if (is_array($dbCueIn)) {
$useMinMax = false;
if (isset($dbCueIn['min'])) {
$this->addUsingAlias(CcSchedulePeer::CUE_IN, $dbCueIn['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbCueIn['max'])) {
$this->addUsingAlias(CcSchedulePeer::CUE_IN, $dbCueIn['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
if (null === $comparison) {
if (is_array($dbCueIn)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbCueIn)) {
$dbCueIn = str_replace('*', '%', $dbCueIn);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcSchedulePeer::CUE_IN, $dbCueIn, $comparison);
@ -414,29 +396,20 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
/**
* Filter the query on the cue_out column
*
* @param string|array $dbCueOut The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $dbCueOut The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcScheduleQuery The current query, for fluid interface
*/
public function filterByDbCueOut($dbCueOut = null, $comparison = null)
{
if (is_array($dbCueOut)) {
$useMinMax = false;
if (isset($dbCueOut['min'])) {
$this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbCueOut['max'])) {
$this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
if (null === $comparison) {
if (is_array($dbCueOut)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbCueOut)) {
$dbCueOut = str_replace('*', '%', $dbCueOut);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut, $comparison);

View File

@ -237,9 +237,9 @@
<column name="playlist_id" phpName="DbPlaylistId" type="INTEGER" required="false"/>
<column name="file_id" phpName="DbFileId" type="INTEGER" required="false"/>
<column name="position" phpName="DbPosition" type="INTEGER" required="false"/>
<column name="cliplength" phpName="DbCliplength" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="cuein" phpName="DbCuein" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="cueout" phpName="DbCueout" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="cliplength" phpName="DbCliplength" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00"/>
<column name="cuein" phpName="DbCuein" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00"/>
<column name="cueout" phpName="DbCueout" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00"/>
<column name="fadein" phpName="DbFadein" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="fadeout" phpName="DbFadeout" type="TIME" required="false" defaultValue="00:00:00"/>
<foreign-key foreignTable="cc_files" name="cc_playlistcontents_file_id_fkey" onDelete="CASCADE">
@ -273,11 +273,11 @@
<column name="starts" phpName="DbStarts" type="TIMESTAMP" required="true"/>
<column name="ends" phpName="DbEnds" type="TIMESTAMP" required="true"/>
<column name="file_id" phpName="DbFileId" type="INTEGER" required="false"/>
<column name="clip_length" phpName="DbClipLength" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="clip_length" phpName="DbClipLength" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00"/>
<column name="fade_in" phpName="DbFadeIn" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="fade_out" phpName="DbFadeOut" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="cue_in" phpName="DbCueIn" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="cue_out" phpName="DbCueOut" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="cue_in" phpName="DbCueIn" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00"/>
<column name="cue_out" phpName="DbCueOut" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00"/>
<column name="media_item_played" phpName="DbMediaItemPlayed" type="BOOLEAN" required="false" defaultValue="0"/>
<column name="instance_id" phpName="DbInstanceId" type="INTEGER" required="true"/>
<!-- This foreign key is still useful even though it may seem we don't ever delete cc_show_instances anymore.

View File

@ -315,9 +315,9 @@ CREATE TABLE "cc_playlistcontents"
"playlist_id" INTEGER,
"file_id" INTEGER,
"position" INTEGER,
"cliplength" TIME default '00:00:00',
"cuein" TIME default '00:00:00',
"cueout" TIME default '00:00:00',
"cliplength" interval default '00:00:00',
"cuein" interval default '00:00:00',
"cueout" interval default '00:00:00',
"fadein" TIME default '00:00:00',
"fadeout" TIME default '00:00:00',
PRIMARY KEY ("id")
@ -364,11 +364,11 @@ CREATE TABLE "cc_schedule"
"starts" TIMESTAMP NOT NULL,
"ends" TIMESTAMP NOT NULL,
"file_id" INTEGER,
"clip_length" TIME default '00:00:00',
"clip_length" interval default '00:00:00',
"fade_in" TIME default '00:00:00',
"fade_out" TIME default '00:00:00',
"cue_in" TIME default '00:00:00',
"cue_out" TIME default '00:00:00',
"cue_in" interval default '00:00:00',
"cue_out" interval default '00:00:00',
"media_item_played" BOOLEAN default 'f',
"instance_id" INTEGER NOT NULL,
PRIMARY KEY ("id")