diff --git a/airtime_mvc/application/configs/classmap-airtime-conf.php b/airtime_mvc/application/configs/classmap-airtime-conf.php index ef0357425..9eacbf563 100644 --- a/airtime_mvc/application/configs/classmap-airtime-conf.php +++ b/airtime_mvc/application/configs/classmap-airtime-conf.php @@ -204,4 +204,11 @@ return array ( 'BaseCcLocalePeer' => 'airtime/om/BaseCcLocalePeer.php', 'BaseCcLocale' => 'airtime/om/BaseCcLocale.php', 'BaseCcLocaleQuery' => 'airtime/om/BaseCcLocaleQuery.php', + 'CcShowStampTableMap' => 'airtime/map/CcShowStampTableMap.php', + 'CcShowStampPeer' => 'airtime/CcShowStampPeer.php', + 'CcShowStamp' => 'airtime/CcShowStamp.php', + 'CcShowStampQuery' => 'airtime/CcShowStampQuery.php', + 'BaseCcShowStampPeer' => 'airtime/om/BaseCcShowStampPeer.php', + 'BaseCcShowStamp' => 'airtime/om/BaseCcShowStamp.php', + 'BaseCcShowStampQuery' => 'airtime/om/BaseCcShowStampQuery.php', ); \ No newline at end of file diff --git a/airtime_mvc/application/forms/AddShowRepeats.php b/airtime_mvc/application/forms/AddShowRepeats.php index 3319a7a4d..d09b5284a 100644 --- a/airtime_mvc/application/forms/AddShowRepeats.php +++ b/airtime_mvc/application/forms/AddShowRepeats.php @@ -5,6 +5,11 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm public function init() { + + $linked = new Zend_Form_Element_Checkbox("add_show_linked"); + $linked->setLabel(_("Link:")); + $this->addElement($linked); + //Add type select $this->addElement('select', 'add_show_repeat_type', array( 'required' => true, diff --git a/airtime_mvc/application/models/Scheduler.php b/airtime_mvc/application/models/Scheduler.php index ee8263c2c..5068149ad 100644 --- a/airtime_mvc/application/models/Scheduler.php +++ b/airtime_mvc/application/models/Scheduler.php @@ -59,9 +59,12 @@ class Application_Model_Scheduler //could be added to the beginning of a show, which sends id = 0; if ($id > 0) { + //schedule_id of where we are inserting after? $schedInfo[$id] = $items[$i]["instance"]; } + //what is timestamp for? + //format is instance_id => timestamp $instanceInfo[$items[$i]["instance"]] = $items[$i]["timestamp"]; } @@ -380,19 +383,24 @@ class Application_Model_Scheduler $schedule->save($this->con); } - /* - * @param array $scheduledIds - * @param array $fileIds - * @param array $playlistIds + /** + * + * Enter description here ... + * @param $scheduleItems + * cc_schedule items, where the items get inserted after + * @param $filesToInsert + * array of schedule item info, what gets inserted into cc_schedule + * @param $adjustSched */ - private function insertAfter($scheduleItems, $schedFiles, $adjustSched = true, $mediaItems = null) + private function insertAfter($scheduleItems, $filesToInsert, $adjustSched = true) { try { $affectedShowInstances = array(); - - //dont want to recalculate times for moved items. + + //dont want to recalculate times for moved items + //only moved items have a sched_id $excludeIds = array(); - foreach ($schedFiles as $file) { + foreach ($filesToInsert as $file) { if (isset($file["sched_id"])) { $excludeIds[] = intval($file["sched_id"]); } @@ -402,17 +410,7 @@ class Application_Model_Scheduler foreach ($scheduleItems as $schedule) { $id = intval($schedule["id"]); - - // if mediaItmes is passed in, we want to create contents - // at the time of insert. This is for dyanmic blocks or - // playlist that contains dynamic blocks - if ($mediaItems != null) { - $schedFiles = array(); - foreach ($mediaItems as $media) { - $schedFiles = array_merge($schedFiles, $this->retrieveMediaFiles($media["id"], $media["type"])); - } - } - + if ($id !== 0) { $schedItem = CcScheduleQuery::create()->findPK($id, $this->con); $instance = $schedItem->getCcShowInstances($this->con); @@ -433,6 +431,10 @@ class Application_Model_Scheduler $affectedShowInstances[] = $instance->getDbId(); } + /* + * $adjustSched is true if there are schedule items + * following the item just inserted, per show instance + */ if ($adjustSched === true) { $pstart = microtime(true); @@ -449,7 +451,7 @@ class Application_Model_Scheduler Logging::debug(floatval($pend) - floatval($pstart)); } - foreach ($schedFiles as $file) { + foreach ($filesToInsert as $file) { $endTimeDT = $this->findEndTime($nextStartDT, $file['cliplength']); //item existed previously and is being moved. @@ -487,7 +489,7 @@ class Application_Model_Scheduler $sched->save($this->con); $nextStartDT = $endTimeDT; - } + }//all files have been inserted/moved if ($adjustSched === true) { @@ -526,7 +528,7 @@ class Application_Model_Scheduler } // update is_scheduled flag for each cc_file - foreach ($schedFiles as $file) { + foreach ($filesToInsert as $file) { $db_file = CcFilesQuery::create()->findPk($file['id'], $this->con); $db_file->setDbIsScheduled(true); $db_file->save($this->con); @@ -553,45 +555,46 @@ class Application_Model_Scheduler } /* - * @param array $scheduleItems - * @param array $mediaItems + * @param array $scheduleItems (schedule_id and instance_id it belongs to) + * @param array $mediaItems (file|block|playlist|webstream) */ public function scheduleAfter($scheduleItems, $mediaItems, $adjustSched = true) { $this->con->beginTransaction(); - $schedFiles = array(); + $filesToInsert = array(); try { - $this->validateRequest($scheduleItems); - $requireDynamicContentCreation = false; - + /* + * create array of arrays + * array of schedule item info + * (sched_id is the cc_schedule id and is set if an item is being + * moved because it is already in cc_schedule) + * [0] = Array( + * id => 1, + * cliplength => 00:04:32, + * cuein => 00:00:00, + * cueout => 00:04:32, + * fadein => 00.5, + * fadeout => 00.5, + * sched_id => , + * type => 0) + * [1] = Array( + * id => 2, + * cliplength => 00:05:07, + * cuein => 00:00:00, + * cueout => 00:05:07, + * fadein => 00.5, + * fadeout => 00.5, + * sched_id => , + * type => 0) + */ foreach ($mediaItems as $media) { - if ($media['type'] == "playlist") { - $pl = new Application_Model_Playlist($media['id']); - if ($pl->hasDynamicBlock()) { - $requireDynamicContentCreation = true; - break; - } - } else if ($media['type'] == "block") { - $bl = new Application_Model_Block($media['id']); - if (!$bl->isStatic()) { - $requireDynamicContentCreation = true; - break; - } - } - } - - if ($requireDynamicContentCreation) { - $this->insertAfter($scheduleItems, $schedFiles, $adjustSched, $mediaItems); - } else { - foreach ($mediaItems as $media) { - $schedFiles = array_merge($schedFiles, $this->retrieveMediaFiles($media["id"], $media["type"])); - } - $this->insertAfter($scheduleItems, $schedFiles, $adjustSched); + $filesToInsert = array_merge($filesToInsert, $this->retrieveMediaFiles($media["id"], $media["type"])); } + $this->insertAfter($scheduleItems, $filesToInsert, $adjustSched); $this->con->commit(); diff --git a/airtime_mvc/application/models/airtime/map/CcBlockTableMap.php b/airtime_mvc/application/models/airtime/map/CcBlockTableMap.php index 0ce86613c..b5d31f72e 100644 --- a/airtime_mvc/application/models/airtime/map/CcBlockTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcBlockTableMap.php @@ -58,6 +58,7 @@ class CcBlockTableMap extends TableMap { $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null); $this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null); $this->addRelation('CcBlockcriteria', 'CcBlockcriteria', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null); + $this->addRelation('CcShowStamp', 'CcShowStamp', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null); } // buildRelations() /** diff --git a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php index 56e7a5fff..7f0a33679 100644 --- a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php @@ -123,6 +123,7 @@ class CcFilesTableMap extends TableMap { $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null); $this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null); $this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null); + $this->addRelation('CcShowStamp', 'CcShowStamp', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null); } // buildRelations() } // CcFilesTableMap diff --git a/airtime_mvc/application/models/airtime/map/CcPlaylistTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlaylistTableMap.php index 8dba50bbd..3ba124cb6 100644 --- a/airtime_mvc/application/models/airtime/map/CcPlaylistTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcPlaylistTableMap.php @@ -55,6 +55,7 @@ class CcPlaylistTableMap extends TableMap { { $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), 'CASCADE', null); $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'playlist_id', ), 'CASCADE', null); + $this->addRelation('CcShowStamp', 'CcShowStamp', RelationMap::ONE_TO_MANY, array('id' => 'playlist_id', ), 'CASCADE', null); } // buildRelations() /** diff --git a/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php b/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php index 8c1d00dd2..d43299eff 100644 --- a/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php @@ -52,6 +52,7 @@ class CcScheduleTableMap extends TableMap { $this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null); $this->addColumn('PLAYOUT_STATUS', 'DbPlayoutStatus', 'SMALLINT', true, null, 1); $this->addColumn('BROADCASTED', 'DbBroadcasted', 'SMALLINT', true, null, 0); + $this->addColumn('STAMP_ID', 'DbStampId', 'INTEGER', true, null, 0); // validators } // initialize() diff --git a/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php b/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php index e6a7b87a0..f556b1853 100644 --- a/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php @@ -63,6 +63,7 @@ class CcShowInstancesTableMap extends TableMap { $this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null); $this->addRelation('CcShowInstancesRelatedByDbId', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null); $this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null); + $this->addRelation('CcShowStamp', 'CcShowStamp', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null); } // buildRelations() } // CcShowInstancesTableMap diff --git a/airtime_mvc/application/models/airtime/map/CcShowTableMap.php b/airtime_mvc/application/models/airtime/map/CcShowTableMap.php index 713de40a9..6acde02cd 100644 --- a/airtime_mvc/application/models/airtime/map/CcShowTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcShowTableMap.php @@ -49,6 +49,7 @@ class CcShowTableMap extends TableMap { $this->addColumn('LIVE_STREAM_USING_CUSTOM_AUTH', 'DbLiveStreamUsingCustomAuth', 'BOOLEAN', false, null, false); $this->addColumn('LIVE_STREAM_USER', 'DbLiveStreamUser', 'VARCHAR', false, 255, null); $this->addColumn('LIVE_STREAM_PASS', 'DbLiveStreamPass', 'VARCHAR', false, 255, null); + $this->addColumn('LINKED', 'DbLinked', 'BOOLEAN', true, null, false); // validators } // initialize() @@ -61,6 +62,7 @@ class CcShowTableMap extends TableMap { $this->addRelation('CcShowDays', 'CcShowDays', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null); $this->addRelation('CcShowRebroadcast', 'CcShowRebroadcast', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null); $this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null); + $this->addRelation('CcShowStamp', 'CcShowStamp', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null); } // buildRelations() } // CcShowTableMap diff --git a/airtime_mvc/application/models/airtime/map/CcWebstreamTableMap.php b/airtime_mvc/application/models/airtime/map/CcWebstreamTableMap.php index c4b28a516..979c7034e 100644 --- a/airtime_mvc/application/models/airtime/map/CcWebstreamTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcWebstreamTableMap.php @@ -57,6 +57,7 @@ class CcWebstreamTableMap extends TableMap { public function buildRelations() { $this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'stream_id', ), 'CASCADE', null); + $this->addRelation('CcShowStamp', 'CcShowStamp', RelationMap::ONE_TO_MANY, array('id' => 'stream_id', ), 'CASCADE', null); } // buildRelations() } // CcWebstreamTableMap diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlock.php b/airtime_mvc/application/models/airtime/om/BaseCcBlock.php index f9c900c81..4314af05f 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcBlock.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcBlock.php @@ -95,6 +95,11 @@ abstract class BaseCcBlock extends BaseObject implements Persistent */ protected $collCcBlockcriterias; + /** + * @var array CcShowStamp[] Collection to store aggregation of CcShowStamp objects. + */ + protected $collCcShowStamps; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -612,6 +617,8 @@ abstract class BaseCcBlock extends BaseObject implements Persistent $this->collCcBlockcriterias = null; + $this->collCcShowStamps = null; + } // if (deep) } @@ -781,6 +788,14 @@ abstract class BaseCcBlock extends BaseObject implements Persistent } } + if ($this->collCcShowStamps !== null) { + foreach ($this->collCcShowStamps as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + $this->alreadyInSave = false; } @@ -888,6 +903,14 @@ abstract class BaseCcBlock extends BaseObject implements Persistent } } + if ($this->collCcShowStamps !== null) { + foreach ($this->collCcShowStamps as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + $this->alreadyInValidation = false; } @@ -1180,6 +1203,12 @@ abstract class BaseCcBlock extends BaseObject implements Persistent } } + foreach ($this->getCcShowStamps() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcShowStamp($relObj->copy($deepCopy)); + } + } + } // if ($deepCopy) @@ -1676,6 +1705,240 @@ abstract class BaseCcBlock extends BaseObject implements Persistent } } + /** + * Clears out the collCcShowStamps collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addCcShowStamps() + */ + public function clearCcShowStamps() + { + $this->collCcShowStamps = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcShowStamps collection. + * + * By default this just sets the collCcShowStamps collection to an empty array (like clearcollCcShowStamps()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initCcShowStamps() + { + $this->collCcShowStamps = new PropelObjectCollection(); + $this->collCcShowStamps->setModel('CcShowStamp'); + } + + /** + * Gets an array of CcShowStamp objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this CcBlock is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + * @throws PropelException + */ + public function getCcShowStamps($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcShowStamps || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowStamps) { + // return empty collection + $this->initCcShowStamps(); + } else { + $collCcShowStamps = CcShowStampQuery::create(null, $criteria) + ->filterByCcBlock($this) + ->find($con); + if (null !== $criteria) { + return $collCcShowStamps; + } + $this->collCcShowStamps = $collCcShowStamps; + } + } + return $this->collCcShowStamps; + } + + /** + * Returns the number of related CcShowStamp objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcShowStamp objects. + * @throws PropelException + */ + public function countCcShowStamps(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcShowStamps || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowStamps) { + return 0; + } else { + $query = CcShowStampQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcBlock($this) + ->count($con); + } + } else { + return count($this->collCcShowStamps); + } + } + + /** + * Method called to associate a CcShowStamp object to this object + * through the CcShowStamp foreign key attribute. + * + * @param CcShowStamp $l CcShowStamp + * @return void + * @throws PropelException + */ + public function addCcShowStamp(CcShowStamp $l) + { + if ($this->collCcShowStamps === null) { + $this->initCcShowStamps(); + } + if (!$this->collCcShowStamps->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcShowStamps[]= $l; + $l->setCcBlock($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcBlock is new, it will return + * an empty collection; or if this CcBlock has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcBlock. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcShow($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcShow', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcBlock is new, it will return + * an empty collection; or if this CcBlock has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcBlock. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcShowInstances($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcShowInstances', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcBlock is new, it will return + * an empty collection; or if this CcBlock has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcBlock. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcFiles', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcBlock is new, it will return + * an empty collection; or if this CcBlock has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcBlock. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcWebstream($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcWebstream', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcBlock is new, it will return + * an empty collection; or if this CcBlock has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcBlock. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcPlaylist($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcPlaylist', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + /** * Clears the current object and sets all attributes to their default values */ @@ -1725,11 +1988,17 @@ abstract class BaseCcBlock extends BaseObject implements Persistent $o->clearAllReferences($deep); } } + if ($this->collCcShowStamps) { + foreach ((array) $this->collCcShowStamps as $o) { + $o->clearAllReferences($deep); + } + } } // if ($deep) $this->collCcPlaylistcontentss = null; $this->collCcBlockcontentss = null; $this->collCcBlockcriterias = null; + $this->collCcShowStamps = null; $this->aCcSubjs = null; } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockPeer.php index 48003ffc5..a5063dd8b 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcBlockPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockPeer.php @@ -382,6 +382,9 @@ abstract class BaseCcBlockPeer { // Invalidate objects in CcBlockcriteriaPeer instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. CcBlockcriteriaPeer::clearInstancePool(); + // Invalidate objects in CcShowStampPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcShowStampPeer::clearInstancePool(); } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockQuery.php index 100efd61e..ac160a1d2 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcBlockQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockQuery.php @@ -44,6 +44,10 @@ * @method CcBlockQuery rightJoinCcBlockcriteria($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlockcriteria relation * @method CcBlockQuery innerJoinCcBlockcriteria($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlockcriteria relation * + * @method CcBlockQuery leftJoinCcShowStamp($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowStamp relation + * @method CcBlockQuery rightJoinCcShowStamp($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowStamp relation + * @method CcBlockQuery innerJoinCcShowStamp($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowStamp relation + * * @method CcBlock findOne(PropelPDO $con = null) Return the first CcBlock matching the query * @method CcBlock findOneOrCreate(PropelPDO $con = null) Return the first CcBlock matching the query, or a new CcBlock object populated from the query conditions when no match is found * @@ -627,6 +631,70 @@ abstract class BaseCcBlockQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'CcBlockcriteria', 'CcBlockcriteriaQuery'); } + /** + * Filter the query by a related CcShowStamp object + * + * @param CcShowStamp $ccShowStamp the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcBlockQuery The current query, for fluid interface + */ + public function filterByCcShowStamp($ccShowStamp, $comparison = null) + { + return $this + ->addUsingAlias(CcBlockPeer::ID, $ccShowStamp->getDbBlockId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShowStamp relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcBlockQuery The current query, for fluid interface + */ + public function joinCcShowStamp($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowStamp'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CcShowStamp'); + } + + return $this; + } + + /** + * Use the CcShowStamp relation CcShowStamp object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowStampQuery A secondary query class using the current class as primary query + */ + public function useCcShowStampQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcShowStamp($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowStamp', 'CcShowStampQuery'); + } + /** * Exclude object from result * diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php index 55f868769..6d995eaac 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php @@ -493,6 +493,11 @@ abstract class BaseCcFiles extends BaseObject implements Persistent */ protected $collCcSchedules; + /** + * @var array CcShowStamp[] Collection to store aggregation of CcShowStamp objects. + */ + protected $collCcShowStamps; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -3109,6 +3114,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->collCcSchedules = null; + $this->collCcShowStamps = null; + } // if (deep) } @@ -3300,6 +3307,14 @@ abstract class BaseCcFiles extends BaseObject implements Persistent } } + if ($this->collCcShowStamps !== null) { + foreach ($this->collCcShowStamps as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + $this->alreadyInSave = false; } @@ -3427,6 +3442,14 @@ abstract class BaseCcFiles extends BaseObject implements Persistent } } + if ($this->collCcShowStamps !== null) { + foreach ($this->collCcShowStamps as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + $this->alreadyInValidation = false; } @@ -4351,6 +4374,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent } } + foreach ($this->getCcShowStamps() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcShowStamp($relObj->copy($deepCopy)); + } + } + } // if ($deepCopy) @@ -5154,6 +5183,240 @@ abstract class BaseCcFiles extends BaseObject implements Persistent return $this->getCcSchedules($query, $con); } + /** + * Clears out the collCcShowStamps collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addCcShowStamps() + */ + public function clearCcShowStamps() + { + $this->collCcShowStamps = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcShowStamps collection. + * + * By default this just sets the collCcShowStamps collection to an empty array (like clearcollCcShowStamps()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initCcShowStamps() + { + $this->collCcShowStamps = new PropelObjectCollection(); + $this->collCcShowStamps->setModel('CcShowStamp'); + } + + /** + * Gets an array of CcShowStamp objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this CcFiles is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + * @throws PropelException + */ + public function getCcShowStamps($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcShowStamps || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowStamps) { + // return empty collection + $this->initCcShowStamps(); + } else { + $collCcShowStamps = CcShowStampQuery::create(null, $criteria) + ->filterByCcFiles($this) + ->find($con); + if (null !== $criteria) { + return $collCcShowStamps; + } + $this->collCcShowStamps = $collCcShowStamps; + } + } + return $this->collCcShowStamps; + } + + /** + * Returns the number of related CcShowStamp objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcShowStamp objects. + * @throws PropelException + */ + public function countCcShowStamps(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcShowStamps || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowStamps) { + return 0; + } else { + $query = CcShowStampQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcFiles($this) + ->count($con); + } + } else { + return count($this->collCcShowStamps); + } + } + + /** + * Method called to associate a CcShowStamp object to this object + * through the CcShowStamp foreign key attribute. + * + * @param CcShowStamp $l CcShowStamp + * @return void + * @throws PropelException + */ + public function addCcShowStamp(CcShowStamp $l) + { + if ($this->collCcShowStamps === null) { + $this->initCcShowStamps(); + } + if (!$this->collCcShowStamps->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcShowStamps[]= $l; + $l->setCcFiles($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcFiles is new, it will return + * an empty collection; or if this CcFiles has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcFiles. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcShow($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcShow', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcFiles is new, it will return + * an empty collection; or if this CcFiles has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcFiles. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcShowInstances($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcShowInstances', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcFiles is new, it will return + * an empty collection; or if this CcFiles has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcFiles. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcWebstream($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcWebstream', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcFiles is new, it will return + * an empty collection; or if this CcFiles has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcFiles. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcBlock($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcBlock', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcFiles is new, it will return + * an empty collection; or if this CcFiles has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcFiles. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcPlaylist($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcPlaylist', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + /** * Clears the current object and sets all attributes to their default values */ @@ -5270,12 +5533,18 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $o->clearAllReferences($deep); } } + if ($this->collCcShowStamps) { + foreach ((array) $this->collCcShowStamps as $o) { + $o->clearAllReferences($deep); + } + } } // if ($deep) $this->collCcShowInstancess = null; $this->collCcPlaylistcontentss = null; $this->collCcBlockcontentss = null; $this->collCcSchedules = null; + $this->collCcShowStamps = null; $this->aFkOwner = null; $this->aCcSubjsRelatedByDbEditedby = null; $this->aCcMusicDirs = null; diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php index 82ebc7851..331dc1bfd 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php @@ -695,6 +695,9 @@ abstract class BaseCcFilesPeer { // Invalidate objects in CcSchedulePeer instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. CcSchedulePeer::clearInstancePool(); + // Invalidate objects in CcShowStampPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcShowStampPeer::clearInstancePool(); } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php index fe42ad88c..ae5c46c28 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php @@ -180,6 +180,10 @@ * @method CcFilesQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSchedule relation * @method CcFilesQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation * + * @method CcFilesQuery leftJoinCcShowStamp($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowStamp relation + * @method CcFilesQuery rightJoinCcShowStamp($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowStamp relation + * @method CcFilesQuery innerJoinCcShowStamp($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowStamp relation + * * @method CcFiles findOne(PropelPDO $con = null) Return the first CcFiles matching the query * @method CcFiles findOneOrCreate(PropelPDO $con = null) Return the first CcFiles matching the query, or a new CcFiles object populated from the query conditions when no match is found * @@ -2535,6 +2539,70 @@ abstract class BaseCcFilesQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery'); } + /** + * Filter the query by a related CcShowStamp object + * + * @param CcShowStamp $ccShowStamp the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByCcShowStamp($ccShowStamp, $comparison = null) + { + return $this + ->addUsingAlias(CcFilesPeer::ID, $ccShowStamp->getDbFileId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShowStamp relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function joinCcShowStamp($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowStamp'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CcShowStamp'); + } + + return $this; + } + + /** + * Use the CcShowStamp relation CcShowStamp object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowStampQuery A secondary query class using the current class as primary query + */ + public function useCcShowStampQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcShowStamp($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowStamp', 'CcShowStampQuery'); + } + /** * Exclude object from result * diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylist.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylist.php index 73b081708..fb822e999 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylist.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylist.php @@ -78,6 +78,11 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent */ protected $collCcPlaylistcontentss; + /** + * @var array CcShowStamp[] Collection to store aggregation of CcShowStamp objects. + */ + protected $collCcShowStamps; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -555,6 +560,8 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent $this->aCcSubjs = null; $this->collCcPlaylistcontentss = null; + $this->collCcShowStamps = null; + } // if (deep) } @@ -708,6 +715,14 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent } } + if ($this->collCcShowStamps !== null) { + foreach ($this->collCcShowStamps as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + $this->alreadyInSave = false; } @@ -799,6 +814,14 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent } } + if ($this->collCcShowStamps !== null) { + foreach ($this->collCcShowStamps as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + $this->alreadyInValidation = false; } @@ -1069,6 +1092,12 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent } } + foreach ($this->getCcShowStamps() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcShowStamp($relObj->copy($deepCopy)); + } + } + } // if ($deepCopy) @@ -1322,6 +1351,240 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent return $this->getCcPlaylistcontentss($query, $con); } + /** + * Clears out the collCcShowStamps collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addCcShowStamps() + */ + public function clearCcShowStamps() + { + $this->collCcShowStamps = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcShowStamps collection. + * + * By default this just sets the collCcShowStamps collection to an empty array (like clearcollCcShowStamps()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initCcShowStamps() + { + $this->collCcShowStamps = new PropelObjectCollection(); + $this->collCcShowStamps->setModel('CcShowStamp'); + } + + /** + * Gets an array of CcShowStamp objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this CcPlaylist is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + * @throws PropelException + */ + public function getCcShowStamps($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcShowStamps || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowStamps) { + // return empty collection + $this->initCcShowStamps(); + } else { + $collCcShowStamps = CcShowStampQuery::create(null, $criteria) + ->filterByCcPlaylist($this) + ->find($con); + if (null !== $criteria) { + return $collCcShowStamps; + } + $this->collCcShowStamps = $collCcShowStamps; + } + } + return $this->collCcShowStamps; + } + + /** + * Returns the number of related CcShowStamp objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcShowStamp objects. + * @throws PropelException + */ + public function countCcShowStamps(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcShowStamps || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowStamps) { + return 0; + } else { + $query = CcShowStampQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcPlaylist($this) + ->count($con); + } + } else { + return count($this->collCcShowStamps); + } + } + + /** + * Method called to associate a CcShowStamp object to this object + * through the CcShowStamp foreign key attribute. + * + * @param CcShowStamp $l CcShowStamp + * @return void + * @throws PropelException + */ + public function addCcShowStamp(CcShowStamp $l) + { + if ($this->collCcShowStamps === null) { + $this->initCcShowStamps(); + } + if (!$this->collCcShowStamps->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcShowStamps[]= $l; + $l->setCcPlaylist($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcPlaylist is new, it will return + * an empty collection; or if this CcPlaylist has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcPlaylist. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcShow($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcShow', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcPlaylist is new, it will return + * an empty collection; or if this CcPlaylist has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcPlaylist. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcShowInstances($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcShowInstances', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcPlaylist is new, it will return + * an empty collection; or if this CcPlaylist has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcPlaylist. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcFiles', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcPlaylist is new, it will return + * an empty collection; or if this CcPlaylist has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcPlaylist. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcWebstream($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcWebstream', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcPlaylist is new, it will return + * an empty collection; or if this CcPlaylist has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcPlaylist. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcBlock($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcBlock', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + /** * Clears the current object and sets all attributes to their default values */ @@ -1360,9 +1623,15 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent $o->clearAllReferences($deep); } } + if ($this->collCcShowStamps) { + foreach ((array) $this->collCcShowStamps as $o) { + $o->clearAllReferences($deep); + } + } } // if ($deep) $this->collCcPlaylistcontentss = null; + $this->collCcShowStamps = null; $this->aCcSubjs = null; } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistPeer.php index da3593e02..b8f2ce721 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistPeer.php @@ -371,6 +371,9 @@ abstract class BaseCcPlaylistPeer { // Invalidate objects in CcPlaylistcontentsPeer instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. CcPlaylistcontentsPeer::clearInstancePool(); + // Invalidate objects in CcShowStampPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcShowStampPeer::clearInstancePool(); } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistQuery.php index 66b50e1c2..6b365ed5a 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistQuery.php @@ -34,6 +34,10 @@ * @method CcPlaylistQuery rightJoinCcPlaylistcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation * @method CcPlaylistQuery innerJoinCcPlaylistcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation * + * @method CcPlaylistQuery leftJoinCcShowStamp($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowStamp relation + * @method CcPlaylistQuery rightJoinCcShowStamp($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowStamp relation + * @method CcPlaylistQuery innerJoinCcShowStamp($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowStamp relation + * * @method CcPlaylist findOne(PropelPDO $con = null) Return the first CcPlaylist matching the query * @method CcPlaylist findOneOrCreate(PropelPDO $con = null) Return the first CcPlaylist matching the query, or a new CcPlaylist object populated from the query conditions when no match is found * @@ -465,6 +469,70 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcontents', 'CcPlaylistcontentsQuery'); } + /** + * Filter the query by a related CcShowStamp object + * + * @param CcShowStamp $ccShowStamp the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistQuery The current query, for fluid interface + */ + public function filterByCcShowStamp($ccShowStamp, $comparison = null) + { + return $this + ->addUsingAlias(CcPlaylistPeer::ID, $ccShowStamp->getDbPlaylistId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShowStamp relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcPlaylistQuery The current query, for fluid interface + */ + public function joinCcShowStamp($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowStamp'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CcShowStamp'); + } + + return $this; + } + + /** + * Use the CcShowStamp relation CcShowStamp object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowStampQuery A secondary query class using the current class as primary query + */ + public function useCcShowStampQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcShowStamp($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowStamp', 'CcShowStampQuery'); + } + /** * Exclude object from result * diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php b/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php index 13a15093f..ddb931074 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php @@ -114,6 +114,13 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent */ protected $broadcasted; + /** + * The value for the stamp_id field. + * Note: this column has a database default value of: 0 + * @var int + */ + protected $stamp_id; + /** * @var CcShowInstances */ @@ -162,6 +169,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $this->media_item_played = false; $this->playout_status = 1; $this->broadcasted = 0; + $this->stamp_id = 0; } /** @@ -406,6 +414,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent return $this->broadcasted; } + /** + * Get the [stamp_id] column value. + * + * @return int + */ + public function getDbStampId() + { + return $this->stamp_id; + } + /** * Set the value of [id] column. * @@ -816,6 +834,26 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent return $this; } // setDbBroadcasted() + /** + * Set the value of [stamp_id] column. + * + * @param int $v new value + * @return CcSchedule The current object (for fluent API support) + */ + public function setDbStampId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->stamp_id !== $v || $this->isNew()) { + $this->stamp_id = $v; + $this->modifiedColumns[] = CcSchedulePeer::STAMP_ID; + } + + return $this; + } // setDbStampId() + /** * Indicates whether the columns in this object are only set to default values. * @@ -850,6 +888,10 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent return false; } + if ($this->stamp_id !== 0) { + return false; + } + // otherwise, everything was equal, so return TRUE return true; } // hasOnlyDefaultValues() @@ -886,6 +928,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $this->instance_id = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null; $this->playout_status = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null; $this->broadcasted = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null; + $this->stamp_id = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null; $this->resetModified(); $this->setNew(false); @@ -894,7 +937,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $this->ensureConsistency(); } - return $startcol + 14; // 14 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 15; // 15 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating CcSchedule object", $e); @@ -1315,6 +1358,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent case 13: return $this->getDbBroadcasted(); break; + case 14: + return $this->getDbStampId(); + break; default: return null; break; @@ -1353,6 +1399,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $keys[11] => $this->getDbInstanceId(), $keys[12] => $this->getDbPlayoutStatus(), $keys[13] => $this->getDbBroadcasted(), + $keys[14] => $this->getDbStampId(), ); if ($includeForeignObjects) { if (null !== $this->aCcShowInstances) { @@ -1437,6 +1484,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent case 13: $this->setDbBroadcasted($value); break; + case 14: + $this->setDbStampId($value); + break; } // switch() } @@ -1475,6 +1525,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent if (array_key_exists($keys[11], $arr)) $this->setDbInstanceId($arr[$keys[11]]); if (array_key_exists($keys[12], $arr)) $this->setDbPlayoutStatus($arr[$keys[12]]); if (array_key_exists($keys[13], $arr)) $this->setDbBroadcasted($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setDbStampId($arr[$keys[14]]); } /** @@ -1500,6 +1551,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent if ($this->isColumnModified(CcSchedulePeer::INSTANCE_ID)) $criteria->add(CcSchedulePeer::INSTANCE_ID, $this->instance_id); if ($this->isColumnModified(CcSchedulePeer::PLAYOUT_STATUS)) $criteria->add(CcSchedulePeer::PLAYOUT_STATUS, $this->playout_status); if ($this->isColumnModified(CcSchedulePeer::BROADCASTED)) $criteria->add(CcSchedulePeer::BROADCASTED, $this->broadcasted); + if ($this->isColumnModified(CcSchedulePeer::STAMP_ID)) $criteria->add(CcSchedulePeer::STAMP_ID, $this->stamp_id); return $criteria; } @@ -1574,6 +1626,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $copyObj->setDbInstanceId($this->instance_id); $copyObj->setDbPlayoutStatus($this->playout_status); $copyObj->setDbBroadcasted($this->broadcasted); + $copyObj->setDbStampId($this->stamp_id); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of @@ -1906,6 +1959,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent $this->instance_id = null; $this->playout_status = null; $this->broadcasted = null; + $this->stamp_id = 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 8cca53863..8f4551a23 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 = 14; + const NUM_COLUMNS = 15; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -73,6 +73,9 @@ abstract class BaseCcSchedulePeer { /** the column name for the BROADCASTED field */ const BROADCASTED = 'cc_schedule.BROADCASTED'; + /** the column name for the STAMP_ID field */ + const STAMP_ID = 'cc_schedule.STAMP_ID'; + /** * 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 @@ -89,12 +92,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', 'DbStreamId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', 'DbPlayoutStatus', 'DbBroadcasted', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbStreamId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', 'dbPlayoutStatus', 'dbBroadcasted', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::STREAM_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, self::PLAYOUT_STATUS, self::BROADCASTED, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'STREAM_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', 'PLAYOUT_STATUS', 'BROADCASTED', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'stream_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', 'playout_status', 'broadcasted', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbStreamId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', 'DbPlayoutStatus', 'DbBroadcasted', 'DbStampId', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbStreamId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', 'dbPlayoutStatus', 'dbBroadcasted', 'dbStampId', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::STREAM_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, self::PLAYOUT_STATUS, self::BROADCASTED, self::STAMP_ID, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'STREAM_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', 'PLAYOUT_STATUS', 'BROADCASTED', 'STAMP_ID', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'stream_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', 'playout_status', 'broadcasted', 'stamp_id', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -104,12 +107,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, 'DbStreamId' => 4, 'DbClipLength' => 5, 'DbFadeIn' => 6, 'DbFadeOut' => 7, 'DbCueIn' => 8, 'DbCueOut' => 9, 'DbMediaItemPlayed' => 10, 'DbInstanceId' => 11, 'DbPlayoutStatus' => 12, 'DbBroadcasted' => 13, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbStreamId' => 4, 'dbClipLength' => 5, 'dbFadeIn' => 6, 'dbFadeOut' => 7, 'dbCueIn' => 8, 'dbCueOut' => 9, 'dbMediaItemPlayed' => 10, 'dbInstanceId' => 11, 'dbPlayoutStatus' => 12, 'dbBroadcasted' => 13, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::STREAM_ID => 4, self::CLIP_LENGTH => 5, self::FADE_IN => 6, self::FADE_OUT => 7, self::CUE_IN => 8, self::CUE_OUT => 9, self::MEDIA_ITEM_PLAYED => 10, self::INSTANCE_ID => 11, self::PLAYOUT_STATUS => 12, self::BROADCASTED => 13, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'STREAM_ID' => 4, 'CLIP_LENGTH' => 5, 'FADE_IN' => 6, 'FADE_OUT' => 7, 'CUE_IN' => 8, 'CUE_OUT' => 9, 'MEDIA_ITEM_PLAYED' => 10, 'INSTANCE_ID' => 11, 'PLAYOUT_STATUS' => 12, 'BROADCASTED' => 13, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'stream_id' => 4, 'clip_length' => 5, 'fade_in' => 6, 'fade_out' => 7, 'cue_in' => 8, 'cue_out' => 9, 'media_item_played' => 10, 'instance_id' => 11, 'playout_status' => 12, 'broadcasted' => 13, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbStreamId' => 4, 'DbClipLength' => 5, 'DbFadeIn' => 6, 'DbFadeOut' => 7, 'DbCueIn' => 8, 'DbCueOut' => 9, 'DbMediaItemPlayed' => 10, 'DbInstanceId' => 11, 'DbPlayoutStatus' => 12, 'DbBroadcasted' => 13, 'DbStampId' => 14, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbStreamId' => 4, 'dbClipLength' => 5, 'dbFadeIn' => 6, 'dbFadeOut' => 7, 'dbCueIn' => 8, 'dbCueOut' => 9, 'dbMediaItemPlayed' => 10, 'dbInstanceId' => 11, 'dbPlayoutStatus' => 12, 'dbBroadcasted' => 13, 'dbStampId' => 14, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::STREAM_ID => 4, self::CLIP_LENGTH => 5, self::FADE_IN => 6, self::FADE_OUT => 7, self::CUE_IN => 8, self::CUE_OUT => 9, self::MEDIA_ITEM_PLAYED => 10, self::INSTANCE_ID => 11, self::PLAYOUT_STATUS => 12, self::BROADCASTED => 13, self::STAMP_ID => 14, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'STREAM_ID' => 4, 'CLIP_LENGTH' => 5, 'FADE_IN' => 6, 'FADE_OUT' => 7, 'CUE_IN' => 8, 'CUE_OUT' => 9, 'MEDIA_ITEM_PLAYED' => 10, 'INSTANCE_ID' => 11, 'PLAYOUT_STATUS' => 12, 'BROADCASTED' => 13, 'STAMP_ID' => 14, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'stream_id' => 4, 'clip_length' => 5, 'fade_in' => 6, 'fade_out' => 7, 'cue_in' => 8, 'cue_out' => 9, 'media_item_played' => 10, 'instance_id' => 11, 'playout_status' => 12, 'broadcasted' => 13, 'stamp_id' => 14, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -195,6 +198,7 @@ abstract class BaseCcSchedulePeer { $criteria->addSelectColumn(CcSchedulePeer::INSTANCE_ID); $criteria->addSelectColumn(CcSchedulePeer::PLAYOUT_STATUS); $criteria->addSelectColumn(CcSchedulePeer::BROADCASTED); + $criteria->addSelectColumn(CcSchedulePeer::STAMP_ID); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.STARTS'); @@ -210,6 +214,7 @@ abstract class BaseCcSchedulePeer { $criteria->addSelectColumn($alias . '.INSTANCE_ID'); $criteria->addSelectColumn($alias . '.PLAYOUT_STATUS'); $criteria->addSelectColumn($alias . '.BROADCASTED'); + $criteria->addSelectColumn($alias . '.STAMP_ID'); } } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php index 890a8cab9..9076adc8b 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php @@ -20,6 +20,7 @@ * @method CcScheduleQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column * @method CcScheduleQuery orderByDbPlayoutStatus($order = Criteria::ASC) Order by the playout_status column * @method CcScheduleQuery orderByDbBroadcasted($order = Criteria::ASC) Order by the broadcasted column + * @method CcScheduleQuery orderByDbStampId($order = Criteria::ASC) Order by the stamp_id column * * @method CcScheduleQuery groupByDbId() Group by the id column * @method CcScheduleQuery groupByDbStarts() Group by the starts column @@ -35,6 +36,7 @@ * @method CcScheduleQuery groupByDbInstanceId() Group by the instance_id column * @method CcScheduleQuery groupByDbPlayoutStatus() Group by the playout_status column * @method CcScheduleQuery groupByDbBroadcasted() Group by the broadcasted column + * @method CcScheduleQuery groupByDbStampId() Group by the stamp_id 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 @@ -73,6 +75,7 @@ * @method CcSchedule findOneByDbInstanceId(int $instance_id) Return the first CcSchedule filtered by the instance_id column * @method CcSchedule findOneByDbPlayoutStatus(int $playout_status) Return the first CcSchedule filtered by the playout_status column * @method CcSchedule findOneByDbBroadcasted(int $broadcasted) Return the first CcSchedule filtered by the broadcasted column + * @method CcSchedule findOneByDbStampId(int $stamp_id) Return the first CcSchedule filtered by the stamp_id 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 @@ -88,6 +91,7 @@ * @method array findByDbInstanceId(int $instance_id) Return CcSchedule objects filtered by the instance_id column * @method array findByDbPlayoutStatus(int $playout_status) Return CcSchedule objects filtered by the playout_status column * @method array findByDbBroadcasted(int $broadcasted) Return CcSchedule objects filtered by the broadcasted column + * @method array findByDbStampId(int $stamp_id) Return CcSchedule objects filtered by the stamp_id column * * @package propel.generator.airtime.om */ @@ -576,6 +580,37 @@ abstract class BaseCcScheduleQuery extends ModelCriteria return $this->addUsingAlias(CcSchedulePeer::BROADCASTED, $dbBroadcasted, $comparison); } + /** + * Filter the query on the stamp_id column + * + * @param int|array $dbStampId 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 filterByDbStampId($dbStampId = null, $comparison = null) + { + if (is_array($dbStampId)) { + $useMinMax = false; + if (isset($dbStampId['min'])) { + $this->addUsingAlias(CcSchedulePeer::STAMP_ID, $dbStampId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbStampId['max'])) { + $this->addUsingAlias(CcSchedulePeer::STAMP_ID, $dbStampId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSchedulePeer::STAMP_ID, $dbStampId, $comparison); + } + /** * Filter the query by a related CcShowInstances object * diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShow.php b/airtime_mvc/application/models/airtime/om/BaseCcShow.php index 35f9798bb..662ce9cff 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShow.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShow.php @@ -95,6 +95,13 @@ abstract class BaseCcShow extends BaseObject implements Persistent */ protected $live_stream_pass; + /** + * The value for the linked field. + * Note: this column has a database default value of: false + * @var boolean + */ + protected $linked; + /** * @var array CcShowInstances[] Collection to store aggregation of CcShowInstances objects. */ @@ -115,6 +122,11 @@ abstract class BaseCcShow extends BaseObject implements Persistent */ protected $collCcShowHostss; + /** + * @var array CcShowStamp[] Collection to store aggregation of CcShowStamp objects. + */ + protected $collCcShowStamps; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -142,6 +154,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent $this->genre = ''; $this->live_stream_using_airtime_auth = false; $this->live_stream_using_custom_auth = false; + $this->linked = false; } /** @@ -264,6 +277,16 @@ abstract class BaseCcShow extends BaseObject implements Persistent return $this->live_stream_pass; } + /** + * Get the [linked] column value. + * + * @return boolean + */ + public function getDbLinked() + { + return $this->linked; + } + /** * Set the value of [id] column. * @@ -484,6 +507,26 @@ abstract class BaseCcShow extends BaseObject implements Persistent return $this; } // setDbLiveStreamPass() + /** + * Set the value of [linked] column. + * + * @param boolean $v new value + * @return CcShow The current object (for fluent API support) + */ + public function setDbLinked($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->linked !== $v || $this->isNew()) { + $this->linked = $v; + $this->modifiedColumns[] = CcShowPeer::LINKED; + } + + return $this; + } // setDbLinked() + /** * Indicates whether the columns in this object are only set to default values. * @@ -514,6 +557,10 @@ abstract class BaseCcShow extends BaseObject implements Persistent return false; } + if ($this->linked !== false) { + return false; + } + // otherwise, everything was equal, so return TRUE return true; } // hasOnlyDefaultValues() @@ -547,6 +594,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent $this->live_stream_using_custom_auth = ($row[$startcol + 8] !== null) ? (boolean) $row[$startcol + 8] : null; $this->live_stream_user = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; $this->live_stream_pass = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; + $this->linked = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null; $this->resetModified(); $this->setNew(false); @@ -555,7 +603,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent $this->ensureConsistency(); } - return $startcol + 11; // 11 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 12; // 12 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating CcShow object", $e); @@ -625,6 +673,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent $this->collCcShowHostss = null; + $this->collCcShowStamps = null; + } // if (deep) } @@ -790,6 +840,14 @@ abstract class BaseCcShow extends BaseObject implements Persistent } } + if ($this->collCcShowStamps !== null) { + foreach ($this->collCcShowStamps as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + $this->alreadyInSave = false; } @@ -893,6 +951,14 @@ abstract class BaseCcShow extends BaseObject implements Persistent } } + if ($this->collCcShowStamps !== null) { + foreach ($this->collCcShowStamps as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + $this->alreadyInValidation = false; } @@ -959,6 +1025,9 @@ abstract class BaseCcShow extends BaseObject implements Persistent case 10: return $this->getDbLiveStreamPass(); break; + case 11: + return $this->getDbLinked(); + break; default: return null; break; @@ -993,6 +1062,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent $keys[8] => $this->getDbLiveStreamUsingCustomAuth(), $keys[9] => $this->getDbLiveStreamUser(), $keys[10] => $this->getDbLiveStreamPass(), + $keys[11] => $this->getDbLinked(), ); return $result; } @@ -1057,6 +1127,9 @@ abstract class BaseCcShow extends BaseObject implements Persistent case 10: $this->setDbLiveStreamPass($value); break; + case 11: + $this->setDbLinked($value); + break; } // switch() } @@ -1092,6 +1165,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent if (array_key_exists($keys[8], $arr)) $this->setDbLiveStreamUsingCustomAuth($arr[$keys[8]]); if (array_key_exists($keys[9], $arr)) $this->setDbLiveStreamUser($arr[$keys[9]]); if (array_key_exists($keys[10], $arr)) $this->setDbLiveStreamPass($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setDbLinked($arr[$keys[11]]); } /** @@ -1114,6 +1188,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH)) $criteria->add(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH, $this->live_stream_using_custom_auth); if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USER)) $criteria->add(CcShowPeer::LIVE_STREAM_USER, $this->live_stream_user); if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_PASS)) $criteria->add(CcShowPeer::LIVE_STREAM_PASS, $this->live_stream_pass); + if ($this->isColumnModified(CcShowPeer::LINKED)) $criteria->add(CcShowPeer::LINKED, $this->linked); return $criteria; } @@ -1185,6 +1260,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent $copyObj->setDbLiveStreamUsingCustomAuth($this->live_stream_using_custom_auth); $copyObj->setDbLiveStreamUser($this->live_stream_user); $copyObj->setDbLiveStreamPass($this->live_stream_pass); + $copyObj->setDbLinked($this->linked); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of @@ -1215,6 +1291,12 @@ abstract class BaseCcShow extends BaseObject implements Persistent } } + foreach ($this->getCcShowStamps() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcShowStamp($relObj->copy($deepCopy)); + } + } + } // if ($deepCopy) @@ -1771,6 +1853,240 @@ abstract class BaseCcShow extends BaseObject implements Persistent return $this->getCcShowHostss($query, $con); } + /** + * Clears out the collCcShowStamps collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addCcShowStamps() + */ + public function clearCcShowStamps() + { + $this->collCcShowStamps = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcShowStamps collection. + * + * By default this just sets the collCcShowStamps collection to an empty array (like clearcollCcShowStamps()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initCcShowStamps() + { + $this->collCcShowStamps = new PropelObjectCollection(); + $this->collCcShowStamps->setModel('CcShowStamp'); + } + + /** + * Gets an array of CcShowStamp objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this CcShow is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + * @throws PropelException + */ + public function getCcShowStamps($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcShowStamps || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowStamps) { + // return empty collection + $this->initCcShowStamps(); + } else { + $collCcShowStamps = CcShowStampQuery::create(null, $criteria) + ->filterByCcShow($this) + ->find($con); + if (null !== $criteria) { + return $collCcShowStamps; + } + $this->collCcShowStamps = $collCcShowStamps; + } + } + return $this->collCcShowStamps; + } + + /** + * Returns the number of related CcShowStamp objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcShowStamp objects. + * @throws PropelException + */ + public function countCcShowStamps(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcShowStamps || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowStamps) { + return 0; + } else { + $query = CcShowStampQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcShow($this) + ->count($con); + } + } else { + return count($this->collCcShowStamps); + } + } + + /** + * Method called to associate a CcShowStamp object to this object + * through the CcShowStamp foreign key attribute. + * + * @param CcShowStamp $l CcShowStamp + * @return void + * @throws PropelException + */ + public function addCcShowStamp(CcShowStamp $l) + { + if ($this->collCcShowStamps === null) { + $this->initCcShowStamps(); + } + if (!$this->collCcShowStamps->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcShowStamps[]= $l; + $l->setCcShow($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShow is new, it will return + * an empty collection; or if this CcShow has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShow. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcShowInstances($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcShowInstances', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShow is new, it will return + * an empty collection; or if this CcShow has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShow. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcFiles', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShow is new, it will return + * an empty collection; or if this CcShow has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShow. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcWebstream($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcWebstream', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShow is new, it will return + * an empty collection; or if this CcShow has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShow. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcBlock($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcBlock', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShow is new, it will return + * an empty collection; or if this CcShow has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShow. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcPlaylist($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcPlaylist', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + /** * Clears the current object and sets all attributes to their default values */ @@ -1787,6 +2103,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent $this->live_stream_using_custom_auth = null; $this->live_stream_user = null; $this->live_stream_pass = null; + $this->linked = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->clearAllReferences(); @@ -1828,12 +2145,18 @@ abstract class BaseCcShow extends BaseObject implements Persistent $o->clearAllReferences($deep); } } + if ($this->collCcShowStamps) { + foreach ((array) $this->collCcShowStamps as $o) { + $o->clearAllReferences($deep); + } + } } // if ($deep) $this->collCcShowInstancess = null; $this->collCcShowDayss = null; $this->collCcShowRebroadcasts = null; $this->collCcShowHostss = null; + $this->collCcShowStamps = null; } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php index 1caf7df62..674929694 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php @@ -125,6 +125,11 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent */ protected $collCcSchedules; + /** + * @var array CcShowStamp[] Collection to store aggregation of CcShowStamp objects. + */ + protected $collCcShowStamps; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -889,6 +894,8 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent $this->collCcSchedules = null; + $this->collCcShowStamps = null; + } // if (deep) } @@ -1064,6 +1071,14 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent } } + if ($this->collCcShowStamps !== null) { + foreach ($this->collCcShowStamps as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + $this->alreadyInSave = false; } @@ -1175,6 +1190,14 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent } } + if ($this->collCcShowStamps !== null) { + foreach ($this->collCcShowStamps as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + $this->alreadyInValidation = false; } @@ -1507,6 +1530,12 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent } } + foreach ($this->getCcShowStamps() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcShowStamp($relObj->copy($deepCopy)); + } + } + } // if ($deepCopy) @@ -2017,6 +2046,240 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent return $this->getCcSchedules($query, $con); } + /** + * Clears out the collCcShowStamps collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addCcShowStamps() + */ + public function clearCcShowStamps() + { + $this->collCcShowStamps = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcShowStamps collection. + * + * By default this just sets the collCcShowStamps collection to an empty array (like clearcollCcShowStamps()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initCcShowStamps() + { + $this->collCcShowStamps = new PropelObjectCollection(); + $this->collCcShowStamps->setModel('CcShowStamp'); + } + + /** + * Gets an array of CcShowStamp objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this CcShowInstances is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + * @throws PropelException + */ + public function getCcShowStamps($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcShowStamps || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowStamps) { + // return empty collection + $this->initCcShowStamps(); + } else { + $collCcShowStamps = CcShowStampQuery::create(null, $criteria) + ->filterByCcShowInstances($this) + ->find($con); + if (null !== $criteria) { + return $collCcShowStamps; + } + $this->collCcShowStamps = $collCcShowStamps; + } + } + return $this->collCcShowStamps; + } + + /** + * Returns the number of related CcShowStamp objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcShowStamp objects. + * @throws PropelException + */ + public function countCcShowStamps(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcShowStamps || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowStamps) { + return 0; + } else { + $query = CcShowStampQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcShowInstances($this) + ->count($con); + } + } else { + return count($this->collCcShowStamps); + } + } + + /** + * Method called to associate a CcShowStamp object to this object + * through the CcShowStamp foreign key attribute. + * + * @param CcShowStamp $l CcShowStamp + * @return void + * @throws PropelException + */ + public function addCcShowStamp(CcShowStamp $l) + { + if ($this->collCcShowStamps === null) { + $this->initCcShowStamps(); + } + if (!$this->collCcShowStamps->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcShowStamps[]= $l; + $l->setCcShowInstances($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShowInstances is new, it will return + * an empty collection; or if this CcShowInstances has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShowInstances. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcShow($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcShow', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShowInstances is new, it will return + * an empty collection; or if this CcShowInstances has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShowInstances. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcFiles', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShowInstances is new, it will return + * an empty collection; or if this CcShowInstances has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShowInstances. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcWebstream($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcWebstream', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShowInstances is new, it will return + * an empty collection; or if this CcShowInstances has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShowInstances. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcBlock($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcBlock', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShowInstances is new, it will return + * an empty collection; or if this CcShowInstances has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShowInstances. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcPlaylist($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcPlaylist', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + /** * Clears the current object and sets all attributes to their default values */ @@ -2065,10 +2328,16 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent $o->clearAllReferences($deep); } } + if ($this->collCcShowStamps) { + foreach ((array) $this->collCcShowStamps as $o) { + $o->clearAllReferences($deep); + } + } } // if ($deep) $this->collCcShowInstancessRelatedByDbId = null; $this->collCcSchedules = null; + $this->collCcShowStamps = null; $this->aCcShow = null; $this->aCcShowInstancesRelatedByDbOriginalShow = null; $this->aCcFiles = null; diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php index 076f2182c..0223926b2 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php @@ -399,6 +399,9 @@ abstract class BaseCcShowInstancesPeer { // Invalidate objects in CcSchedulePeer instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. CcSchedulePeer::clearInstancePool(); + // Invalidate objects in CcShowStampPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcShowStampPeer::clearInstancePool(); } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php index 08a245d2e..30ffdd523 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php @@ -56,6 +56,10 @@ * @method CcShowInstancesQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSchedule relation * @method CcShowInstancesQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation * + * @method CcShowInstancesQuery leftJoinCcShowStamp($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowStamp relation + * @method CcShowInstancesQuery rightJoinCcShowStamp($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowStamp relation + * @method CcShowInstancesQuery innerJoinCcShowStamp($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowStamp relation + * * @method CcShowInstances findOne(PropelPDO $con = null) Return the first CcShowInstances matching the query * @method CcShowInstances findOneOrCreate(PropelPDO $con = null) Return the first CcShowInstances matching the query, or a new CcShowInstances object populated from the query conditions when no match is found * @@ -848,6 +852,70 @@ abstract class BaseCcShowInstancesQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery'); } + /** + * Filter the query by a related CcShowStamp object + * + * @param CcShowStamp $ccShowStamp the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByCcShowStamp($ccShowStamp, $comparison = null) + { + return $this + ->addUsingAlias(CcShowInstancesPeer::ID, $ccShowStamp->getDbInstanceId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShowStamp relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowInstancesQuery The current query, for fluid interface + */ + public function joinCcShowStamp($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowStamp'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CcShowStamp'); + } + + return $this; + } + + /** + * Use the CcShowStamp relation CcShowStamp object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowStampQuery A secondary query class using the current class as primary query + */ + public function useCcShowStampQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcShowStamp($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowStamp', 'CcShowStampQuery'); + } + /** * Exclude object from result * diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcShowPeer.php index e559e0d1a..f19fa875d 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShowPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShowPeer.php @@ -26,7 +26,7 @@ abstract class BaseCcShowPeer { const TM_CLASS = 'CcShowTableMap'; /** 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 BaseCcShowPeer { /** the column name for the LIVE_STREAM_PASS field */ const LIVE_STREAM_PASS = 'cc_show.LIVE_STREAM_PASS'; + /** the column name for the LINKED field */ + const LINKED = 'cc_show.LINKED'; + /** * An identiy map to hold any loaded instances of CcShow objects. * This must be public so that other peer classes can access this when hydrating from JOIN @@ -80,12 +83,12 @@ abstract class BaseCcShowPeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbUrl', 'DbGenre', 'DbDescription', 'DbColor', 'DbBackgroundColor', 'DbLiveStreamUsingAirtimeAuth', 'DbLiveStreamUsingCustomAuth', 'DbLiveStreamUser', 'DbLiveStreamPass', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbUrl', 'dbGenre', 'dbDescription', 'dbColor', 'dbBackgroundColor', 'dbLiveStreamUsingAirtimeAuth', 'dbLiveStreamUsingCustomAuth', 'dbLiveStreamUser', 'dbLiveStreamPass', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::URL, self::GENRE, self::DESCRIPTION, self::COLOR, self::BACKGROUND_COLOR, self::LIVE_STREAM_USING_AIRTIME_AUTH, self::LIVE_STREAM_USING_CUSTOM_AUTH, self::LIVE_STREAM_USER, self::LIVE_STREAM_PASS, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'URL', 'GENRE', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', 'LIVE_STREAM_USING_AIRTIME_AUTH', 'LIVE_STREAM_USING_CUSTOM_AUTH', 'LIVE_STREAM_USER', 'LIVE_STREAM_PASS', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'url', 'genre', 'description', 'color', 'background_color', 'live_stream_using_airtime_auth', 'live_stream_using_custom_auth', 'live_stream_user', 'live_stream_pass', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbUrl', 'DbGenre', 'DbDescription', 'DbColor', 'DbBackgroundColor', 'DbLiveStreamUsingAirtimeAuth', 'DbLiveStreamUsingCustomAuth', 'DbLiveStreamUser', 'DbLiveStreamPass', 'DbLinked', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbUrl', 'dbGenre', 'dbDescription', 'dbColor', 'dbBackgroundColor', 'dbLiveStreamUsingAirtimeAuth', 'dbLiveStreamUsingCustomAuth', 'dbLiveStreamUser', 'dbLiveStreamPass', 'dbLinked', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::URL, self::GENRE, self::DESCRIPTION, self::COLOR, self::BACKGROUND_COLOR, self::LIVE_STREAM_USING_AIRTIME_AUTH, self::LIVE_STREAM_USING_CUSTOM_AUTH, self::LIVE_STREAM_USER, self::LIVE_STREAM_PASS, self::LINKED, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'URL', 'GENRE', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', 'LIVE_STREAM_USING_AIRTIME_AUTH', 'LIVE_STREAM_USING_CUSTOM_AUTH', 'LIVE_STREAM_USER', 'LIVE_STREAM_PASS', 'LINKED', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'url', 'genre', 'description', 'color', 'background_color', 'live_stream_using_airtime_auth', 'live_stream_using_custom_auth', 'live_stream_user', 'live_stream_pass', 'linked', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) ); /** @@ -95,12 +98,12 @@ abstract class BaseCcShowPeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbUrl' => 2, 'DbGenre' => 3, 'DbDescription' => 4, 'DbColor' => 5, 'DbBackgroundColor' => 6, 'DbLiveStreamUsingAirtimeAuth' => 7, 'DbLiveStreamUsingCustomAuth' => 8, 'DbLiveStreamUser' => 9, 'DbLiveStreamPass' => 10, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbUrl' => 2, 'dbGenre' => 3, 'dbDescription' => 4, 'dbColor' => 5, 'dbBackgroundColor' => 6, 'dbLiveStreamUsingAirtimeAuth' => 7, 'dbLiveStreamUsingCustomAuth' => 8, 'dbLiveStreamUser' => 9, 'dbLiveStreamPass' => 10, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::URL => 2, self::GENRE => 3, self::DESCRIPTION => 4, self::COLOR => 5, self::BACKGROUND_COLOR => 6, self::LIVE_STREAM_USING_AIRTIME_AUTH => 7, self::LIVE_STREAM_USING_CUSTOM_AUTH => 8, self::LIVE_STREAM_USER => 9, self::LIVE_STREAM_PASS => 10, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'URL' => 2, 'GENRE' => 3, 'DESCRIPTION' => 4, 'COLOR' => 5, 'BACKGROUND_COLOR' => 6, 'LIVE_STREAM_USING_AIRTIME_AUTH' => 7, 'LIVE_STREAM_USING_CUSTOM_AUTH' => 8, 'LIVE_STREAM_USER' => 9, 'LIVE_STREAM_PASS' => 10, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'url' => 2, 'genre' => 3, 'description' => 4, 'color' => 5, 'background_color' => 6, 'live_stream_using_airtime_auth' => 7, 'live_stream_using_custom_auth' => 8, 'live_stream_user' => 9, 'live_stream_pass' => 10, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbUrl' => 2, 'DbGenre' => 3, 'DbDescription' => 4, 'DbColor' => 5, 'DbBackgroundColor' => 6, 'DbLiveStreamUsingAirtimeAuth' => 7, 'DbLiveStreamUsingCustomAuth' => 8, 'DbLiveStreamUser' => 9, 'DbLiveStreamPass' => 10, 'DbLinked' => 11, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbUrl' => 2, 'dbGenre' => 3, 'dbDescription' => 4, 'dbColor' => 5, 'dbBackgroundColor' => 6, 'dbLiveStreamUsingAirtimeAuth' => 7, 'dbLiveStreamUsingCustomAuth' => 8, 'dbLiveStreamUser' => 9, 'dbLiveStreamPass' => 10, 'dbLinked' => 11, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::URL => 2, self::GENRE => 3, self::DESCRIPTION => 4, self::COLOR => 5, self::BACKGROUND_COLOR => 6, self::LIVE_STREAM_USING_AIRTIME_AUTH => 7, self::LIVE_STREAM_USING_CUSTOM_AUTH => 8, self::LIVE_STREAM_USER => 9, self::LIVE_STREAM_PASS => 10, self::LINKED => 11, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'URL' => 2, 'GENRE' => 3, 'DESCRIPTION' => 4, 'COLOR' => 5, 'BACKGROUND_COLOR' => 6, 'LIVE_STREAM_USING_AIRTIME_AUTH' => 7, 'LIVE_STREAM_USING_CUSTOM_AUTH' => 8, 'LIVE_STREAM_USER' => 9, 'LIVE_STREAM_PASS' => 10, 'LINKED' => 11, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'url' => 2, 'genre' => 3, 'description' => 4, 'color' => 5, 'background_color' => 6, 'live_stream_using_airtime_auth' => 7, 'live_stream_using_custom_auth' => 8, 'live_stream_user' => 9, 'live_stream_pass' => 10, 'linked' => 11, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) ); /** @@ -183,6 +186,7 @@ abstract class BaseCcShowPeer { $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH); $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_USER); $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_PASS); + $criteria->addSelectColumn(CcShowPeer::LINKED); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.NAME'); @@ -195,6 +199,7 @@ abstract class BaseCcShowPeer { $criteria->addSelectColumn($alias . '.LIVE_STREAM_USING_CUSTOM_AUTH'); $criteria->addSelectColumn($alias . '.LIVE_STREAM_USER'); $criteria->addSelectColumn($alias . '.LIVE_STREAM_PASS'); + $criteria->addSelectColumn($alias . '.LINKED'); } } @@ -400,6 +405,9 @@ abstract class BaseCcShowPeer { // Invalidate objects in CcShowHostsPeer instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. CcShowHostsPeer::clearInstancePool(); + // Invalidate objects in CcShowStampPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcShowStampPeer::clearInstancePool(); } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcShowQuery.php index 580a7b1ad..d7a849308 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShowQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShowQuery.php @@ -17,6 +17,7 @@ * @method CcShowQuery orderByDbLiveStreamUsingCustomAuth($order = Criteria::ASC) Order by the live_stream_using_custom_auth column * @method CcShowQuery orderByDbLiveStreamUser($order = Criteria::ASC) Order by the live_stream_user column * @method CcShowQuery orderByDbLiveStreamPass($order = Criteria::ASC) Order by the live_stream_pass column + * @method CcShowQuery orderByDbLinked($order = Criteria::ASC) Order by the linked column * * @method CcShowQuery groupByDbId() Group by the id column * @method CcShowQuery groupByDbName() Group by the name column @@ -29,6 +30,7 @@ * @method CcShowQuery groupByDbLiveStreamUsingCustomAuth() Group by the live_stream_using_custom_auth column * @method CcShowQuery groupByDbLiveStreamUser() Group by the live_stream_user column * @method CcShowQuery groupByDbLiveStreamPass() Group by the live_stream_pass column + * @method CcShowQuery groupByDbLinked() Group by the linked column * * @method CcShowQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method CcShowQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -50,6 +52,10 @@ * @method CcShowQuery rightJoinCcShowHosts($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowHosts relation * @method CcShowQuery innerJoinCcShowHosts($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowHosts relation * + * @method CcShowQuery leftJoinCcShowStamp($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowStamp relation + * @method CcShowQuery rightJoinCcShowStamp($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowStamp relation + * @method CcShowQuery innerJoinCcShowStamp($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowStamp relation + * * @method CcShow findOne(PropelPDO $con = null) Return the first CcShow matching the query * @method CcShow findOneOrCreate(PropelPDO $con = null) Return the first CcShow matching the query, or a new CcShow object populated from the query conditions when no match is found * @@ -64,6 +70,7 @@ * @method CcShow findOneByDbLiveStreamUsingCustomAuth(boolean $live_stream_using_custom_auth) Return the first CcShow filtered by the live_stream_using_custom_auth column * @method CcShow findOneByDbLiveStreamUser(string $live_stream_user) Return the first CcShow filtered by the live_stream_user column * @method CcShow findOneByDbLiveStreamPass(string $live_stream_pass) Return the first CcShow filtered by the live_stream_pass column + * @method CcShow findOneByDbLinked(boolean $linked) Return the first CcShow filtered by the linked column * * @method array findByDbId(int $id) Return CcShow objects filtered by the id column * @method array findByDbName(string $name) Return CcShow objects filtered by the name column @@ -76,6 +83,7 @@ * @method array findByDbLiveStreamUsingCustomAuth(boolean $live_stream_using_custom_auth) Return CcShow objects filtered by the live_stream_using_custom_auth column * @method array findByDbLiveStreamUser(string $live_stream_user) Return CcShow objects filtered by the live_stream_user column * @method array findByDbLiveStreamPass(string $live_stream_pass) Return CcShow objects filtered by the live_stream_pass column + * @method array findByDbLinked(boolean $linked) Return CcShow objects filtered by the linked column * * @package propel.generator.airtime.om */ @@ -412,6 +420,23 @@ abstract class BaseCcShowQuery extends ModelCriteria return $this->addUsingAlias(CcShowPeer::LIVE_STREAM_PASS, $dbLiveStreamPass, $comparison); } + /** + * Filter the query on the linked column + * + * @param boolean|string $dbLinked The value to use as filter. + * Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByDbLinked($dbLinked = null, $comparison = null) + { + if (is_string($dbLinked)) { + $linked = in_array(strtolower($dbLinked), array('false', 'off', '-', 'no', 'n', '0')) ? false : true; + } + return $this->addUsingAlias(CcShowPeer::LINKED, $dbLinked, $comparison); + } + /** * Filter the query by a related CcShowInstances object * @@ -668,6 +693,70 @@ abstract class BaseCcShowQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'CcShowHosts', 'CcShowHostsQuery'); } + /** + * Filter the query by a related CcShowStamp object + * + * @param CcShowStamp $ccShowStamp the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByCcShowStamp($ccShowStamp, $comparison = null) + { + return $this + ->addUsingAlias(CcShowPeer::ID, $ccShowStamp->getDbShowId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShowStamp relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowQuery The current query, for fluid interface + */ + public function joinCcShowStamp($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowStamp'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CcShowStamp'); + } + + return $this; + } + + /** + * Use the CcShowStamp relation CcShowStamp object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowStampQuery A secondary query class using the current class as primary query + */ + public function useCcShowStampQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcShowStamp($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowStamp', 'CcShowStampQuery'); + } + /** * Exclude object from result * diff --git a/airtime_mvc/application/models/airtime/om/BaseCcWebstream.php b/airtime_mvc/application/models/airtime/om/BaseCcWebstream.php index 6f6e16e2b..2b6587984 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcWebstream.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcWebstream.php @@ -90,6 +90,11 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent */ protected $collCcSchedules; + /** + * @var array CcShowStamp[] Collection to store aggregation of CcShowStamp objects. + */ + protected $collCcShowStamps; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -699,6 +704,8 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent $this->collCcSchedules = null; + $this->collCcShowStamps = null; + } // if (deep) } @@ -840,6 +847,14 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent } } + if ($this->collCcShowStamps !== null) { + foreach ($this->collCcShowStamps as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + $this->alreadyInSave = false; } @@ -919,6 +934,14 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent } } + if ($this->collCcShowStamps !== null) { + foreach ($this->collCcShowStamps as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + $this->alreadyInValidation = false; } @@ -1213,6 +1236,12 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent } } + foreach ($this->getCcShowStamps() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcShowStamp($relObj->copy($deepCopy)); + } + } + } // if ($deepCopy) @@ -1417,6 +1446,240 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent return $this->getCcSchedules($query, $con); } + /** + * Clears out the collCcShowStamps collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addCcShowStamps() + */ + public function clearCcShowStamps() + { + $this->collCcShowStamps = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcShowStamps collection. + * + * By default this just sets the collCcShowStamps collection to an empty array (like clearcollCcShowStamps()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initCcShowStamps() + { + $this->collCcShowStamps = new PropelObjectCollection(); + $this->collCcShowStamps->setModel('CcShowStamp'); + } + + /** + * Gets an array of CcShowStamp objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this CcWebstream is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + * @throws PropelException + */ + public function getCcShowStamps($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcShowStamps || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowStamps) { + // return empty collection + $this->initCcShowStamps(); + } else { + $collCcShowStamps = CcShowStampQuery::create(null, $criteria) + ->filterByCcWebstream($this) + ->find($con); + if (null !== $criteria) { + return $collCcShowStamps; + } + $this->collCcShowStamps = $collCcShowStamps; + } + } + return $this->collCcShowStamps; + } + + /** + * Returns the number of related CcShowStamp objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcShowStamp objects. + * @throws PropelException + */ + public function countCcShowStamps(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcShowStamps || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowStamps) { + return 0; + } else { + $query = CcShowStampQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcWebstream($this) + ->count($con); + } + } else { + return count($this->collCcShowStamps); + } + } + + /** + * Method called to associate a CcShowStamp object to this object + * through the CcShowStamp foreign key attribute. + * + * @param CcShowStamp $l CcShowStamp + * @return void + * @throws PropelException + */ + public function addCcShowStamp(CcShowStamp $l) + { + if ($this->collCcShowStamps === null) { + $this->initCcShowStamps(); + } + if (!$this->collCcShowStamps->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcShowStamps[]= $l; + $l->setCcWebstream($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcWebstream is new, it will return + * an empty collection; or if this CcWebstream has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcWebstream. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcShow($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcShow', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcWebstream is new, it will return + * an empty collection; or if this CcWebstream has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcWebstream. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcShowInstances($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcShowInstances', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcWebstream is new, it will return + * an empty collection; or if this CcWebstream has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcWebstream. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcFiles', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcWebstream is new, it will return + * an empty collection; or if this CcWebstream has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcWebstream. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcBlock($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcBlock', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcWebstream is new, it will return + * an empty collection; or if this CcWebstream has previously + * been saved, it will retrieve related CcShowStamps from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcWebstream. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowStamp[] List of CcShowStamp objects + */ + public function getCcShowStampsJoinCcPlaylist($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowStampQuery::create(null, $criteria); + $query->joinWith('CcPlaylist', $join_behavior); + + return $this->getCcShowStamps($query, $con); + } + /** * Clears the current object and sets all attributes to their default values */ @@ -1458,9 +1721,15 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent $o->clearAllReferences($deep); } } + if ($this->collCcShowStamps) { + foreach ((array) $this->collCcShowStamps as $o) { + $o->clearAllReferences($deep); + } + } } // if ($deep) $this->collCcSchedules = null; + $this->collCcShowStamps = null; } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcWebstreamPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcWebstreamPeer.php index c1b2f7221..1965b1bf2 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcWebstreamPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcWebstreamPeer.php @@ -386,6 +386,9 @@ abstract class BaseCcWebstreamPeer { // Invalidate objects in CcSchedulePeer instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. CcSchedulePeer::clearInstancePool(); + // Invalidate objects in CcShowStampPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcShowStampPeer::clearInstancePool(); } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcWebstreamQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcWebstreamQuery.php index 6f5becfb6..1f62828e7 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcWebstreamQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcWebstreamQuery.php @@ -36,6 +36,10 @@ * @method CcWebstreamQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSchedule relation * @method CcWebstreamQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation * + * @method CcWebstreamQuery leftJoinCcShowStamp($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowStamp relation + * @method CcWebstreamQuery rightJoinCcShowStamp($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowStamp relation + * @method CcWebstreamQuery innerJoinCcShowStamp($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowStamp relation + * * @method CcWebstream findOne(PropelPDO $con = null) Return the first CcWebstream matching the query * @method CcWebstream findOneOrCreate(PropelPDO $con = null) Return the first CcWebstream matching the query, or a new CcWebstream object populated from the query conditions when no match is found * @@ -484,6 +488,70 @@ abstract class BaseCcWebstreamQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery'); } + /** + * Filter the query by a related CcShowStamp object + * + * @param CcShowStamp $ccShowStamp the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcWebstreamQuery The current query, for fluid interface + */ + public function filterByCcShowStamp($ccShowStamp, $comparison = null) + { + return $this + ->addUsingAlias(CcWebstreamPeer::ID, $ccShowStamp->getDbStreamId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShowStamp relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcWebstreamQuery The current query, for fluid interface + */ + public function joinCcShowStamp($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowStamp'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CcShowStamp'); + } + + return $this; + } + + /** + * Use the CcShowStamp relation CcShowStamp object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowStampQuery A secondary query class using the current class as primary query + */ + public function useCcShowStampQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcShowStamp($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowStamp', 'CcShowStampQuery'); + } + /** * Exclude object from result * diff --git a/airtime_mvc/application/services/SchedulerService.php b/airtime_mvc/application/services/SchedulerService.php index 097e1f3ae..5b3fa995e 100644 --- a/airtime_mvc/application/services/SchedulerService.php +++ b/airtime_mvc/application/services/SchedulerService.php @@ -1,6 +1,44 @@ "", + "cliplength" => "", + "cuein" => "00:00:00", + "cueout" => "00:00:00", + "fadein" => "00:00:00", + "fadeout" => "00:00:00", + "sched_id" => null, + "type" => 0 //default type of '0' to represent files. type '1' represents a webstream + ); + + private $epochNow; + private $nowDT; + private $user; + private $checkUserPermissions = true; + + public function __construct() + { + $this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME); + + //subtracting one because sometimes when we cancel a track, we set its end time + //to epochNow and then send the new schedule to pypo. Sometimes the currently cancelled + //track can still be included in the new schedule because it may have a few ms left to play. + //subtracting 1 second from epochNow resolves this issue. + $this->epochNow = microtime(true)-1; + $this->nowDT = DateTime::createFromFormat("U.u", $this->epochNow, new DateTimeZone("UTC")); + + if ($this->nowDT === false) { + // DateTime::createFromFormat does not support millisecond string formatting in PHP 5.3.2 (Ubuntu 10.04). + // In PHP 5.3.3 (Ubuntu 10.10), this has been fixed. + $this->nowDT = DateTime::createFromFormat("U", time(), new DateTimeZone("UTC")); + } + + $user_service = new Application_Service_UserService(); + $this->user = $user_service->getCurrentUser(); + } + /** * * Enter description here ... diff --git a/airtime_mvc/application/services/ShowFormService.php b/airtime_mvc/application/services/ShowFormService.php index 8240c9488..47ec2425b 100644 --- a/airtime_mvc/application/services/ShowFormService.php +++ b/airtime_mvc/application/services/ShowFormService.php @@ -209,6 +209,7 @@ class Application_Service_ShowFormService $form->populate( array( + 'add_show_linked' => $this->ccShow->getDbLinked(), 'add_show_repeat_type' => $repeatType, 'add_show_day_check' => $days, 'add_show_end_date' => $repeatEndDate->format("Y-m-d"), diff --git a/airtime_mvc/application/services/ShowService.php b/airtime_mvc/application/services/ShowService.php index 0d99854c2..146848aa4 100644 --- a/airtime_mvc/application/services/ShowService.php +++ b/airtime_mvc/application/services/ShowService.php @@ -1123,6 +1123,7 @@ SQL; $ccShow->setDbLiveStreamUsingCustomAuth($showData['cb_custom_auth'] == 1); $ccShow->setDbLiveStreamUser($showData['custom_username']); $ccShow->setDbLiveStreamPass($showData['custom_password']); + $ccShow->setDbLinked($showData["add_show_linked"]); $ccShow->save(); $this->ccShow = $ccShow; diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index c8c31b8f2..c16063ad9 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -132,6 +132,7 @@ + @@ -326,6 +327,7 @@ We need to know this for logging playout history. (It only gets logged when broadcasted = 1) --> + @@ -472,4 +478,37 @@
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql index cf73470b9..9d9040164 100644 --- a/airtime_mvc/build/sql/schema.sql +++ b/airtime_mvc/build/sql/schema.sql @@ -156,6 +156,7 @@ CREATE TABLE "cc_show" "live_stream_using_custom_auth" BOOLEAN default 'f', "live_stream_user" VARCHAR(255), "live_stream_pass" VARCHAR(255), + "linked" BOOLEAN default 'f' NOT NULL, PRIMARY KEY ("id") ); @@ -426,6 +427,7 @@ CREATE TABLE "cc_schedule" "instance_id" INTEGER NOT NULL, "playout_status" INT2 default 1 NOT NULL, "broadcasted" INT2 default 0 NOT NULL, + "stamp_id" INTEGER default 0 NOT NULL, PRIMARY KEY ("id") ); @@ -747,6 +749,35 @@ CREATE TABLE "cc_locale" COMMENT ON TABLE "cc_locale" IS ''; +SET search_path TO public; +----------------------------------------------------------------------------- +-- cc_show_stamp +----------------------------------------------------------------------------- + +DROP TABLE "cc_show_stamp" CASCADE; + + +CREATE TABLE "cc_show_stamp" +( + "id" serial NOT NULL, + "show_id" INTEGER NOT NULL, + "instance_id" INTEGER, + "file_id" INTEGER, + "stream_id" INTEGER, + "block_id" INTEGER, + "playlist_id" INTEGER, + "position" INTEGER NOT NULL, + "clip_length" interval default '00:00:00', + "cue_in" interval default '00:00:00', + "cue_out" interval default '00:00:00', + "fade_in" interval default '00:00:00', + "fade_out" interval default '00:00:00', + PRIMARY KEY ("id") +); + +COMMENT ON TABLE "cc_show_stamp" IS ''; + + SET search_path TO public; ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_owner_fkey" FOREIGN KEY ("owner_id") REFERENCES "cc_subjs" ("id"); @@ -803,3 +834,15 @@ ALTER TABLE "cc_webstream_metadata" ADD CONSTRAINT "cc_schedule_inst_fkey" FOREI ALTER TABLE "cc_listener_count" ADD CONSTRAINT "cc_timestamp_inst_fkey" FOREIGN KEY ("timestamp_id") REFERENCES "cc_timestamp" ("id") ON DELETE CASCADE; ALTER TABLE "cc_listener_count" ADD CONSTRAINT "cc_mount_name_inst_fkey" FOREIGN KEY ("mount_name_id") REFERENCES "cc_mount_name" ("id") ON DELETE CASCADE; + +ALTER TABLE "cc_show_stamp" ADD CONSTRAINT "cc_show_stamp_show_id_fkey" FOREIGN KEY ("show_id") REFERENCES "cc_show" ("id") ON DELETE CASCADE; + +ALTER TABLE "cc_show_stamp" ADD CONSTRAINT "cc_show_stamp_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "cc_show_instances" ("id") ON DELETE CASCADE; + +ALTER TABLE "cc_show_stamp" ADD CONSTRAINT "cc_show_stamp_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE; + +ALTER TABLE "cc_show_stamp" ADD CONSTRAINT "cc_show_stamp_stream_id_fkey" FOREIGN KEY ("stream_id") REFERENCES "cc_webstream" ("id") ON DELETE CASCADE; + +ALTER TABLE "cc_show_stamp" ADD CONSTRAINT "cc_show_stamp_block_id_fkey" FOREIGN KEY ("block_id") REFERENCES "cc_block" ("id") ON DELETE CASCADE; + +ALTER TABLE "cc_show_stamp" ADD CONSTRAINT "cc_show_stamp_playlist_id_fkey" FOREIGN KEY ("playlist_id") REFERENCES "cc_playlist" ("id") ON DELETE CASCADE;