From b7e5bfe4aaaa2ce8a0c15ed8a5fcbaa9bf4443fc Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Thu, 1 Mar 2012 11:48:57 +0100 Subject: [PATCH] CC-3174 : showbuilder changing cues/cliplengths to be interval column type. --- .../models/airtime/CcPlaylistcontents.php | 117 --------- .../application/models/airtime/CcSchedule.php | 110 --------- .../map/CcPlaylistcontentsTableMap.php | 6 +- .../models/airtime/map/CcScheduleTableMap.php | 6 +- .../airtime/om/BaseCcPlaylistcontents.php | 231 +++--------------- .../om/BaseCcPlaylistcontentsQuery.php | 69 ++---- .../models/airtime/om/BaseCcSchedule.php | 231 +++--------------- .../models/airtime/om/BaseCcScheduleQuery.php | 69 ++---- airtime_mvc/build/schema.xml | 12 +- airtime_mvc/build/sql/schema.sql | 12 +- 10 files changed, 132 insertions(+), 731 deletions(-) diff --git a/airtime_mvc/application/models/airtime/CcPlaylistcontents.php b/airtime_mvc/application/models/airtime/CcPlaylistcontents.php index e533d9ada..441207585 100644 --- a/airtime_mvc/application/models/airtime/CcPlaylistcontents.php +++ b/airtime_mvc/application/models/airtime/CcPlaylistcontents.php @@ -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 diff --git a/airtime_mvc/application/models/airtime/CcSchedule.php b/airtime_mvc/application/models/airtime/CcSchedule.php index ff222d7a3..0a15b7a3c 100644 --- a/airtime_mvc/application/models/airtime/CcSchedule.php +++ b/airtime_mvc/application/models/airtime/CcSchedule.php @@ -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. * diff --git a/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php index d654fb799..c8a01608a 100644 --- a/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php @@ -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 diff --git a/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php b/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php index ebbe397c8..827d971a7 100644 --- a/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php @@ -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 diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php index 457a9b958..8f823a25e 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php @@ -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() diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php index 85262c7bd..8769dfe60 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php @@ -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); diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php b/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php index 751babc2d..fa7e410dc 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php @@ -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() diff --git a/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php index 4c661ad56..3e7c56b25 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php @@ -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); diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index 85aca369f..507dcc6ae 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -237,9 +237,9 @@ - - - + + + @@ -273,11 +273,11 @@ - + - - + +