From 0f9800a6bd4b83e09eb81898baf775dac23ca42b Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Thu, 1 Mar 2012 14:59:06 +0100 Subject: [PATCH] CC-3369 : Ability to identify tracks that are actually inside a show in the schedule table --- airtime_mvc/application/models/Scheduler.php | 20 ++++++- airtime_mvc/application/models/Show.php | 55 +++++++++++++++++- .../models/airtime/CcShowInstances.php | 29 ++++++++++ .../models/airtime/map/CcScheduleTableMap.php | 1 + .../models/airtime/om/BaseCcSchedule.php | 56 ++++++++++++++++++- .../models/airtime/om/BaseCcSchedulePeer.php | 31 +++++----- .../models/airtime/om/BaseCcScheduleQuery.php | 35 ++++++++++++ airtime_mvc/build/schema.xml | 1 + airtime_mvc/build/sql/schema.sql | 1 + 9 files changed, 212 insertions(+), 17 deletions(-) diff --git a/airtime_mvc/application/models/Scheduler.php b/airtime_mvc/application/models/Scheduler.php index 3df43b5ce..1c77774c9 100644 --- a/airtime_mvc/application/models/Scheduler.php +++ b/airtime_mvc/application/models/Scheduler.php @@ -229,6 +229,15 @@ class Application_Model_Scheduler { } } + //update the status flag in cc_schedule. + $instances = CcShowInstancesQuery::create() + ->filterByPrimaryKeys($affectedShowInstances) + ->find($this->con); + + foreach ($instances as $instance) { + $instance->updateScheduleStatus($this->con); + } + //update the last scheduled timestamp. CcShowInstancesQuery::create() ->filterByPrimaryKeys($affectedShowInstances) @@ -383,11 +392,20 @@ class Application_Model_Scheduler { } } - foreach($showInstances as $instance) { + foreach ($showInstances as $instance) { $this->removeGaps($instance); } } + //update the status flag in cc_schedule. + $instances = CcShowInstancesQuery::create() + ->filterByPrimaryKeys($showInstances) + ->find($this->con); + + foreach ($instances as $instance) { + $instance->updateScheduleStatus($this->con); + } + //update the last scheduled timestamp. CcShowInstancesQuery::create() ->filterByPrimaryKeys($showInstances) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index d9d91cf52..6fa4fd132 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -125,10 +125,12 @@ class Application_Model_Show { } $hours = $deltaMin/60; - if($hours > 0) + if ($hours > 0) { $hours = floor($hours); - else + } + else { $hours = ceil($hours); + } $mins = abs($deltaMin%60); @@ -149,6 +151,28 @@ class Application_Model_Show { //do both the queries at once. $CC_DBC->query($sql); + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME); + $con->beginTransaction(); + + try { + //update the status flag in cc_schedule. + $instances = CcShowInstancesQuery::create() + ->filterByDbStarts($current_timestamp, Criteria::GREATER_EQUAL) + ->filterByDbShowId($this->_showId) + ->find($con); + + foreach ($instances as $instance) { + $instance->updateScheduleStatus(); + } + + $con->commit(); + } + catch (Exception $e) { + $con->rollback(); + Logging::log("Couldn't update schedule status."); + Logging::log($e->getMessage()); + } + Application_Model_RabbitMq::PushSchedule(); } @@ -1043,6 +1067,33 @@ class Application_Model_Show { } } + if ($data['add_show_id'] != -1) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME); + $con->beginTransaction(); + + //current timesamp in UTC. + $current_timestamp = gmdate("Y-m-d H:i:s"); + + try { + //update the status flag in cc_schedule. + $instances = CcShowInstancesQuery::create() + ->filterByDbStarts($current_timestamp, Criteria::GREATER_EQUAL) + ->filterByDbShowId($data['add_show_id']) + ->find($con); + + foreach ($instances as $instance) { + $instance->updateScheduleStatus(); + } + + $con->commit(); + } + catch (Exception $e) { + $con->rollback(); + Logging::log("Couldn't update schedule status."); + Logging::log($e->getMessage()); + } + } + Application_Model_Show::populateShowUntil($showId); Application_Model_RabbitMq::PushSchedule(); return $showId; diff --git a/airtime_mvc/application/models/airtime/CcShowInstances.php b/airtime_mvc/application/models/airtime/CcShowInstances.php index d1c97f437..ecd34e10e 100644 --- a/airtime_mvc/application/models/airtime/CcShowInstances.php +++ b/airtime_mvc/application/models/airtime/CcShowInstances.php @@ -107,4 +107,33 @@ class CcShowInstances extends BaseCcShowInstances { return $dt->format($format); } } + + //post save hook to update the cc_schedule status column for the tracks in the show. + public function updateScheduleStatus(PropelPDO $con) { + + Logging::log("in post save for showinstances"); + + //scheduled track is in the show + CcScheduleQuery::create() + ->filterByDbInstanceId($this->id) + ->filterByDbEnds($this->ends, Criteria::LESS_EQUAL) + ->update(array('DbStatus' => 1), $con); + + Logging::log("updating status for in show items."); + + //scheduled track is a boundary track + CcScheduleQuery::create() + ->filterByDbInstanceId($this->id) + ->filterByDbStarts($this->ends, Criteria::LESS_THAN) + ->filterByDbEnds($this->ends, Criteria::GREATER_THAN) + ->update(array('DbStatus' => 2), $con); + + //scheduled track is overbooked. + CcScheduleQuery::create() + ->filterByDbInstanceId($this->id) + ->filterByDbStarts($this->ends, Criteria::GREATER_THAN) + ->update(array('DbStatus' => 0), $con); + + } + } // CcShowInstances diff --git a/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php b/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php index 827d971a7..e2a988421 100644 --- a/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php @@ -49,6 +49,7 @@ class CcScheduleTableMap extends TableMap { $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); + $this->addColumn('STATUS', 'DbStatus', 'SMALLINT', true, null, 1); // validators } // initialize() diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php b/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php index fa7e410dc..977298da2 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php @@ -96,6 +96,13 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent */ protected $instance_id; + /** + * The value for the status field. + * Note: this column has a database default value of: 1 + * @var int + */ + protected $status; + /** * @var CcShowInstances */ @@ -137,6 +144,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $this->cue_in = '00:00:00'; $this->cue_out = '00:00:00'; $this->media_item_played = false; + $this->status = 1; } /** @@ -351,6 +359,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent return $this->instance_id; } + /** + * Get the [status] column value. + * + * @return int + */ + public function getDbStatus() + { + return $this->status; + } + /** * Set the value of [id] column. * @@ -697,6 +715,26 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent return $this; } // setDbInstanceId() + /** + * Set the value of [status] column. + * + * @param int $v new value + * @return CcSchedule The current object (for fluent API support) + */ + public function setDbStatus($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->status !== $v || $this->isNew()) { + $this->status = $v; + $this->modifiedColumns[] = CcSchedulePeer::STATUS; + } + + return $this; + } // setDbStatus() + /** * Indicates whether the columns in this object are only set to default values. * @@ -731,6 +769,10 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent return false; } + if ($this->status !== 1) { + return false; + } + // otherwise, everything was equal, so return TRUE return true; } // hasOnlyDefaultValues() @@ -764,6 +806,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $this->cue_out = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; $this->media_item_played = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null; $this->instance_id = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null; + $this->status = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null; $this->resetModified(); $this->setNew(false); @@ -772,7 +815,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $this->ensureConsistency(); } - return $startcol + 11; // 11 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 12; // 12 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating CcSchedule object", $e); @@ -1151,6 +1194,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent case 10: return $this->getDbInstanceId(); break; + case 11: + return $this->getDbStatus(); + break; default: return null; break; @@ -1186,6 +1232,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $keys[8] => $this->getDbCueOut(), $keys[9] => $this->getDbMediaItemPlayed(), $keys[10] => $this->getDbInstanceId(), + $keys[11] => $this->getDbStatus(), ); if ($includeForeignObjects) { if (null !== $this->aCcShowInstances) { @@ -1258,6 +1305,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent case 10: $this->setDbInstanceId($value); break; + case 11: + $this->setDbStatus($value); + break; } // switch() } @@ -1293,6 +1343,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent if (array_key_exists($keys[8], $arr)) $this->setDbCueOut($arr[$keys[8]]); if (array_key_exists($keys[9], $arr)) $this->setDbMediaItemPlayed($arr[$keys[9]]); if (array_key_exists($keys[10], $arr)) $this->setDbInstanceId($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setDbStatus($arr[$keys[11]]); } /** @@ -1315,6 +1366,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent if ($this->isColumnModified(CcSchedulePeer::CUE_OUT)) $criteria->add(CcSchedulePeer::CUE_OUT, $this->cue_out); if ($this->isColumnModified(CcSchedulePeer::MEDIA_ITEM_PLAYED)) $criteria->add(CcSchedulePeer::MEDIA_ITEM_PLAYED, $this->media_item_played); if ($this->isColumnModified(CcSchedulePeer::INSTANCE_ID)) $criteria->add(CcSchedulePeer::INSTANCE_ID, $this->instance_id); + if ($this->isColumnModified(CcSchedulePeer::STATUS)) $criteria->add(CcSchedulePeer::STATUS, $this->status); return $criteria; } @@ -1386,6 +1438,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $copyObj->setDbCueOut($this->cue_out); $copyObj->setDbMediaItemPlayed($this->media_item_played); $copyObj->setDbInstanceId($this->instance_id); + $copyObj->setDbStatus($this->status); $copyObj->setNew(true); $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value @@ -1547,6 +1600,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $this->cue_out = null; $this->media_item_played = null; $this->instance_id = null; + $this->status = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->clearAllReferences(); diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php b/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php index e11d284a7..2aa1199f7 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php @@ -26,7 +26,7 @@ abstract class BaseCcSchedulePeer { const TM_CLASS = 'CcScheduleTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 11; + const NUM_COLUMNS = 12; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -64,6 +64,9 @@ abstract class BaseCcSchedulePeer { /** the column name for the INSTANCE_ID field */ const INSTANCE_ID = 'cc_schedule.INSTANCE_ID'; + /** the column name for the STATUS field */ + const STATUS = 'cc_schedule.STATUS'; + /** * An identiy map to hold any loaded instances of CcSchedule objects. * This must be public so that other peer classes can access this when hydrating from JOIN @@ -80,12 +83,12 @@ abstract class BaseCcSchedulePeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', 'DbStatus', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', 'dbStatus', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, self::STATUS, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', 'STATUS', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', 'status', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) ); /** @@ -95,12 +98,12 @@ abstract class BaseCcSchedulePeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbClipLength' => 4, 'DbFadeIn' => 5, 'DbFadeOut' => 6, 'DbCueIn' => 7, 'DbCueOut' => 8, 'DbMediaItemPlayed' => 9, 'DbInstanceId' => 10, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbClipLength' => 4, 'dbFadeIn' => 5, 'dbFadeOut' => 6, 'dbCueIn' => 7, 'dbCueOut' => 8, 'dbMediaItemPlayed' => 9, 'dbInstanceId' => 10, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::CLIP_LENGTH => 4, self::FADE_IN => 5, self::FADE_OUT => 6, self::CUE_IN => 7, self::CUE_OUT => 8, self::MEDIA_ITEM_PLAYED => 9, self::INSTANCE_ID => 10, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'CLIP_LENGTH' => 4, 'FADE_IN' => 5, 'FADE_OUT' => 6, 'CUE_IN' => 7, 'CUE_OUT' => 8, 'MEDIA_ITEM_PLAYED' => 9, 'INSTANCE_ID' => 10, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'clip_length' => 4, 'fade_in' => 5, 'fade_out' => 6, 'cue_in' => 7, 'cue_out' => 8, 'media_item_played' => 9, 'instance_id' => 10, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbClipLength' => 4, 'DbFadeIn' => 5, 'DbFadeOut' => 6, 'DbCueIn' => 7, 'DbCueOut' => 8, 'DbMediaItemPlayed' => 9, 'DbInstanceId' => 10, 'DbStatus' => 11, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbClipLength' => 4, 'dbFadeIn' => 5, 'dbFadeOut' => 6, 'dbCueIn' => 7, 'dbCueOut' => 8, 'dbMediaItemPlayed' => 9, 'dbInstanceId' => 10, 'dbStatus' => 11, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::CLIP_LENGTH => 4, self::FADE_IN => 5, self::FADE_OUT => 6, self::CUE_IN => 7, self::CUE_OUT => 8, self::MEDIA_ITEM_PLAYED => 9, self::INSTANCE_ID => 10, self::STATUS => 11, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'CLIP_LENGTH' => 4, 'FADE_IN' => 5, 'FADE_OUT' => 6, 'CUE_IN' => 7, 'CUE_OUT' => 8, 'MEDIA_ITEM_PLAYED' => 9, 'INSTANCE_ID' => 10, 'STATUS' => 11, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'clip_length' => 4, 'fade_in' => 5, 'fade_out' => 6, 'cue_in' => 7, 'cue_out' => 8, 'media_item_played' => 9, 'instance_id' => 10, 'status' => 11, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) ); /** @@ -183,6 +186,7 @@ abstract class BaseCcSchedulePeer { $criteria->addSelectColumn(CcSchedulePeer::CUE_OUT); $criteria->addSelectColumn(CcSchedulePeer::MEDIA_ITEM_PLAYED); $criteria->addSelectColumn(CcSchedulePeer::INSTANCE_ID); + $criteria->addSelectColumn(CcSchedulePeer::STATUS); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.STARTS'); @@ -195,6 +199,7 @@ abstract class BaseCcSchedulePeer { $criteria->addSelectColumn($alias . '.CUE_OUT'); $criteria->addSelectColumn($alias . '.MEDIA_ITEM_PLAYED'); $criteria->addSelectColumn($alias . '.INSTANCE_ID'); + $criteria->addSelectColumn($alias . '.STATUS'); } } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php index 3e7c56b25..dc26a7311 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php @@ -17,6 +17,7 @@ * @method CcScheduleQuery orderByDbCueOut($order = Criteria::ASC) Order by the cue_out column * @method CcScheduleQuery orderByDbMediaItemPlayed($order = Criteria::ASC) Order by the media_item_played column * @method CcScheduleQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column + * @method CcScheduleQuery orderByDbStatus($order = Criteria::ASC) Order by the status column * * @method CcScheduleQuery groupByDbId() Group by the id column * @method CcScheduleQuery groupByDbStarts() Group by the starts column @@ -29,6 +30,7 @@ * @method CcScheduleQuery groupByDbCueOut() Group by the cue_out column * @method CcScheduleQuery groupByDbMediaItemPlayed() Group by the media_item_played column * @method CcScheduleQuery groupByDbInstanceId() Group by the instance_id column + * @method CcScheduleQuery groupByDbStatus() Group by the status column * * @method CcScheduleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method CcScheduleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -56,6 +58,7 @@ * @method CcSchedule findOneByDbCueOut(string $cue_out) Return the first CcSchedule filtered by the cue_out column * @method CcSchedule findOneByDbMediaItemPlayed(boolean $media_item_played) Return the first CcSchedule filtered by the media_item_played column * @method CcSchedule findOneByDbInstanceId(int $instance_id) Return the first CcSchedule filtered by the instance_id column + * @method CcSchedule findOneByDbStatus(int $status) Return the first CcSchedule filtered by the status column * * @method array findByDbId(int $id) Return CcSchedule objects filtered by the id column * @method array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column @@ -68,6 +71,7 @@ * @method array findByDbCueOut(string $cue_out) Return CcSchedule objects filtered by the cue_out column * @method array findByDbMediaItemPlayed(boolean $media_item_played) Return CcSchedule objects filtered by the media_item_played column * @method array findByDbInstanceId(int $instance_id) Return CcSchedule objects filtered by the instance_id column + * @method array findByDbStatus(int $status) Return CcSchedule objects filtered by the status column * * @package propel.generator.airtime.om */ @@ -463,6 +467,37 @@ abstract class BaseCcScheduleQuery extends ModelCriteria return $this->addUsingAlias(CcSchedulePeer::INSTANCE_ID, $dbInstanceId, $comparison); } + /** + * Filter the query on the status column + * + * @param int|array $dbStatus The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbStatus($dbStatus = null, $comparison = null) + { + if (is_array($dbStatus)) { + $useMinMax = false; + if (isset($dbStatus['min'])) { + $this->addUsingAlias(CcSchedulePeer::STATUS, $dbStatus['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbStatus['max'])) { + $this->addUsingAlias(CcSchedulePeer::STATUS, $dbStatus['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSchedulePeer::STATUS, $dbStatus, $comparison); + } + /** * Filter the query by a related CcShowInstances object * diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index 507dcc6ae..3060cbd19 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -280,6 +280,7 @@ +