diff --git a/airtime_mvc/application/common/DateHelper.php b/airtime_mvc/application/common/DateHelper.php
index 48016b8fc..0c3b880c5 100644
--- a/airtime_mvc/application/common/DateHelper.php
+++ b/airtime_mvc/application/common/DateHelper.php
@@ -334,5 +334,57 @@ class Application_Common_DateHelper
}
return true;
}
+
+ /**
+ * This function is used for calculations! Don't modify for display purposes!
+ *
+ * Convert playlist time value to float seconds
+ *
+ * @param string $plt
+ * playlist interval value (HH:mm:ss.dddddd)
+ * @return int
+ * seconds
+ */
+ public static function playlistTimeToSeconds($plt)
+ {
+ $arr = preg_split('/:/', $plt);
+ if (isset($arr[2])) {
+ return (intval($arr[0])*60 + intval($arr[1]))*60 + floatval($arr[2]);
+ }
+ if (isset($arr[1])) {
+ return intval($arr[0])*60 + floatval($arr[1]);
+ }
+
+ return floatval($arr[0]);
+ }
+
+
+ /**
+ * This function is used for calculations! Don't modify for display purposes!
+ *
+ * Convert float seconds value to playlist time format
+ *
+ * @param float $seconds
+ * @return string
+ * interval in playlist time format (HH:mm:ss.d)
+ */
+ public static function secondsToPlaylistTime($p_seconds)
+ {
+ $info = explode('.', $p_seconds);
+ $seconds = $info[0];
+ if (!isset($info[1])) {
+ $milliStr = 0;
+ } else {
+ $milliStr = $info[1];
+ }
+ $hours = floor($seconds / 3600);
+ $seconds -= $hours * 3600;
+ $minutes = floor($seconds / 60);
+ $seconds -= $minutes * 60;
+
+ $res = sprintf("%02d:%02d:%02d.%s", $hours, $minutes, $seconds, $milliStr);
+
+ return $res;
+ }
}
diff --git a/airtime_mvc/application/configs/classmap-airtime-conf.php b/airtime_mvc/application/configs/classmap-airtime-conf.php
index 7f7fcfc47..d9b576e04 100644
--- a/airtime_mvc/application/configs/classmap-airtime-conf.php
+++ b/airtime_mvc/application/configs/classmap-airtime-conf.php
@@ -78,13 +78,27 @@ return array (
'BaseCcPlaylistcontentsPeer' => 'airtime/om/BaseCcPlaylistcontentsPeer.php',
'BaseCcPlaylistcontents' => 'airtime/om/BaseCcPlaylistcontents.php',
'BaseCcPlaylistcontentsQuery' => 'airtime/om/BaseCcPlaylistcontentsQuery.php',
- 'CcPlaylistcriteriaTableMap' => 'airtime/map/CcPlaylistcriteriaTableMap.php',
- 'CcPlaylistcriteriaPeer' => 'airtime/CcPlaylistcriteriaPeer.php',
- 'CcPlaylistcriteria' => 'airtime/CcPlaylistcriteria.php',
- 'CcPlaylistcriteriaQuery' => 'airtime/CcPlaylistcriteriaQuery.php',
- 'BaseCcPlaylistcriteriaPeer' => 'airtime/om/BaseCcPlaylistcriteriaPeer.php',
- 'BaseCcPlaylistcriteria' => 'airtime/om/BaseCcPlaylistcriteria.php',
- 'BaseCcPlaylistcriteriaQuery' => 'airtime/om/BaseCcPlaylistcriteriaQuery.php',
+ 'CcBlockTableMap' => 'airtime/map/CcBlockTableMap.php',
+ 'CcBlockPeer' => 'airtime/CcBlockPeer.php',
+ 'CcBlock' => 'airtime/CcBlock.php',
+ 'CcBlockQuery' => 'airtime/CcBlockQuery.php',
+ 'BaseCcBlockPeer' => 'airtime/om/BaseCcBlockPeer.php',
+ 'BaseCcBlock' => 'airtime/om/BaseCcBlock.php',
+ 'BaseCcBlockQuery' => 'airtime/om/BaseCcBlockQuery.php',
+ 'CcBlockcontentsTableMap' => 'airtime/map/CcBlockcontentsTableMap.php',
+ 'CcBlockcontentsPeer' => 'airtime/CcBlockcontentsPeer.php',
+ 'CcBlockcontents' => 'airtime/CcBlockcontents.php',
+ 'CcBlockcontentsQuery' => 'airtime/CcBlockcontentsQuery.php',
+ 'BaseCcBlockcontentsPeer' => 'airtime/om/BaseCcBlockcontentsPeer.php',
+ 'BaseCcBlockcontents' => 'airtime/om/BaseCcBlockcontents.php',
+ 'BaseCcBlockcontentsQuery' => 'airtime/om/BaseCcBlockcontentsQuery.php',
+ 'CcBlockcriteriaTableMap' => 'airtime/map/CcBlockcriteriaTableMap.php',
+ 'CcBlockcriteriaPeer' => 'airtime/CcBlockcriteriaPeer.php',
+ 'CcBlockcriteria' => 'airtime/CcBlockcriteria.php',
+ 'CcBlockcriteriaQuery' => 'airtime/CcBlockcriteriaQuery.php',
+ 'BaseCcBlockcriteriaPeer' => 'airtime/om/BaseCcBlockcriteriaPeer.php',
+ 'BaseCcBlockcriteria' => 'airtime/om/BaseCcBlockcriteria.php',
+ 'BaseCcBlockcriteriaQuery' => 'airtime/om/BaseCcBlockcriteriaQuery.php',
'CcPrefTableMap' => 'airtime/map/CcPrefTableMap.php',
'CcPrefPeer' => 'airtime/CcPrefPeer.php',
'CcPref' => 'airtime/CcPref.php',
diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php
index 9d1cb7995..26f58b451 100644
--- a/airtime_mvc/application/controllers/PlaylistController.php
+++ b/airtime_mvc/application/controllers/PlaylistController.php
@@ -24,10 +24,9 @@ class PlaylistController extends Zend_Controller_Action
->addActionContext('set-playlist-description', 'json')
->addActionContext('playlist-preview', 'json')
->addActionContext('get-playlist', 'json')
- ->addActionContext('smart-playlist-criteria-save', 'json')
- ->addActionContext('smart-playlist-generate', 'json')
- ->addActionContext('smart-playlist-shuffle', 'json')
- ->addActionContext('new-block', 'json')
+ ->addActionContext('smart-block-criteria-save', 'json')
+ ->addActionContext('smart-block-generate', 'json')
+ ->addActionContext('smart-block-shuffle', 'json')
->initContext();
/*$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME);
@@ -192,13 +191,16 @@ class PlaylistController extends Zend_Controller_Action
if($isAdminOrPM || $obj->getCreatorId() == $userInfo->id){
$this->view->obj = $obj;
- //$form = new Application_Form_SmartBlockCriteria();
- //$form->startForm($this->pl_sess->id);
- //$this->view->form = $form;
+ if($this->obj_sess->type == "block"){
+ $form = new Application_Form_SmartBlockCriteria();
+ $form->startForm($this->obj_sess->id);
+ $this->view->form = $form;
+ }
}
$formatter = new LengthFormatter($obj->getLength());
$this->view->length = $formatter->format();
+ $this->view->type = $this->obj_sess->type;
}
} catch (PlaylistNotFoundException $e) {
$this->playlistNotFound();
@@ -318,7 +320,7 @@ class PlaylistController extends Zend_Controller_Action
}
}
catch (PlaylistOutDatedException $e) {
- $this->playlistOutdated($obj, $e);
+ $this->playlistOutdated($e);
}
catch (PlaylistNotFoundException $e) {
$this->playlistNotFound($obj_type);
@@ -505,24 +507,24 @@ class PlaylistController extends Zend_Controller_Action
}
}
- public function smartPlaylistCriteriaSaveAction()
+ public function smartBlockCriteriaSaveAction()
{
$request = $this->getRequest();
$params = $request->getPost();
- $pl = new Application_Model_Playlist($params['pl_id']);
- $result = $pl->saveSmartPlaylistCriteria($params['data']);
+ $bl = new Application_Model_Block($params['obj_id']);
+ $result = $bl->saveSmartBlockCriteria($params['data']);
die(json_encode($result));
}
- public function smartPlaylistGenerateAction()
+ public function smartBlockGenerateAction()
{
$request = $this->getRequest();
$params = $request->getPost();
- $pl = new Application_Model_Playlist($params['pl_id']);
- $result = $pl->generateSmartPlaylist($params['data']);
+ $bl = new Application_Model_Block($params['obj_id']);
+ $result = $bl->generateSmartBlock($params['data']);
if ($result['result'] == 0) {
try {
- die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($pl, true))));
+ die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true))));
}
catch (PlaylistNotFoundException $e) {
$this->playlistNotFound('block');
@@ -535,15 +537,15 @@ class PlaylistController extends Zend_Controller_Action
}
}
- public function smartPlaylistShuffleAction()
+ public function smartBlockShuffleAction()
{
$request = $this->getRequest();
$params = $request->getPost();
- $pl = new Application_Model_Playlist($params['pl_id']);
- $result = $pl->shuffleSmartPlaylist();
+ $bl = new Application_Model_Block($params['obj_id']);
+ $result = $bl->shuffleSmartBlock();
if ($result['result'] == 0) {
try {
- die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($pl, true))));
+ die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true))));
}
catch (PlaylistNotFoundException $e) {
$this->playlistNotFound('block');
diff --git a/airtime_mvc/application/forms/SmartBlockCriteria.php b/airtime_mvc/application/forms/SmartBlockCriteria.php
index 8e51b4ee4..f635dab18 100644
--- a/airtime_mvc/application/forms/SmartBlockCriteria.php
+++ b/airtime_mvc/application/forms/SmartBlockCriteria.php
@@ -6,7 +6,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
}
- public function startForm($p_playlistId)
+ public function startForm($p_blockId)
{
$criteriaOptions = array(
0 => "Select criteria",
@@ -94,26 +94,26 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
);
// load type
- $out = CcPlaylistQuery::create()->findPk($p_playlistId);
+ $out = CcBlockQuery::create()->findPk($p_blockId);
if ($out->getDbType() == "static") {
- $playlistType = 0;
+ $blockType = 0;
} else {
- $playlistType = 1;
+ $blockType = 1;
}
$spType = new Zend_Form_Element_Radio('sp_type');
- $spType->setLabel('Set smart playlist type:')
+ $spType->setLabel('Set smart block type:')
->setDecorators(array('viewHelper'))
->setMultiOptions(array(
'static' => 'Static',
'dynamic' => 'Dynamic'
))
- ->setValue($playlistType);
+ ->setValue($blockType);
$this->addElement($spType);
-
+
// load criteria from db
- $out = CcPlaylistcriteriaQuery::create()->findByDbPlaylistId($p_playlistId);
+ $out = CcBlockcriteriaQuery::create()->findByDbBlockId($p_blockId);
$storedCrit = array();
foreach ($out as $crit) {
@@ -129,9 +129,9 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
}
}
- $openSmartPlaylistOption = false;
+ $openSmartBlockOption = false;
if (!empty($storedCrit)) {
- $openSmartPlaylistOption = true;
+ $openSmartBlockOption = true;
}
$numElements = count($criteriaOptions);
@@ -212,9 +212,9 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$limitValue->setValue($storedCrit["limit"]["value"]);
}
- //getting playlist content candidate count that meets criteria
- $pl = new Application_Model_Playlist($p_playlistId);
- $files = $pl->getListofFilesMeetCriteria();
+ //getting block content candidate count that meets criteria
+ $bl = new Application_Model_Block($p_blockId);
+ $files = $bl->getListofFilesMeetCriteria();
$save = new Zend_Form_Element_Button('save_button');
$save->setAttrib('class', 'ui-button ui-state-default sp-button');
@@ -226,7 +226,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$generate = new Zend_Form_Element_Button('generate_button');
$generate->setAttrib('class', 'ui-button ui-state-default sp-button');
- $generate->setAttrib('title', 'Save criteria and generate playlist content');
+ $generate->setAttrib('title', 'Save criteria and generate block content');
$generate->setIgnore(true);
$generate->setLabel('Generate');
$generate->setDecorators(array('viewHelper'));
@@ -234,14 +234,14 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$shuffle = new Zend_Form_Element_Button('shuffle_button');
$shuffle->setAttrib('class', 'ui-button ui-state-default sp-button');
- $shuffle->setAttrib('title', 'Shuffle playlist content');
+ $shuffle->setAttrib('title', 'Shuffle block content');
$shuffle->setIgnore(true);
$shuffle->setLabel('Shuffle');
$shuffle->setDecorators(array('viewHelper'));
$this->addElement($shuffle);
$this->setDecorators(array(
- array('ViewScript', array('viewScript' => 'form/smart-block-criteria.phtml', "openOption"=> $openSmartPlaylistOption,
+ array('ViewScript', array('viewScript' => 'form/smart-block-criteria.phtml', "openOption"=> $openSmartBlockOption,
'criteriasLength' => count($criteriaOptions), 'poolCount' => $files['count']))
));
}
diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php
new file mode 100644
index 000000000..1d8addf61
--- /dev/null
+++ b/airtime_mvc/application/models/Block.php
@@ -0,0 +1,1123 @@
+ "",
+ "pos" => "",
+ "cliplength" => "",
+ "cuein" => "00:00:00",
+ "cueout" => "00:00:00",
+ "fadein" => "0.0",
+ "fadeout" => "0.0",
+ );
+
+ //using propel's phpNames.
+ private $categories = array(
+ "dc:title" => "Name",
+ "dc:creator" => "Creator",
+ "dc:description" => "Description",
+ "dcterms:extent" => "Length"
+ );
+
+ private static $modifier2CriteriaMap = array(
+ "contains" => Criteria::ILIKE,
+ "does not contain" => Criteria::NOT_ILIKE,
+ "is" => Criteria::EQUAL,
+ "is not" => Criteria::NOT_EQUAL,
+ "starts with" => Criteria::ILIKE,
+ "ends with" => Criteria::ILIKE,
+ "is greater than" => Criteria::GREATER_THAN,
+ "is less than" => Criteria::LESS_THAN,
+ "is in the range" => Criteria::CUSTOM);
+
+ private static $criteria2PeerMap = array(
+ 0 => "Select criteria",
+ "album_title" => "DbAlbumTitle",
+ "artist_name" => "DbArtistName",
+ "bit_rate" => "DbBitRate",
+ "bpm" => "DbBpm",
+ "comments" => "DbComments",
+ "composer" => "DbComposer",
+ "conductor" => "DbConductor",
+ "utime" => "DbUtime",
+ "mtime" => "DbMtime",
+ "lptime" => "DbLPtime",
+ "disc_number" => "DbDiscNumber",
+ "genre" => "DbGenre",
+ "isrc_number" => "DbIsrcNumber",
+ "label" => "DbLabel",
+ "language" => "DbLanguage",
+ "length" => "DbLength",
+ "lyricist" => "DbLyricist",
+ "mood" => "DbMood",
+ "name" => "DbName",
+ "orchestra" => "DbOrchestra",
+ "radio_station_name" => "DbRadioStation",
+ "rating" => "DbRating",
+ "sample_rate" => "DbSampleRate",
+ "track_title" => "DbTrackTitle",
+ "track_num" => "DbTrackNum",
+ "year" => "DbYear"
+ );
+
+ public function __construct($id=null, $con=null)
+ {
+ if (isset($id)) {
+ $this->block = CcBlockQuery::create()->findPk($id);
+
+ if (is_null($this->block)) {
+ throw new BlockNotFoundException();
+ }
+ } else {
+ $this->block = new CcBlock();
+ $this->block->setDbUTime("now", new DateTimeZone("UTC"));
+ $this->block->save();
+ }
+
+ $defaultFade = Application_Model_Preference::GetDefaultFade();
+ if ($defaultFade !== "") {
+ //fade is in format SS.uuuuuu
+
+ $this->blockItem["fadein"] = $defaultFade;
+ $this->blockItem["fadeout"] = $defaultFade;
+ }
+
+ $this->con = isset($con) ? $con : Propel::getConnection(CcBlockPeer::DATABASE_NAME);
+ $this->id = $this->block->getDbId();
+ }
+
+ /**
+ * Return local ID of virtual file.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Rename stored virtual block
+ *
+ * @param string $p_newname
+ */
+ public function setName($p_newname)
+ {
+ $this->block->setDbName($p_newname);
+ $this->block->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
+ $this->block->save($this->con);
+ }
+
+ /**
+ * Get mnemonic block name
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->block->getDbName();
+ }
+
+ public function setDescription($p_description)
+ {
+ $this->block->setDbDescription($p_description);
+ $this->block->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
+ $this->block->save($this->con);
+ }
+
+ public function getDescription()
+ {
+ return $this->block->getDbDescription();
+ }
+
+ public function getCreator()
+ {
+ return $this->block->getCcSubjs()->getDbLogin();
+ }
+
+ public function getCreatorId()
+ {
+ return $this->block->getCcSubjs()->getDbId();
+ }
+
+ public function setCreator($p_id)
+ {
+ $this->block->setDbCreatorId($p_id);
+ $this->block->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
+ $this->block->save($this->con);
+ }
+
+ public function getLastModified($format = null)
+ {
+ return $this->block->getDbMtime($format);
+ }
+
+ public function getSize()
+ {
+ return $this->block->countCcBlockcontentss();
+ }
+
+ /**
+ * Get the entire block as a two dimentional array, sorted in order of play.
+ * @param boolean $filterFiles if this is true, it will only return files that has
+ * file_exists flag set to true
+ * @return array
+ */
+ public function getContents($filterFiles=false)
+ {
+ Logging::log("Getting contents for block {$this->id}");
+
+ $files = array();
+ $query = CcBlockcontentsQuery::create()
+ ->filterByDbBlockId($this->id);
+
+ if ($filterFiles) {
+ $query->useCcFilesQuery()
+ ->filterByDbFileExists(true)
+ ->endUse();
+ }
+ $query->orderByDbPosition()
+ ->leftJoinWith('CcFiles');
+ $rows = $query->find($this->con);
+
+ $i = 0;
+ $offset = 0;
+ foreach ($rows as $row) {
+ $files[$i] = $row->toArray(BasePeer::TYPE_FIELDNAME, true, true);
+
+
+ $clipSec = Application_Common_DateHelper::playlistTimeToSeconds($files[$i]['cliplength']);
+ $offset += $clipSec;
+ $offset_cliplength = Application_Common_DateHelper::secondsToPlaylistTime($offset);
+
+ //format the length for UI.
+ $formatter = new LengthFormatter($files[$i]['cliplength']);
+ $files[$i]['cliplength'] = $formatter->format();
+
+ $formatter = new LengthFormatter($offset_cliplength);
+ $files[$i]['offset'] = $formatter->format();
+
+ $i++;
+ }
+
+ return $files;
+ }
+
+ /**
+ * The database stores fades in 00:00:00 Time format with optional millisecond resolution .000000
+ * but this isn't practical since fades shouldn't be very long usuall 1 second or less. This function
+ * will normalize the fade so that it looks like 00.000000 to the user.
+ **/
+ public function normalizeFade($fade)
+ {
+ //First get rid of the first six characters 00:00: which will be added back later for db update
+ $fade = substr($fade, 6);
+
+ //Second add .000000 if the fade does't have milliseconds format already
+ $dbFadeStrPos = strpos( $fade, '.' );
+ if ( $dbFadeStrPos === False )
+ $fade .= '.000000';
+ else
+ while( strlen( $fade ) < 9 )
+ $fade .= '0';
+
+ //done, just need to set back the formated values
+ return $fade;
+ }
+
+ //aggregate column on blockcontents cliplength column.
+ public function getLength()
+ {
+ return $this->block->getDbLength();
+ }
+
+ private function insertBlockElement($info)
+ {
+ $row = new CcBlockcontents();
+ $row->setDbBlockId($this->id);
+ $row->setDbFileId($info["id"]);
+ $row->setDbPosition($info["pos"]);
+ $row->setDbCliplength($info["cliplength"]);
+ $row->setDbCuein($info["cuein"]);
+ $row->setDbCueout($info["cueout"]);
+ $row->setDbFadein($info["fadein"]);
+ $row->setDbFadeout($info["fadeout"]);
+ $row->save($this->con);
+ // above save result update on cc_block table on length column.
+ // but $this->block doesn't get updated automatically
+ // so we need to manually grab it again from DB so it has updated values
+ // It is something to do FORMAT_ON_DEMAND( Lazy Loading )
+ $this->block = CcBlockQuery::create()->findPK($this->id);
+ }
+
+ /*
+ *
+ */
+ private function buildEntry($p_item, $pos)
+ {
+ $file = CcFilesQuery::create()->findPK($p_item, $this->con);
+
+ if (isset($file) && $file->getDbFileExists()) {
+ $entry = $this->blockItem;
+ $entry["id"] = $file->getDbId();
+ $entry["pos"] = $pos;
+ $entry["cliplength"] = $file->getDbLength();
+ $entry["cueout"] = $file->getDbLength();
+
+ return $entry;
+ } else {
+ throw new Exception("trying to add a file that does not exist.");
+ }
+ }
+
+ public function isStatic(){
+ if ($this->block->getDbType() == "static") {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ * @param array $p_items
+ * an array of audioclips to add to the block
+ * @param int|null $p_afterItem
+ * item which to add the new items after in the block, null if added to the end.
+ * @param string (before|after) $addAfter
+ * whether to add the clips before or after the selected item.
+ */
+ public function addAudioClips($p_items, $p_afterItem=NULL, $addType = 'after')
+ {
+ $this->con->beginTransaction();
+ $contentsToUpdate = array();
+
+ try {
+
+ if (is_numeric($p_afterItem)) {
+ Logging::log("Finding block content item {$p_afterItem}");
+
+ $afterItem = CcBlockcontentsQuery::create()->findPK($p_afterItem);
+ $index = $afterItem->getDbPosition();
+ Logging::log("index is {$index}");
+ $pos = ($addType == 'after') ? $index + 1 : $index;
+
+ $contentsToUpdate = CcBlockcontentsQuery::create()
+ ->filterByDbBlockId($this->id)
+ ->filterByDbPosition($pos, Criteria::GREATER_EQUAL)
+ ->orderByDbPosition()
+ ->find($this->con);
+
+ Logging::log("Adding to block");
+ Logging::log("at position {$pos}");
+ } else {
+
+ //add to the end of the block
+ if ($addType == 'after') {
+ $pos = $this->getSize();
+ }
+ //add to the beginning of the block.
+ else {
+ $pos = 0;
+
+ $contentsToUpdate = CcBlockcontentsQuery::create()
+ ->filterByDbBlockId($this->id)
+ ->orderByDbPosition()
+ ->find($this->con);
+ }
+
+ $contentsToUpdate = CcBlockcontentsQuery::create()
+ ->filterByDbBlockId($this->id)
+ ->filterByDbPosition($pos, Criteria::GREATER_EQUAL)
+ ->orderByDbPosition()
+ ->find($this->con);
+
+ Logging::log("Adding to block");
+ Logging::log("at position {$pos}");
+ }
+
+ foreach ($p_items as $ac) {
+ Logging::log("Adding audio file {$ac}");
+
+ $res = $this->insertBlockElement($this->buildEntry($ac, $pos));
+ $pos = $pos + 1;
+ }
+
+ //reset the positions of the remaining items.
+ for ($i = 0; $i < count($contentsToUpdate); $i++) {
+ $contentsToUpdate[$i]->setDbPosition($pos);
+ $contentsToUpdate[$i]->save($this->con);
+ $pos = $pos + 1;
+ }
+
+ $this->block->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
+ $this->block->save($this->con);
+
+ $this->con->commit();
+ } catch (Exception $e) {
+ $this->con->rollback();
+ throw $e;
+ }
+ }
+
+ /**
+ * Move audioClip to the new position in the block
+ *
+ * @param array $p_items
+ * array of unique ids of the selected items
+ * @param int $p_afterItem
+ * unique id of the item to move the clip after
+ */
+ public function moveAudioClips($p_items, $p_afterItem=NULL)
+ {
+ $this->con->beginTransaction();
+
+ try {
+
+ $contentsToMove = CcBlockcontentsQuery::create()
+ ->filterByDbId($p_items, Criteria::IN)
+ ->orderByDbPosition()
+ ->find($this->con);
+
+ $otherContent = CcBlockcontentsQuery::create()
+ ->filterByDbId($p_items, Criteria::NOT_IN)
+ ->filterByDbBlockId($this->id)
+ ->orderByDbPosition()
+ ->find($this->con);
+
+ $pos = 0;
+ //moving items to beginning of the block.
+ if (is_null($p_afterItem)) {
+ Logging::log("moving items to beginning of block");
+
+ foreach ($contentsToMove as $item) {
+ Logging::log("item {$item->getDbId()} to pos {$pos}");
+ $item->setDbPosition($pos);
+ $item->save($this->con);
+ $pos = $pos + 1;
+ }
+ foreach ($otherContent as $item) {
+ Logging::log("item {$item->getDbId()} to pos {$pos}");
+ $item->setDbPosition($pos);
+ $item->save($this->con);
+ $pos = $pos + 1;
+ }
+ } else {
+ Logging::log("moving items after {$p_afterItem}");
+
+ foreach ($otherContent as $item) {
+ Logging::log("item {$item->getDbId()} to pos {$pos}");
+ $item->setDbPosition($pos);
+ $item->save($this->con);
+ $pos = $pos + 1;
+
+ if ($item->getDbId() == $p_afterItem) {
+ foreach ($contentsToMove as $move) {
+ Logging::log("item {$move->getDbId()} to pos {$pos}");
+ $move->setDbPosition($pos);
+ $move->save($this->con);
+ $pos = $pos + 1;
+ }
+ }
+ }
+ }
+
+ $this->con->commit();
+ } catch (Exception $e) {
+ $this->con->rollback();
+ throw $e;
+ }
+
+ $this->block = CcBlockQuery::create()->findPK($this->id);
+ $this->block->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
+ $this->block->save($this->con);
+ }
+
+ /**
+ * Remove audioClip from block
+ *
+ * @param array $p_items
+ * array of unique item ids to remove from the block..
+ */
+ public function delAudioClips($p_items)
+ {
+
+ $this->con->beginTransaction();
+
+ try {
+
+ CcBlockcontentsQuery::create()
+ ->findPKs($p_items)
+ ->delete($this->con);
+
+ $contents = CcBlockcontentsQuery::create()
+ ->filterByDbBlockId($this->id)
+ ->orderByDbPosition()
+ ->find($this->con);
+
+ //reset the positions of the remaining items.
+ for ($i = 0; $i < count($contents); $i++) {
+ $contents[$i]->setDbPosition($i);
+ $contents[$i]->save($this->con);
+ }
+
+ $this->block->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
+ $this->block->save($this->con);
+
+ $this->con->commit();
+ } catch (Exception $e) {
+ $this->con->rollback();
+ throw $e;
+ }
+ }
+
+ public function getFadeInfo($pos)
+ {
+ Logging::log("Getting fade info for pos {$pos}");
+
+ $row = CcBlockcontentsQuery::create()
+ ->joinWith(CcFilesPeer::OM_CLASS)
+ ->filterByDbBlockId($this->id)
+ ->filterByDbPosition($pos)
+ ->findOne();
+
+
+
+ #Propel returns values in form 00.000000 format which is for only seconds.
+ $fadeIn = $row->getDbFadein();
+ $fadeOut = $row->getDbFadeout();
+ return array($fadeIn, $fadeOut);
+ }
+
+ /**
+ * Change fadeIn and fadeOut values for block Element
+ *
+ * @param int $pos
+ * position of audioclip in block
+ * @param string $fadeIn
+ * new value in ss.ssssss or extent format
+ * @param string $fadeOut
+ * new value in ss.ssssss or extent format
+ * @return boolean
+ */
+ public function changeFadeInfo($id, $fadeIn, $fadeOut)
+ {
+ //See issue CC-2065, pad the fadeIn and fadeOut so that it is TIME compatable with the DB schema
+ //For the top level PlayList either fadeIn or fadeOut will sometimes be Null so need a gaurd against
+ //setting it to nonNull for checks down below
+ $fadeIn = $fadeIn?'00:00:'.$fadeIn:$fadeIn;
+ $fadeOut = $fadeOut?'00:00:'.$fadeOut:$fadeOut;
+
+ $this->con->beginTransaction();
+
+ $errArray= array();
+
+ try {
+ $row = CcBlockcontentsQuery::create()->findPK($id);
+
+ if (is_null($row)) {
+ throw new Exception("Block item does not exist.");
+ }
+
+ $clipLength = $row->getDbCliplength();
+
+ if (!is_null($fadeIn)) {
+
+ $sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$clipLength}'";
+ $r = $this->con->query($sql);
+ if ($r->fetchColumn(0)) {
+ //"Fade In can't be larger than overall playlength.";
+ $fadeIn = $clipLength;
+ }
+ $row->setDbFadein($fadeIn);
+ }
+ if (!is_null($fadeOut)) {
+
+ $sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$clipLength}'";
+ $r = $this->con->query($sql);
+ if ($r->fetchColumn(0)) {
+ //Fade Out can't be larger than overall playlength.";
+ $fadeOut = $clipLength;
+ }
+ $row->setDbFadeout($fadeOut);
+ }
+
+ $row->save($this->con);
+ $this->block->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
+ $this->block->save($this->con);
+
+ $this->con->commit();
+ } catch (Exception $e) {
+ $this->con->rollback();
+ throw $e;
+ }
+
+ return array("fadeIn" => $fadeIn, "fadeOut" => $fadeOut);
+ }
+
+ public function setBlockfades($fadein, $fadeout)
+ {
+ if (isset($fadein)) {
+ Logging::log("Setting block fade in {$fadein}");
+ $row = CcBlockcontentsQuery::create()
+ ->filterByDbBlockId($this->id)
+ ->filterByDbPosition(0)
+ ->findOne($this->con);
+
+ $this->changeFadeInfo($row->getDbId(), $fadein, null);
+ }
+
+ if (isset($fadeout)) {
+ Logging::log("Setting block fade out {$fadeout}");
+ $row = CcBlockcontentsQuery::create()
+ ->filterByDbBlockId($this->id)
+ ->filterByDbPosition($this->getSize()-1)
+ ->findOne($this->con);
+
+ $this->changeFadeInfo($row->getDbId(), null, $fadeout);
+ }
+ }
+
+ /**
+ * Change cueIn/cueOut values for block element
+ *
+ * @param int $pos
+ * position of audioclip in block
+ * @param string $cueIn
+ * new value in ss.ssssss or extent format
+ * @param string $cueOut
+ * new value in ss.ssssss or extent format
+ * @return boolean or pear error object
+ */
+ public function changeClipLength($id, $cueIn, $cueOut)
+ {
+ $this->con->beginTransaction();
+
+ $errArray= array();
+
+ try {
+ if (is_null($cueIn) && is_null($cueOut)) {
+ $errArray["error"] = "Cue in and cue out are null.";
+
+ return $errArray;
+ }
+
+ $row = CcBlockcontentsQuery::create()
+ ->joinWith(CcFilesPeer::OM_CLASS)
+ ->filterByPrimaryKey($id)
+ ->findOne($this->con);
+
+ if (is_null($row)) {
+ throw new Exception("Block item does not exist.");
+ }
+
+ $oldCueIn = $row->getDBCuein();
+ $oldCueOut = $row->getDbCueout();
+ $fadeIn = $row->getDbFadein();
+ $fadeOut = $row->getDbFadeout();
+
+ $file = $row->getCcFiles($this->con);
+ $origLength = $file->getDbLength();
+
+ if (!is_null($cueIn) && !is_null($cueOut)) {
+
+ if ($cueOut === "") {
+ $cueOut = $origLength;
+ }
+
+ $sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$cueOut}'";
+ $r = $this->con->query($sql);
+ if ($r->fetchColumn(0)) {
+ $errArray["error"] = "Can't set cue in to be larger than cue out.";
+
+ return $errArray;
+ }
+
+ $sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
+ $r = $this->con->query($sql);
+ if ($r->fetchColumn(0)) {
+ $errArray["error"] = "Can't set cue out to be greater than file length.";
+
+ return $errArray;
+ }
+
+ $sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$cueIn}'";
+ $r = $this->con->query($sql);
+ $cliplength = $r->fetchColumn(0);
+
+ $row->setDbCuein($cueIn);
+ $row->setDbCueout($cueOut);
+ $row->setDBCliplength($cliplength);
+
+ } elseif (!is_null($cueIn)) {
+
+ $sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$oldCueOut}'";
+ $r = $this->con->query($sql);
+ if ($r->fetchColumn(0)) {
+ $errArray["error"] = "Can't set cue in to be larger than cue out.";
+
+ return $errArray;
+ }
+
+ $sql = "SELECT INTERVAL '{$oldCueOut}' - INTERVAL '{$cueIn}'";
+ $r = $this->con->query($sql);
+ $cliplength = $r->fetchColumn(0);
+
+ $row->setDbCuein($cueIn);
+ $row->setDBCliplength($cliplength);
+ } elseif (!is_null($cueOut)) {
+
+ if ($cueOut === "") {
+ $cueOut = $origLength;
+ }
+
+ $sql = "SELECT INTERVAL '{$cueOut}' < INTERVAL '{$oldCueIn}'";
+ $r = $this->con->query($sql);
+ if ($r->fetchColumn(0)) {
+ $errArray["error"] = "Can't set cue out to be smaller than cue in.";
+
+ return $errArray;
+ }
+
+ $sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
+ $r = $this->con->query($sql);
+ if ($r->fetchColumn(0)) {
+ $errArray["error"] = "Can't set cue out to be greater than file length.";
+
+ return $errArray;
+ }
+
+ $sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$oldCueIn}'";
+ $r = $this->con->query($sql);
+ $cliplength = $r->fetchColumn(0);
+
+ $row->setDbCueout($cueOut);
+ $row->setDBCliplength($cliplength);
+ }
+
+ $cliplength = $row->getDbCliplength();
+
+ $sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$cliplength}'";
+ $r = $this->con->query($sql);
+ if ($r->fetchColumn(0)) {
+ $fadeIn = $cliplength;
+ $row->setDbFadein($fadeIn);
+ }
+
+ $sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$cliplength}'";
+ $r = $this->con->query($sql);
+ if ($r->fetchColumn(0)) {
+ $fadeOut = $cliplength;
+ $row->setDbFadein($fadeOut);
+ }
+
+ $row->save($this->con);
+ $this->block->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
+ $this->block->save($this->con);
+
+ $this->con->commit();
+ } catch (Exception $e) {
+ $this->con->rollback();
+ throw $e;
+ }
+
+ return array("cliplength"=> $cliplength, "cueIn"=> $cueIn, "cueOut"=> $cueOut, "length"=> $this->getLength(),
+ "fadeIn"=> $fadeIn, "fadeOut"=> $fadeOut);
+ }
+
+ public function getAllPLMetaData()
+ {
+ $categories = $this->categories;
+ $md = array();
+
+ foreach ($categories as $key => $val) {
+ $method = 'get' . $val;
+ $md[$key] = $this->$method();
+ }
+
+ return $md;
+ }
+
+ public function getMetaData($category)
+ {
+ $cat = $this->categories[$category];
+ $method = 'get' . $cat;
+
+ return $this->$method();
+ }
+
+ public function setMetaData($category, $value)
+ {
+ $cat = $this->categories[$category];
+
+ $method = 'set' . $cat;
+ $this->$method($value);
+ }
+
+ public static function getBlockCount()
+ {
+ global $CC_CONFIG;
+ $con = Propel::getConnection();
+ $sql = 'SELECT count(*) as cnt FROM '.$CC_CONFIG["playListTable"];
+
+ return $con->query($sql)->fetchColumn(0);
+ }
+
+ /**
+ * Delete the file from all blocks.
+ * @param string $p_fileId
+ */
+ public static function DeleteFileFromAllBlocks($p_fileId)
+ {
+ CcBlockcontentsQuery::create()->filterByDbFileId($p_fileId)->delete();
+ }
+
+ /**
+ * Delete blocks that match the ids..
+ * @param array $p_ids
+ */
+ public static function deleteBlocks($p_ids, $p_userId)
+ {
+ $leftOver = self::blocksNotOwnedByUser($p_ids, $p_userId);
+ if (count($leftOver) == 0) {
+ CcBlockQuery::create()->findPKs($p_ids)->delete();
+ } else {
+ throw new BlockNoPermissionException;
+ }
+ }
+
+ // This function returns that are not owen by $p_user_id among $p_ids
+ private static function blocksNotOwnedByUser($p_ids, $p_userId)
+ {
+ $ownedByUser = CcBlockQuery::create()->filterByDbCreatorId($p_userId)->find()->getData();
+ $selectedPls = $p_ids;
+ $ownedPls = array();
+ foreach ($ownedByUser as $pl) {
+ if (in_array($pl->getDbId(), $selectedPls)) {
+ $ownedPls[] = $pl->getDbId();
+ }
+ }
+
+ $leftOvers = array_diff($selectedPls, $ownedPls);
+ return $leftOvers;
+ }
+
+ /**
+ * Delete all files from block
+ */
+ public function deleteAllFilesFromBlock()
+ {
+ CcBlockcontentsQuery::create()->findByDbBlockId($this->id)->delete();
+ }
+
+ // smart block functions start
+ public function shuffleSmartBlock(){
+ // if it here that means it's static pl
+ $this->saveType("static");
+ $contents = CcBlockcontentsQuery::create()
+ ->filterByDbBlockId($this->id)
+ ->orderByDbPosition()
+ ->find();
+ $shuffledPos = range(0, count($contents)-1);
+ shuffle($shuffledPos);
+ foreach ($contents as $item) {
+ $item->setDbPosition(array_shift($shuffledPos));
+ $item->save();
+ }
+ return array("result"=>0);
+ }
+
+ public function saveType($p_blockType)
+ {
+ // saving dynamic/static flag
+ CcBlockQuery::create()->findPk($this->id)->setDbType($p_blockType)->save();
+ }
+
+ /**
+ * Saves smart block criteria
+ * @param array $p_criteria
+ */
+ public function saveSmartBlockCriteria($p_criteria)
+ {
+ $data = $this->organizeSmartPlyalistCriteria($p_criteria);
+ // things we need to check
+ // 1. limit value shouldn't be empty and has upperbound of 24 hrs
+ // 2. sp_criteria or sp_criteria_modifier shouldn't be 0
+ // 3. validate formate according to DB column type
+ $multiplier = 1;
+ $result = 0;
+ $errors = array();
+ $error = array();
+
+ // saving dynamic/static flag
+ $blockType = $data['etc']['sp_type'] == 0 ? 'static':'dynamic';
+ $this->saveType($blockType);
+
+ // validation start
+ if ($data['etc']['sp_limit_options'] == 'hours') {
+ $multiplier = 60;
+ }
+ if ($data['etc']['sp_limit_options'] == 'hours' || $data['etc']['sp_limit_options'] == 'mins') {
+ if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) {
+ $error[] = "Limit cannot be empty or smaller than 0";
+ } else {
+ $mins = $data['etc']['sp_limit_value'] * $multiplier;
+ if ($mins > 14400) {
+ $error[] = "Limit cannot be more than 24 hrs";
+ }
+ }
+ } else {
+ if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) {
+ $error[] = "Limit cannot be empty or smaller than 0";
+ } else if (floatval($data['etc']['sp_limit_value']) < 1) {
+ $error[] = "The value should be an integer";
+ }
+ }
+
+ if (count($error) > 0){
+ $errors[] = array("element"=>"sp_limit_value", "msg"=>$error);
+ }
+
+ foreach ($data['criteria'] as $key=>$d){
+ $error = array();
+ $column = CcFilesPeer::getTableMap()->getColumnByPhpName(self::$criteria2PeerMap[$d['sp_criteria_field']]);
+ // check for not selected select box
+ if ($d['sp_criteria_field'] == "0" || $d['sp_criteria_modifier'] == "0"){
+ $error[] = "You must select Criteria and Modifier";
+ } else {
+ // validation on type of column
+ if ($d['sp_criteria_field'] == 'length') {
+ if (!preg_match("/(\d{2}):(\d{2}):(\d{2})/", $d['sp_criteria_value'])) {
+ $error[] = "'Length' should be in '00:00:00' format";
+ }
+ } else if ($column->getType() == PropelColumnTypes::TIMESTAMP) {
+ if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_value'])) {
+ $error[] = "The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00";
+ } else if (!Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_value'])) {
+ // check for if it is in valid range( 1753-01-01 ~ 12/31/9999 )
+ $error[] = "$d[sp_criteria_value] is not a valid date/time string";
+ }
+
+ if (isset($d['sp_criteria_extra'])) {
+ if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_extra'])) {
+ $error[] = "The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00";
+ } else if (!Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_extra'])) {
+ // check for if it is in valid range( 1753-01-01 ~ 12/31/9999 )
+ $error[] = "$d[sp_criteria_extra] is not a valid date/time string";
+ }
+ }
+ } else if ($column->getType() == PropelColumnTypes::INTEGER) {
+ if (!is_numeric($d['sp_criteria_value'])) {
+ $error[] = "The value has to be numeric";
+ }
+ // length check
+ if (intval($d['sp_criteria_value']) >= pow(2,31)) {
+ $error[] = "The value should be less then 2147483648";
+ }
+ } else if ($column->getType() == PropelColumnTypes::VARCHAR) {
+ if (strlen($d['sp_criteria_value']) > $column->getSize()) {
+ $error[] = "The value should be less ".$column->getSize()." characters";
+ }
+ }
+ }
+
+ if ($d['sp_criteria_value'] == "") {
+ $error[] = "Value cannot be empty";
+ }
+ if(count($error) > 0){
+ $errors[] = array("element"=>"sp_criteria_field_".$key, "msg"=>$error);
+ }
+ }
+ $result = count($errors) > 0 ? 1 :0;
+ if ($result == 0) {
+ $this->storeCriteriaIntoDb($data);
+ }
+
+ //get number of files that meet the criteria
+ $files = $this->getListofFilesMeetCriteria();
+
+ return array("result"=>$result, "errors"=>$errors, "poolCount"=>$files["count"]);
+ }
+
+ public function storeCriteriaIntoDb($p_criteriaData){
+ // delete criteria under $p_blockId
+ CcBlockcriteriaQuery::create()->findByDbBlockId($this->id)->delete();
+
+ foreach( $p_criteriaData['criteria'] as $d){
+ $qry = new CcBlockcriteria();
+ $qry->setDbCriteria($d['sp_criteria_field'])
+ ->setDbModifier($d['sp_criteria_modifier'])
+ ->setDbValue($d['sp_criteria_value'])
+ ->setDbBlockId($this->id);
+
+ if (isset($d['sp_criteria_extra'])) {
+ $qry->setDbExtra($d['sp_criteria_extra']);
+ }
+ $qry->save();
+ }
+
+ // insert limit info
+ $qry = new CcBlockcriteria();
+ $qry->setDbCriteria("limit")
+ ->setDbModifier($p_criteriaData['etc']['sp_limit_options'])
+ ->setDbValue($p_criteriaData['etc']['sp_limit_value'])
+ ->setDbBlockId($this->id)
+ ->save();
+ }
+
+ /**
+ * generate list of tracks. This function saves creiteria and generate
+ * tracks.
+ * @param array $p_criteria
+ */
+ public function generateSmartBlock($p_criteria, $returnList=false)
+ {
+ $result = $this->saveSmartBlockCriteria($p_criteria);
+ if ($result['result'] != 0) {
+ return $result;
+ } else {
+ $insertList = $this->getListOfFilesUnderLimit();
+ $this->deleteAllFilesFromBlock();
+ $this->addAudioClips(array_keys($insertList));
+ return array("result"=>0);
+ }
+ }
+
+ public function getListOfFilesUnderLimit()
+ {
+ $info = $this->getListofFilesMeetCriteria();
+ $files = $info['files'];
+ $limit = $info['limit'];
+
+ $insertList = array();
+ $totalTime = 0;
+
+ // this moves the pointer to the first element in the collection
+ $files->getFirst();
+ $iterator = $files->getIterator();
+ while ($iterator->valid() && $totalTime < $limit['time']) {
+ $id = $iterator->current()->getDbId();
+ $length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength());
+ $insertList[$id] = $length;
+ $totalTime += $length;
+ if ( !is_null($limit['items']) && $limit['items'] == count($insertList)) {
+ break;
+ }
+
+ $iterator->next();
+ }
+ return $insertList;
+ }
+
+ // this function return list of propel object
+ public function getListofFilesMeetCriteria()
+ {
+ $out = CcBlockcriteriaQuery::create()->findByDbBlockId($this->id);
+ $storedCrit = array();
+ foreach ($out as $crit) {
+ $criteria = $crit->getDbCriteria();
+ $modifier = $crit->getDbModifier();
+ $value = $crit->getDbValue();
+ $extra = $crit->getDbExtra();
+
+ if($criteria == "limit"){
+ $storedCrit["limit"] = array("value"=>$value, "modifier"=>$modifier);
+ }else{
+ $storedCrit["crit"][] = array("criteria"=>$criteria, "value"=>$value, "modifier"=>$modifier, "extra"=>$extra);
+ }
+ }
+
+ $qry = CcFilesQuery::create();
+
+ if (isset($storedCrit["crit"])) {
+ foreach ($storedCrit["crit"] as $criteria) {
+ $spCriteriaPhpName = self::$criteria2PeerMap[$criteria['criteria']];
+ $spCriteria = $criteria['criteria'];
+
+ $spCriteriaModifier = $criteria['modifier'];
+ $spCriteriaValue = $criteria['value'];
+ if ($spCriteriaModifier == "starts with") {
+ $spCriteriaValue = "$spCriteriaValue%";
+ } else if ($spCriteriaModifier == "ends with") {
+ $spCriteriaValue = "%$spCriteriaValue";
+ } else if ($spCriteriaModifier == "contains" || $spCriteriaModifier == "does not contain") {
+ $spCriteriaValue = "%$spCriteriaValue%";
+ } else if ($spCriteriaModifier == "is in the range") {
+ $spCriteriaValue = "$spCriteria > '$spCriteriaValue' AND $spCriteria < '$criteria[extra]'";
+ }
+ $spCriteriaModifier = self::$modifier2CriteriaMap[$spCriteriaModifier];
+ try{
+ $qry->filterBy($spCriteriaPhpName, $spCriteriaValue, $spCriteriaModifier);
+ $qry->addAscendingOrderByColumn('random()');
+ }catch (Exception $e){
+ Logging::log($e);
+ }
+ }
+ }
+ // construct limit restriction
+ $limits = array();
+ if (isset($storedCrit['limit'])) {
+ if ($storedCrit['limit']['modifier'] == "items") {
+ $limits['time'] = 1440 * 60;
+ $limits['items'] = $storedCrit['limit']['value'];
+ } else {
+ $limits['time'] = $storedCrit['limit']['modifier'] == "hours" ? intval($storedCrit['limit']['value']) * 60 * 60 : intval($storedCrit['limit']['value'] * 60);
+ $limits['items'] = null;
+ }
+ }
+ try{
+ $out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find();
+ return array("files"=>$out, "limit"=>$limits, "count"=>$out->count());
+ }catch(Exception $e){
+ Logging::log($e);
+ }
+
+ }
+
+ private static function organizeSmartPlyalistCriteria($p_criteria)
+ {
+ $fieldNames = array('sp_criteria_field', 'sp_criteria_modifier', 'sp_criteria_value', 'sp_criteria_extra');
+ $output = array();
+ foreach ($p_criteria as $ele) {
+ $index = strrpos($ele['name'], '_');
+ $fieldName = substr($ele['name'], 0, $index);
+ if (in_array($fieldName, $fieldNames)) {
+ $rowNum = intval(substr($ele['name'], $index+1));
+ $output['criteria'][$rowNum][$fieldName] = trim($ele['value']);
+ }else{
+ $output['etc'][$ele['name']] = $ele['value'];
+ }
+ }
+
+ return $output;
+ }
+ // smart block functions end
+}
+
+class BlockNotFoundException extends Exception {}
+class BlockNoPermissionException extends Exception {}
+class BlockOutDatedException extends Exception {}
+class BlockDyanmicException extends Exception {}
diff --git a/airtime_mvc/application/models/Playlist.php b/airtime_mvc/application/models/Playlist.php
index 8e9d5055f..cb84db467 100644
--- a/airtime_mvc/application/models/Playlist.php
+++ b/airtime_mvc/application/models/Playlist.php
@@ -45,48 +45,6 @@ class Application_Model_Playlist
"dc:description" => "Description",
"dcterms:extent" => "Length"
);
-
- private static $modifier2CriteriaMap = array(
- "contains" => Criteria::ILIKE,
- "does not contain" => Criteria::NOT_ILIKE,
- "is" => Criteria::EQUAL,
- "is not" => Criteria::NOT_EQUAL,
- "starts with" => Criteria::ILIKE,
- "ends with" => Criteria::ILIKE,
- "is greater than" => Criteria::GREATER_THAN,
- "is less than" => Criteria::LESS_THAN,
- "is in the range" => Criteria::CUSTOM);
-
- private static $criteria2PeerMap = array(
- 0 => "Select criteria",
- "album_title" => "DbAlbumTitle",
- "artist_name" => "DbArtistName",
- "bit_rate" => "DbBitRate",
- "bpm" => "DbBpm",
- "comments" => "DbComments",
- "composer" => "DbComposer",
- "conductor" => "DbConductor",
- "utime" => "DbUtime",
- "mtime" => "DbMtime",
- "lptime" => "DbLPtime",
- "disc_number" => "DbDiscNumber",
- "genre" => "DbGenre",
- "isrc_number" => "DbIsrcNumber",
- "label" => "DbLabel",
- "language" => "DbLanguage",
- "length" => "DbLength",
- "lyricist" => "DbLyricist",
- "mood" => "DbMood",
- "name" => "DbName",
- "orchestra" => "DbOrchestra",
- "radio_station_name" => "DbRadioStation",
- "rating" => "DbRating",
- "sample_rate" => "DbSampleRate",
- "track_title" => "DbTrackTitle",
- "track_num" => "DbTrackNum",
- "year" => "DbYear"
- );
-
public function __construct($id=null, $con=null)
{
@@ -214,9 +172,9 @@ class Application_Model_Playlist
$files[$i] = $row->toArray(BasePeer::TYPE_FIELDNAME, true, true);
- $clipSec = Application_Model_Playlist::playlistTimeToSeconds($files[$i]['cliplength']);
+ $clipSec = Application_Common_DateHelper::playlistTimeToSeconds($files[$i]['cliplength']);
$offset += $clipSec;
- $offset_cliplength = Application_Model_Playlist::secondsToPlaylistTime($offset);
+ $offset_cliplength = Application_Common_DateHelper::secondsToPlaylistTime($offset);
//format the length for UI.
$formatter = new LengthFormatter($files[$i]['cliplength']);
@@ -297,14 +255,6 @@ class Application_Model_Playlist
throw new Exception("trying to add a file that does not exist.");
}
}
-
- public function isStatic(){
- if ($this->pl->getDbType() == "static") {
- return true;
- } else {
- return false;
- }
- }
/*
* @param array $p_items
@@ -781,58 +731,6 @@ class Application_Model_Playlist
$this->$method($value);
}
- /**
- * This function is used for calculations! Don't modify for display purposes!
- *
- * Convert playlist time value to float seconds
- *
- * @param string $plt
- * playlist interval value (HH:mm:ss.dddddd)
- * @return int
- * seconds
- */
- public static function playlistTimeToSeconds($plt)
- {
- $arr = preg_split('/:/', $plt);
- if (isset($arr[2])) {
- return (intval($arr[0])*60 + intval($arr[1]))*60 + floatval($arr[2]);
- }
- if (isset($arr[1])) {
- return intval($arr[0])*60 + floatval($arr[1]);
- }
-
- return floatval($arr[0]);
- }
-
-
- /**
- * This function is used for calculations! Don't modify for display purposes!
- *
- * Convert float seconds value to playlist time format
- *
- * @param float $seconds
- * @return string
- * interval in playlist time format (HH:mm:ss.d)
- */
- public static function secondsToPlaylistTime($p_seconds)
- {
- $info = explode('.', $p_seconds);
- $seconds = $info[0];
- if (!isset($info[1])) {
- $milliStr = 0;
- } else {
- $milliStr = $info[1];
- }
- $hours = floor($seconds / 3600);
- $seconds -= $hours * 3600;
- $minutes = floor($seconds / 60);
- $seconds -= $minutes * 60;
-
- $res = sprintf("%02d:%02d:%02d.%s", $hours, $minutes, $seconds, $milliStr);
-
- return $res;
- }
-
public static function getPlaylistCount()
{
global $CC_CONFIG;
@@ -888,291 +786,6 @@ class Application_Model_Playlist
{
CcPlaylistcontentsQuery::create()->findByDbPlaylistId($this->id)->delete();
}
-
-
- // smart playlist functions start
- public function shuffleSmartPlaylist(){
- // if it here that means it's static pl
- $this->saveType("static");
- $contents = CcPlaylistcontentsQuery::create()
- ->filterByDbPlaylistId($this->id)
- ->orderByDbPosition()
- ->find();
- $shuffledPos = range(0, count($contents)-1);
- shuffle($shuffledPos);
- $temp = new CcPlaylist();
- foreach ($contents as $item) {
- $item->setDbPosition(array_shift($shuffledPos));
- $item->save();
- }
- return array("result"=>0);
- }
-
- public function saveType($p_playlistType)
- {
- // saving dynamic/static flag
- CcPlaylistQuery::create()->findPk($this->id)->setDbType($p_playlistType)->save();
- }
-
- /**
- * Saves smart playlist criteria
- * @param array $p_criteria
- */
- public function saveSmartPlaylistCriteria($p_criteria)
- {
- $data = $this->organizeSmartPlyalistCriteria($p_criteria);
- // things we need to check
- // 1. limit value shouldn't be empty and has upperbound of 24 hrs
- // 2. sp_criteria or sp_criteria_modifier shouldn't be 0
- // 3. validate formate according to DB column type
- $multiplier = 1;
- $result = 0;
- $errors = array();
- $error = array();
-
- // saving dynamic/static flag
- $playlistType = $data['etc']['sp_type'] == 0 ? 'static':'dynamic';
- $this->saveType($playlistType);
-
- // validation start
- if ($data['etc']['sp_limit_options'] == 'hours') {
- $multiplier = 60;
- }
- if ($data['etc']['sp_limit_options'] == 'hours' || $data['etc']['sp_limit_options'] == 'mins') {
- if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) {
- $error[] = "Limit cannot be empty or smaller than 0";
- } else {
- $mins = $data['etc']['sp_limit_value'] * $multiplier;
- if ($mins > 14400) {
- $error[] = "Limit cannot be more than 24 hrs";
- }
- }
- } else {
- if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) {
- $error[] = "Limit cannot be empty or smaller than 0";
- } else if (floatval($data['etc']['sp_limit_value']) < 1) {
- $error[] = "The value should be an integer";
- }
- }
-
- if (count($error) > 0){
- $errors[] = array("element"=>"sp_limit_value", "msg"=>$error);
- }
-
- foreach ($data['criteria'] as $key=>$d){
- $error = array();
- $column = CcFilesPeer::getTableMap()->getColumnByPhpName(self::$criteria2PeerMap[$d['sp_criteria_field']]);
- // check for not selected select box
- if ($d['sp_criteria_field'] == "0" || $d['sp_criteria_modifier'] == "0"){
- $error[] = "You must select Criteria and Modifier";
- } else {
- // validation on type of column
- if ($d['sp_criteria_field'] == 'length') {
- if (!preg_match("/(\d{2}):(\d{2}):(\d{2})/", $d['sp_criteria_value'])) {
- $error[] = "'Length' should be in '00:00:00' format";
- }
- } else if ($column->getType() == PropelColumnTypes::TIMESTAMP) {
- if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_value'])) {
- $error[] = "The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00";
- } else if (!Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_value'])) {
- // check for if it is in valid range( 1753-01-01 ~ 12/31/9999 )
- $error[] = "$d[sp_criteria_value] is not a valid date/time string";
- }
-
- if (isset($d['sp_criteria_extra'])) {
- if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_extra'])) {
- $error[] = "The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00";
- } else if (!Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_extra'])) {
- // check for if it is in valid range( 1753-01-01 ~ 12/31/9999 )
- $error[] = "$d[sp_criteria_extra] is not a valid date/time string";
- }
- }
- } else if ($column->getType() == PropelColumnTypes::INTEGER) {
- if (!is_numeric($d['sp_criteria_value'])) {
- $error[] = "The value has to be numeric";
- }
- // length check
- if (intval($d['sp_criteria_value']) >= pow(2,31)) {
- $error[] = "The value should be less then 2147483648";
- }
- } else if ($column->getType() == PropelColumnTypes::VARCHAR) {
- if (strlen($d['sp_criteria_value']) > $column->getSize()) {
- $error[] = "The value should be less ".$column->getSize()." characters";
- }
- }
- }
-
- if ($d['sp_criteria_value'] == "") {
- $error[] = "Value cannot be empty";
- }
- if(count($error) > 0){
- $errors[] = array("element"=>"sp_criteria_field_".$key, "msg"=>$error);
- }
- }
- $result = count($errors) > 0 ? 1 :0;
- if ($result == 0) {
- $this->storeCriteriaIntoDb($data);
- }
-
- //get number of files that meet the criteria
- $files = $this->getListofFilesMeetCriteria();
-
- return array("result"=>$result, "errors"=>$errors, "poolCount"=>$files["count"]);
- }
-
- public function storeCriteriaIntoDb($p_criteriaData){
- // delete criteria under $p_playlistId
- CcPlaylistcriteriaQuery::create()->findByDbPlaylistId($this->id)->delete();
-
- foreach( $p_criteriaData['criteria'] as $d){
- $qry = new CcPlaylistcriteria();
- $qry->setDbCriteria($d['sp_criteria_field'])
- ->setDbModifier($d['sp_criteria_modifier'])
- ->setDbValue($d['sp_criteria_value'])
- ->setDbPlaylistId($this->id);
-
- if (isset($d['sp_criteria_extra'])) {
- $qry->setDbExtra($d['sp_criteria_extra']);
- }
- $qry->save();
- }
-
- // insert limit info
- $qry = new CcPlaylistcriteria();
- $qry->setDbCriteria("limit")
- ->setDbModifier($p_criteriaData['etc']['sp_limit_options'])
- ->setDbValue($p_criteriaData['etc']['sp_limit_value'])
- ->setDbPlaylistId($this->id)
- ->save();
- }
-
- /**
- * generate list of tracks. This function saves creiteria and generate
- * tracks.
- * @param array $p_criteria
- */
- public function generateSmartPlaylist($p_criteria, $returnList=false)
- {
- $result = $this->saveSmartPlaylistCriteria($p_criteria);
- if ($result['result'] != 0) {
- return $result;
- } else {
- $insertList = $this->getListOfFilesUnderLimit();
- $this->deleteAllFilesFromPlaylist();
- $this->addAudioClips(array_keys($insertList));
- return array("result"=>0);
- }
- }
-
- public function getListOfFilesUnderLimit()
- {
- $info = $this->getListofFilesMeetCriteria();
- $files = $info['files'];
- $limit = $info['limit'];
-
- $insertList = array();
- $totalTime = 0;
-
- // this moves the pointer to the first element in the collection
- $files->getFirst();
- $iterator = $files->getIterator();
- while ($iterator->valid() && $totalTime < $limit['time']) {
- $id = $iterator->current()->getDbId();
- $length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength());
- $insertList[$id] = $length;
- $totalTime += $length;
- if ( !is_null($limit['items']) && $limit['items'] == count($insertList)) {
- break;
- }
-
- $iterator->next();
- }
- return $insertList;
- }
-
- // this function return list of propel object
- public function getListofFilesMeetCriteria()
- {
- $out = CcPlaylistcriteriaQuery::create()->findByDbPlaylistId($this->id);
- $storedCrit = array();
- foreach ($out as $crit) {
- $criteria = $crit->getDbCriteria();
- $modifier = $crit->getDbModifier();
- $value = $crit->getDbValue();
- $extra = $crit->getDbExtra();
-
- if($criteria == "limit"){
- $storedCrit["limit"] = array("value"=>$value, "modifier"=>$modifier);
- }else{
- $storedCrit["crit"][] = array("criteria"=>$criteria, "value"=>$value, "modifier"=>$modifier, "extra"=>$extra);
- }
- }
-
- $qry = CcFilesQuery::create();
-
- if (isset($storedCrit["crit"])) {
- foreach ($storedCrit["crit"] as $criteria) {
- $spCriteriaPhpName = self::$criteria2PeerMap[$criteria['criteria']];
- $spCriteria = $criteria['criteria'];
-
- $spCriteriaModifier = $criteria['modifier'];
- $spCriteriaValue = $criteria['value'];
- if ($spCriteriaModifier == "starts with") {
- $spCriteriaValue = "$spCriteriaValue%";
- } else if ($spCriteriaModifier == "ends with") {
- $spCriteriaValue = "%$spCriteriaValue";
- } else if ($spCriteriaModifier == "contains" || $spCriteriaModifier == "does not contain") {
- $spCriteriaValue = "%$spCriteriaValue%";
- } else if ($spCriteriaModifier == "is in the range") {
- $spCriteriaValue = "$spCriteria > '$spCriteriaValue' AND $spCriteria < '$criteria[extra]'";
- }
- $spCriteriaModifier = self::$modifier2CriteriaMap[$spCriteriaModifier];
- try{
- $qry->filterBy($spCriteriaPhpName, $spCriteriaValue, $spCriteriaModifier);
- $qry->addAscendingOrderByColumn('random()');
- }catch (Exception $e){
- Logging::log($e);
- }
- }
- }
- // construct limit restriction
- $limits = array();
- if (isset($storedCrit['limit'])) {
- if ($storedCrit['limit']['modifier'] == "items") {
- $limits['time'] = 1440 * 60;
- $limits['items'] = $storedCrit['limit']['value'];
- } else {
- $limits['time'] = $storedCrit['limit']['modifier'] == "hours" ? intval($storedCrit['limit']['value']) * 60 * 60 : intval($storedCrit['limit']['value'] * 60);
- $limits['items'] = null;
- }
- }
- try{
- $out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find();
- return array("files"=>$out, "limit"=>$limits, "count"=>$out->count());
- }catch(Exception $e){
- Logging::log($e);
- }
-
- }
-
- private static function organizeSmartPlyalistCriteria($p_criteria)
- {
- $fieldNames = array('sp_criteria_field', 'sp_criteria_modifier', 'sp_criteria_value', 'sp_criteria_extra');
- $output = array();
- foreach ($p_criteria as $ele) {
- $index = strrpos($ele['name'], '_');
- $fieldName = substr($ele['name'], 0, $index);
- if (in_array($fieldName, $fieldNames)) {
- $rowNum = intval(substr($ele['name'], $index+1));
- $output['criteria'][$rowNum][$fieldName] = trim($ele['value']);
- }else{
- $output['etc'][$ele['name']] = $ele['value'];
- }
- }
-
- return $output;
- }
- // smart playlist functions end
} // class Playlist
diff --git a/airtime_mvc/application/models/airtime/CcBlock.php b/airtime_mvc/application/models/airtime/CcBlock.php
new file mode 100644
index 000000000..447433cd1
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/CcBlock.php
@@ -0,0 +1,18 @@
+fadein = $dt->format('H:i:s.u');
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN;
+
+ return $this;
+ } // setDbFadein()
+
+ /**
+ *
+ * @param String in format SS.uuuuuu, Datetime, or DateTime accepted string.
+ *
+ * @return CcPlaylistcontents The current object (for fluent API support)
+ */
+ public function setDbFadeout($v)
+ {
+ if ($v instanceof DateTime) {
+ $dt = $v;
+ }
+ else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) {
+ $dt = DateTime::createFromFormat("s.u", $v);
+ }
+ else {
+ try {
+ $dt = new DateTime($v);
+ } catch (Exception $x) {
+ throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
+ }
+ }
+
+ $this->fadeout = $dt->format('H:i:s.u');
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT;
+
+ return $this;
+ } // setDbFadeout()
+
+} // CcBlockcontents
diff --git a/airtime_mvc/application/models/airtime/CcBlockcontentsPeer.php b/airtime_mvc/application/models/airtime/CcBlockcontentsPeer.php
new file mode 100644
index 000000000..024cb0523
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/CcBlockcontentsPeer.php
@@ -0,0 +1,18 @@
+setName('cc_block');
+ $this->setPhpName('CcBlock');
+ $this->setClassname('CcBlock');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_block_id_seq');
+ // columns
+ $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
+ $this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', false, 6, null);
+ $this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', false, 6, null);
+ $this->addForeignKey('CREATOR_ID', 'DbCreatorId', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
+ $this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null);
+ $this->addColumn('LENGTH', 'DbLength', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('TYPE', 'DbType', 'VARCHAR', false, 7, 'static');
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), null, null);
+ $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);
+ } // buildRelations()
+
+ /**
+ *
+ * Gets the list of behaviors registered for this table
+ *
+ * @return array Associative array (name => parameters) of behaviors
+ */
+ public function getBehaviors()
+ {
+ return array(
+ 'aggregate_column' => array('name' => 'length', 'expression' => 'SUM(cliplength)', 'foreign_table' => 'cc_blockcontents', ),
+ );
+ } // getBehaviors()
+
+} // CcBlockTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcBlockcontentsTableMap.php b/airtime_mvc/application/models/airtime/map/CcBlockcontentsTableMap.php
new file mode 100644
index 000000000..b366a1adf
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/map/CcBlockcontentsTableMap.php
@@ -0,0 +1,75 @@
+setName('cc_blockcontents');
+ $this->setPhpName('CcBlockcontents');
+ $this->setClassname('CcBlockcontents');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_blockcontents_id_seq');
+ // columns
+ $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
+ $this->addForeignKey('BLOCK_ID', 'DbBlockId', 'INTEGER', 'cc_block', 'ID', false, null, null);
+ $this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
+ $this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null);
+ $this->addColumn('CLIPLENGTH', 'DbCliplength', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('CUEIN', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('CUEOUT', 'DbCueout', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('FADEIN', 'DbFadein', 'TIME', false, null, '00:00:00');
+ $this->addColumn('FADEOUT', 'DbFadeout', 'TIME', false, null, '00:00:00');
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
+ $this->addRelation('CcBlock', 'CcBlock', RelationMap::MANY_TO_ONE, array('block_id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+ /**
+ *
+ * Gets the list of behaviors registered for this table
+ *
+ * @return array Associative array (name => parameters) of behaviors
+ */
+ public function getBehaviors()
+ {
+ return array(
+ 'aggregate_column_relation' => array('foreign_table' => 'cc_block', 'update_method' => 'updateDbLength', ),
+ );
+ } // getBehaviors()
+
+} // CcBlockcontentsTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcBlockcriteriaTableMap.php b/airtime_mvc/application/models/airtime/map/CcBlockcriteriaTableMap.php
new file mode 100644
index 000000000..6968366fc
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/map/CcBlockcriteriaTableMap.php
@@ -0,0 +1,58 @@
+setName('cc_blockcriteria');
+ $this->setPhpName('CcBlockcriteria');
+ $this->setClassname('CcBlockcriteria');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_blockcriteria_id_seq');
+ // columns
+ $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('CRITERIA', 'DbCriteria', 'VARCHAR', true, 16, null);
+ $this->addColumn('MODIFIER', 'DbModifier', 'VARCHAR', true, 16, null);
+ $this->addColumn('VALUE', 'DbValue', 'VARCHAR', true, 512, null);
+ $this->addColumn('EXTRA', 'DbExtra', 'VARCHAR', false, 512, null);
+ $this->addForeignKey('BLOCK_ID', 'DbBlockId', 'INTEGER', 'cc_block', 'ID', true, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcBlock', 'CcBlock', RelationMap::MANY_TO_ONE, array('block_id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // CcBlockcriteriaTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php
index 7ba8d3cb4..3ce479c82 100644
--- a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php
@@ -114,6 +114,7 @@ class CcFilesTableMap extends TableMap {
$this->addRelation('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), null, null);
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
$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);
} // buildRelations()
diff --git a/airtime_mvc/application/models/airtime/map/CcPlaylistTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlaylistTableMap.php
index a582d11cf..c976efcde 100644
--- a/airtime_mvc/application/models/airtime/map/CcPlaylistTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcPlaylistTableMap.php
@@ -56,7 +56,6 @@ class CcPlaylistTableMap extends TableMap {
{
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), null, null);
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'playlist_id', ), 'CASCADE', null);
- $this->addRelation('CcPlaylistcriteria', 'CcPlaylistcriteria', RelationMap::ONE_TO_MANY, array('id' => 'playlist_id', ), 'CASCADE', null);
} // buildRelations()
/**
diff --git a/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php
index c8a01608a..936475187 100644
--- a/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php
@@ -41,6 +41,7 @@ class CcPlaylistcontentsTableMap extends TableMap {
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', 'cc_playlist', 'ID', false, null, null);
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
+ $this->addForeignKey('BLOCK_ID', 'DbBlockId', 'INTEGER', 'cc_block', 'ID', false, null, null);
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null);
$this->addColumn('CLIPLENGTH', 'DbCliplength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('CUEIN', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
@@ -56,6 +57,7 @@ class CcPlaylistcontentsTableMap extends TableMap {
public function buildRelations()
{
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
+ $this->addRelation('CcBlock', 'CcBlock', RelationMap::MANY_TO_ONE, array('block_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::MANY_TO_ONE, array('playlist_id' => 'id', ), 'CASCADE', null);
} // buildRelations()
diff --git a/airtime_mvc/application/models/airtime/map/CcPlaylistcriteriaTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlaylistcriteriaTableMap.php
index 05e10ac37..85e71d32f 100644
--- a/airtime_mvc/application/models/airtime/map/CcPlaylistcriteriaTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcPlaylistcriteriaTableMap.php
@@ -44,6 +44,7 @@ class CcPlaylistcriteriaTableMap extends TableMap {
$this->addColumn('VALUE', 'DbValue', 'VARCHAR', true, 512, null);
$this->addColumn('EXTRA', 'DbExtra', 'VARCHAR', false, 512, null);
$this->addForeignKey('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', 'cc_playlist', 'ID', true, null, null);
+ $this->addColumn('SET_NUMBER', 'DbSetNumber', 'INTEGER', true, null, null);
// validators
} // initialize()
diff --git a/airtime_mvc/application/models/airtime/map/CcSectionTableMap.php b/airtime_mvc/application/models/airtime/map/CcSectionTableMap.php
new file mode 100644
index 000000000..3fb493083
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/map/CcSectionTableMap.php
@@ -0,0 +1,76 @@
+setName('cc_section');
+ $this->setPhpName('CcSection');
+ $this->setClassname('CcSection');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_section_id_seq');
+ // columns
+ $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
+ $this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', false, 6, null);
+ $this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', false, 6, null);
+ $this->addForeignKey('CREATOR_ID', 'DbCreatorId', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
+ $this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null);
+ $this->addColumn('LENGTH', 'DbLength', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('TYPE', 'DbType', 'VARCHAR', false, 7, 'static');
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), null, null);
+ $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'section_id', ), 'CASCADE', null);
+ $this->addRelation('CcSectioncontents', 'CcSectioncontents', RelationMap::ONE_TO_MANY, array('id' => 'section_id', ), 'CASCADE', null);
+ $this->addRelation('CcSectioncriteria', 'CcSectioncriteria', RelationMap::ONE_TO_MANY, array('id' => 'section_id', ), 'CASCADE', null);
+ } // buildRelations()
+
+ /**
+ *
+ * Gets the list of behaviors registered for this table
+ *
+ * @return array Associative array (name => parameters) of behaviors
+ */
+ public function getBehaviors()
+ {
+ return array(
+ 'aggregate_column' => array('name' => 'length', 'expression' => 'SUM(cliplength)', 'foreign_table' => 'cc_sectioncontents', ),
+ );
+ } // getBehaviors()
+
+} // CcSectionTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcSectioncontentsTableMap.php b/airtime_mvc/application/models/airtime/map/CcSectioncontentsTableMap.php
new file mode 100644
index 000000000..1d4382091
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/map/CcSectioncontentsTableMap.php
@@ -0,0 +1,75 @@
+setName('cc_sectioncontents');
+ $this->setPhpName('CcSectioncontents');
+ $this->setClassname('CcSectioncontents');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_sectioncontents_id_seq');
+ // columns
+ $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
+ $this->addForeignKey('SECTION_ID', 'DbSectionId', 'INTEGER', 'cc_section', 'ID', false, null, null);
+ $this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
+ $this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null);
+ $this->addColumn('CLIPLENGTH', 'DbCliplength', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('CUEIN', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('CUEOUT', 'DbCueout', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('FADEIN', 'DbFadein', 'TIME', false, null, '00:00:00');
+ $this->addColumn('FADEOUT', 'DbFadeout', 'TIME', false, null, '00:00:00');
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
+ $this->addRelation('CcSection', 'CcSection', RelationMap::MANY_TO_ONE, array('section_id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+ /**
+ *
+ * Gets the list of behaviors registered for this table
+ *
+ * @return array Associative array (name => parameters) of behaviors
+ */
+ public function getBehaviors()
+ {
+ return array(
+ 'aggregate_column_relation' => array('foreign_table' => 'cc_section', 'update_method' => 'updateDbLength', ),
+ );
+ } // getBehaviors()
+
+} // CcSectioncontentsTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcSectioncriteriaTableMap.php b/airtime_mvc/application/models/airtime/map/CcSectioncriteriaTableMap.php
new file mode 100644
index 000000000..20c30d56e
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/map/CcSectioncriteriaTableMap.php
@@ -0,0 +1,58 @@
+setName('cc_sectioncriteria');
+ $this->setPhpName('CcSectioncriteria');
+ $this->setClassname('CcSectioncriteria');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_sectioncriteria_id_seq');
+ // columns
+ $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('CRITERIA', 'DbCriteria', 'VARCHAR', true, 16, null);
+ $this->addColumn('MODIFIER', 'DbModifier', 'VARCHAR', true, 16, null);
+ $this->addColumn('VALUE', 'DbValue', 'VARCHAR', true, 512, null);
+ $this->addColumn('EXTRA', 'DbExtra', 'VARCHAR', false, 512, null);
+ $this->addForeignKey('SECTION_ID', 'DbPlaylistId', 'INTEGER', 'cc_section', 'ID', true, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcSection', 'CcSection', RelationMap::MANY_TO_ONE, array('section_id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // CcSectioncriteriaTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php b/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php
index 7dc2bc6a7..82c70a590 100644
--- a/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php
@@ -64,6 +64,7 @@ class CcSubjsTableMap extends TableMap {
$this->addRelation('CcPerms', 'CcPerms', RelationMap::ONE_TO_MANY, array('id' => 'subj', ), 'CASCADE', null);
$this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'subjs_id', ), 'CASCADE', null);
$this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), null, null);
+ $this->addRelation('CcBlock', 'CcBlock', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), null, null);
$this->addRelation('CcPref', 'CcPref', RelationMap::ONE_TO_MANY, array('id' => 'subjid', ), 'CASCADE', null);
$this->addRelation('CcSess', 'CcSess', RelationMap::ONE_TO_MANY, array('id' => 'userid', ), 'CASCADE', null);
$this->addRelation('CcSubjsToken', 'CcSubjsToken', RelationMap::ONE_TO_MANY, array('id' => 'user_id', ), 'CASCADE', null);
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlock.php b/airtime_mvc/application/models/airtime/om/BaseCcBlock.php
new file mode 100644
index 000000000..f9c900c81
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlock.php
@@ -0,0 +1,1783 @@
+name = '';
+ $this->length = '00:00:00';
+ $this->type = 'static';
+ }
+
+ /**
+ * Initializes internal state of BaseCcBlock object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [name] column value.
+ *
+ * @return string
+ */
+ public function getDbName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [mtime] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw DateTime object will be returned.
+ * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getDbMtime($format = 'Y-m-d H:i:s')
+ {
+ if ($this->mtime === null) {
+ return null;
+ }
+
+
+
+ try {
+ $dt = new DateTime($this->mtime);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->mtime, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is TRUE, we return a DateTime object.
+ return $dt;
+ } elseif (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ } else {
+ return $dt->format($format);
+ }
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [utime] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw DateTime object will be returned.
+ * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getDbUtime($format = 'Y-m-d H:i:s')
+ {
+ if ($this->utime === null) {
+ return null;
+ }
+
+
+
+ try {
+ $dt = new DateTime($this->utime);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->utime, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is TRUE, we return a DateTime object.
+ return $dt;
+ } elseif (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ } else {
+ return $dt->format($format);
+ }
+ }
+
+ /**
+ * Get the [creator_id] column value.
+ *
+ * @return int
+ */
+ public function getDbCreatorId()
+ {
+ return $this->creator_id;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDbDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [length] column value.
+ *
+ * @return string
+ */
+ public function getDbLength()
+ {
+ return $this->length;
+ }
+
+ /**
+ * Get the [type] column value.
+ *
+ * @return string
+ */
+ public function getDbType()
+ {
+ return $this->type;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcBlockPeer::ID;
+ }
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [name] column.
+ *
+ * @param string $v new value
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbName($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v || $this->isNew()) {
+ $this->name = $v;
+ $this->modifiedColumns[] = CcBlockPeer::NAME;
+ }
+
+ return $this;
+ } // setDbName()
+
+ /**
+ * Sets the value of [mtime] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
+ * be treated as NULL for temporal objects.
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbMtime($v)
+ {
+ // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
+ // -- which is unexpected, to say the least.
+ if ($v === null || $v === '') {
+ $dt = null;
+ } elseif ($v instanceof DateTime) {
+ $dt = $v;
+ } else {
+ // some string/numeric value passed; we normalize that so that we can
+ // validate it.
+ try {
+ if (is_numeric($v)) { // if it's a unix timestamp
+ $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
+ // We have to explicitly specify and then change the time zone because of a
+ // DateTime bug: http://bugs.php.net/bug.php?id=43003
+ $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
+ } else {
+ $dt = new DateTime($v);
+ }
+ } catch (Exception $x) {
+ throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
+ }
+ }
+
+ if ( $this->mtime !== null || $dt !== null ) {
+ // (nested ifs are a little easier to read in this case)
+
+ $currNorm = ($this->mtime !== null && $tmpDt = new DateTime($this->mtime)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null;
+ $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null;
+
+ if ( ($currNorm !== $newNorm) // normalized values don't match
+ )
+ {
+ $this->mtime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
+ $this->modifiedColumns[] = CcBlockPeer::MTIME;
+ }
+ } // if either are not null
+
+ return $this;
+ } // setDbMtime()
+
+ /**
+ * Sets the value of [utime] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
+ * be treated as NULL for temporal objects.
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbUtime($v)
+ {
+ // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
+ // -- which is unexpected, to say the least.
+ if ($v === null || $v === '') {
+ $dt = null;
+ } elseif ($v instanceof DateTime) {
+ $dt = $v;
+ } else {
+ // some string/numeric value passed; we normalize that so that we can
+ // validate it.
+ try {
+ if (is_numeric($v)) { // if it's a unix timestamp
+ $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
+ // We have to explicitly specify and then change the time zone because of a
+ // DateTime bug: http://bugs.php.net/bug.php?id=43003
+ $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
+ } else {
+ $dt = new DateTime($v);
+ }
+ } catch (Exception $x) {
+ throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
+ }
+ }
+
+ if ( $this->utime !== null || $dt !== null ) {
+ // (nested ifs are a little easier to read in this case)
+
+ $currNorm = ($this->utime !== null && $tmpDt = new DateTime($this->utime)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null;
+ $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null;
+
+ if ( ($currNorm !== $newNorm) // normalized values don't match
+ )
+ {
+ $this->utime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
+ $this->modifiedColumns[] = CcBlockPeer::UTIME;
+ }
+ } // if either are not null
+
+ return $this;
+ } // setDbUtime()
+
+ /**
+ * Set the value of [creator_id] column.
+ *
+ * @param int $v new value
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbCreatorId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->creator_id !== $v) {
+ $this->creator_id = $v;
+ $this->modifiedColumns[] = CcBlockPeer::CREATOR_ID;
+ }
+
+ if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) {
+ $this->aCcSubjs = null;
+ }
+
+ return $this;
+ } // setDbCreatorId()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = CcBlockPeer::DESCRIPTION;
+ }
+
+ return $this;
+ } // setDbDescription()
+
+ /**
+ * Set the value of [length] column.
+ *
+ * @param string $v new value
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbLength($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->length !== $v || $this->isNew()) {
+ $this->length = $v;
+ $this->modifiedColumns[] = CcBlockPeer::LENGTH;
+ }
+
+ return $this;
+ } // setDbLength()
+
+ /**
+ * Set the value of [type] column.
+ *
+ * @param string $v new value
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbType($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->type !== $v || $this->isNew()) {
+ $this->type = $v;
+ $this->modifiedColumns[] = CcBlockPeer::TYPE;
+ }
+
+ return $this;
+ } // setDbType()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->name !== '') {
+ return false;
+ }
+
+ if ($this->length !== '00:00:00') {
+ return false;
+ }
+
+ if ($this->type !== 'static') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->mtime = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->utime = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->creator_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
+ $this->description = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->length = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
+ $this->type = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 8; // 8 = CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcBlock object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aCcSubjs !== null && $this->creator_id !== $this->aCcSubjs->getDbId()) {
+ $this->aCcSubjs = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = CcBlockPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aCcSubjs = null;
+ $this->collCcPlaylistcontentss = null;
+
+ $this->collCcBlockcontentss = null;
+
+ $this->collCcBlockcriterias = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ CcBlockQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey())
+ ->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ CcBlockPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcSubjs !== null) {
+ if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) {
+ $affectedRows += $this->aCcSubjs->save($con);
+ }
+ $this->setCcSubjs($this->aCcSubjs);
+ }
+
+ if ($this->isNew() ) {
+ $this->modifiedColumns[] = CcBlockPeer::ID;
+ }
+
+ // If this object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $criteria = $this->buildCriteria();
+ if ($criteria->keyContainsValue(CcBlockPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockPeer::ID.')');
+ }
+
+ $pk = BasePeer::doInsert($criteria, $con);
+ $affectedRows += 1;
+ $this->setDbId($pk); //[IMV] update autoincrement primary key
+ $this->setNew(false);
+ } else {
+ $affectedRows += CcBlockPeer::doUpdate($this, $con);
+ }
+
+ $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
+ }
+
+ if ($this->collCcPlaylistcontentss !== null) {
+ foreach ($this->collCcPlaylistcontentss as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->collCcBlockcontentss !== null) {
+ foreach ($this->collCcBlockcontentss as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->collCcBlockcriterias !== null) {
+ foreach ($this->collCcBlockcriterias as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true
is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true
if all validations pass; array of ValidationFailed
objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcSubjs !== null) {
+ if (!$this->aCcSubjs->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcBlockPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collCcPlaylistcontentss !== null) {
+ foreach ($this->collCcPlaylistcontentss as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collCcBlockcontentss !== null) {
+ foreach ($this->collCcBlockcontentss as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collCcBlockcriterias !== null) {
+ foreach ($this->collCcBlockcriterias as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcBlockPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getDbId();
+ break;
+ case 1:
+ return $this->getDbName();
+ break;
+ case 2:
+ return $this->getDbMtime();
+ break;
+ case 3:
+ return $this->getDbUtime();
+ break;
+ case 4:
+ return $this->getDbCreatorId();
+ break;
+ case 5:
+ return $this->getDbDescription();
+ break;
+ case 6:
+ return $this->getDbLength();
+ break;
+ case 7:
+ return $this->getDbType();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false)
+ {
+ $keys = CcBlockPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbName(),
+ $keys[2] => $this->getDbMtime(),
+ $keys[3] => $this->getDbUtime(),
+ $keys[4] => $this->getDbCreatorId(),
+ $keys[5] => $this->getDbDescription(),
+ $keys[6] => $this->getDbLength(),
+ $keys[7] => $this->getDbType(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcSubjs) {
+ $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcBlockPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setDbId($value);
+ break;
+ case 1:
+ $this->setDbName($value);
+ break;
+ case 2:
+ $this->setDbMtime($value);
+ break;
+ case 3:
+ $this->setDbUtime($value);
+ break;
+ case 4:
+ $this->setDbCreatorId($value);
+ break;
+ case 5:
+ $this->setDbDescription($value);
+ break;
+ case 6:
+ $this->setDbLength($value);
+ break;
+ case 7:
+ $this->setDbType($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's phpname (e.g. 'AuthorId')
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = CcBlockPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbName($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbMtime($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbUtime($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbCreatorId($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbDescription($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbLength($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setDbType($arr[$keys[7]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(CcBlockPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcBlockPeer::ID)) $criteria->add(CcBlockPeer::ID, $this->id);
+ if ($this->isColumnModified(CcBlockPeer::NAME)) $criteria->add(CcBlockPeer::NAME, $this->name);
+ if ($this->isColumnModified(CcBlockPeer::MTIME)) $criteria->add(CcBlockPeer::MTIME, $this->mtime);
+ if ($this->isColumnModified(CcBlockPeer::UTIME)) $criteria->add(CcBlockPeer::UTIME, $this->utime);
+ if ($this->isColumnModified(CcBlockPeer::CREATOR_ID)) $criteria->add(CcBlockPeer::CREATOR_ID, $this->creator_id);
+ if ($this->isColumnModified(CcBlockPeer::DESCRIPTION)) $criteria->add(CcBlockPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(CcBlockPeer::LENGTH)) $criteria->add(CcBlockPeer::LENGTH, $this->length);
+ if ($this->isColumnModified(CcBlockPeer::TYPE)) $criteria->add(CcBlockPeer::TYPE, $this->type);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(CcBlockPeer::DATABASE_NAME);
+ $criteria->add(CcBlockPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+ return null === $this->getDbId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of CcBlock (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+ $copyObj->setDbName($this->name);
+ $copyObj->setDbMtime($this->mtime);
+ $copyObj->setDbUtime($this->utime);
+ $copyObj->setDbCreatorId($this->creator_id);
+ $copyObj->setDbDescription($this->description);
+ $copyObj->setDbLength($this->length);
+ $copyObj->setDbType($this->type);
+
+ if ($deepCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+
+ foreach ($this->getCcPlaylistcontentss() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcPlaylistcontents($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getCcBlockcontentss() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcBlockcontents($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getCcBlockcriterias() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcBlockcriteria($relObj->copy($deepCopy));
+ }
+ }
+
+ } // if ($deepCopy)
+
+
+ $copyObj->setNew(true);
+ $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return CcBlock Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return CcBlockPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcBlockPeer();
+ }
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcSubjs object.
+ *
+ * @param CcSubjs $v
+ * @return CcBlock The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcSubjs(CcSubjs $v = null)
+ {
+ if ($v === null) {
+ $this->setDbCreatorId(NULL);
+ } else {
+ $this->setDbCreatorId($v->getDbId());
+ }
+
+ $this->aCcSubjs = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcSubjs object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcBlock($this);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcSubjs object
+ *
+ * @param PropelPDO Optional Connection object.
+ * @return CcSubjs The associated CcSubjs object.
+ * @throws PropelException
+ */
+ public function getCcSubjs(PropelPDO $con = null)
+ {
+ if ($this->aCcSubjs === null && ($this->creator_id !== null)) {
+ $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->creator_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCcSubjs->addCcBlocks($this);
+ */
+ }
+ return $this->aCcSubjs;
+ }
+
+ /**
+ * Clears out the collCcPlaylistcontentss 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 addCcPlaylistcontentss()
+ */
+ public function clearCcPlaylistcontentss()
+ {
+ $this->collCcPlaylistcontentss = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Initializes the collCcPlaylistcontentss collection.
+ *
+ * By default this just sets the collCcPlaylistcontentss collection to an empty array (like clearcollCcPlaylistcontentss());
+ * 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 initCcPlaylistcontentss()
+ {
+ $this->collCcPlaylistcontentss = new PropelObjectCollection();
+ $this->collCcPlaylistcontentss->setModel('CcPlaylistcontents');
+ }
+
+ /**
+ * Gets an array of CcPlaylistcontents 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 CcPlaylistcontents[] List of CcPlaylistcontents objects
+ * @throws PropelException
+ */
+ public function getCcPlaylistcontentss($criteria = null, PropelPDO $con = null)
+ {
+ if(null === $this->collCcPlaylistcontentss || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcPlaylistcontentss) {
+ // return empty collection
+ $this->initCcPlaylistcontentss();
+ } else {
+ $collCcPlaylistcontentss = CcPlaylistcontentsQuery::create(null, $criteria)
+ ->filterByCcBlock($this)
+ ->find($con);
+ if (null !== $criteria) {
+ return $collCcPlaylistcontentss;
+ }
+ $this->collCcPlaylistcontentss = $collCcPlaylistcontentss;
+ }
+ }
+ return $this->collCcPlaylistcontentss;
+ }
+
+ /**
+ * Returns the number of related CcPlaylistcontents objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcPlaylistcontents objects.
+ * @throws PropelException
+ */
+ public function countCcPlaylistcontentss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ if(null === $this->collCcPlaylistcontentss || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcPlaylistcontentss) {
+ return 0;
+ } else {
+ $query = CcPlaylistcontentsQuery::create(null, $criteria);
+ if($distinct) {
+ $query->distinct();
+ }
+ return $query
+ ->filterByCcBlock($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collCcPlaylistcontentss);
+ }
+ }
+
+ /**
+ * Method called to associate a CcPlaylistcontents object to this object
+ * through the CcPlaylistcontents foreign key attribute.
+ *
+ * @param CcPlaylistcontents $l CcPlaylistcontents
+ * @return void
+ * @throws PropelException
+ */
+ public function addCcPlaylistcontents(CcPlaylistcontents $l)
+ {
+ if ($this->collCcPlaylistcontentss === null) {
+ $this->initCcPlaylistcontentss();
+ }
+ if (!$this->collCcPlaylistcontentss->contains($l)) { // only add it if the **same** object is not already associated
+ $this->collCcPlaylistcontentss[]= $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 CcPlaylistcontentss 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 CcPlaylistcontents[] List of CcPlaylistcontents objects
+ */
+ public function getCcPlaylistcontentssJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcPlaylistcontentsQuery::create(null, $criteria);
+ $query->joinWith('CcFiles', $join_behavior);
+
+ return $this->getCcPlaylistcontentss($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 CcPlaylistcontentss 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 CcPlaylistcontents[] List of CcPlaylistcontents objects
+ */
+ public function getCcPlaylistcontentssJoinCcPlaylist($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcPlaylistcontentsQuery::create(null, $criteria);
+ $query->joinWith('CcPlaylist', $join_behavior);
+
+ return $this->getCcPlaylistcontentss($query, $con);
+ }
+
+ /**
+ * Clears out the collCcBlockcontentss 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 addCcBlockcontentss()
+ */
+ public function clearCcBlockcontentss()
+ {
+ $this->collCcBlockcontentss = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Initializes the collCcBlockcontentss collection.
+ *
+ * By default this just sets the collCcBlockcontentss collection to an empty array (like clearcollCcBlockcontentss());
+ * 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 initCcBlockcontentss()
+ {
+ $this->collCcBlockcontentss = new PropelObjectCollection();
+ $this->collCcBlockcontentss->setModel('CcBlockcontents');
+ }
+
+ /**
+ * Gets an array of CcBlockcontents 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 CcBlockcontents[] List of CcBlockcontents objects
+ * @throws PropelException
+ */
+ public function getCcBlockcontentss($criteria = null, PropelPDO $con = null)
+ {
+ if(null === $this->collCcBlockcontentss || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcBlockcontentss) {
+ // return empty collection
+ $this->initCcBlockcontentss();
+ } else {
+ $collCcBlockcontentss = CcBlockcontentsQuery::create(null, $criteria)
+ ->filterByCcBlock($this)
+ ->find($con);
+ if (null !== $criteria) {
+ return $collCcBlockcontentss;
+ }
+ $this->collCcBlockcontentss = $collCcBlockcontentss;
+ }
+ }
+ return $this->collCcBlockcontentss;
+ }
+
+ /**
+ * Returns the number of related CcBlockcontents objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcBlockcontents objects.
+ * @throws PropelException
+ */
+ public function countCcBlockcontentss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ if(null === $this->collCcBlockcontentss || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcBlockcontentss) {
+ return 0;
+ } else {
+ $query = CcBlockcontentsQuery::create(null, $criteria);
+ if($distinct) {
+ $query->distinct();
+ }
+ return $query
+ ->filterByCcBlock($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collCcBlockcontentss);
+ }
+ }
+
+ /**
+ * Method called to associate a CcBlockcontents object to this object
+ * through the CcBlockcontents foreign key attribute.
+ *
+ * @param CcBlockcontents $l CcBlockcontents
+ * @return void
+ * @throws PropelException
+ */
+ public function addCcBlockcontents(CcBlockcontents $l)
+ {
+ if ($this->collCcBlockcontentss === null) {
+ $this->initCcBlockcontentss();
+ }
+ if (!$this->collCcBlockcontentss->contains($l)) { // only add it if the **same** object is not already associated
+ $this->collCcBlockcontentss[]= $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 CcBlockcontentss 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 CcBlockcontents[] List of CcBlockcontents objects
+ */
+ public function getCcBlockcontentssJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcBlockcontentsQuery::create(null, $criteria);
+ $query->joinWith('CcFiles', $join_behavior);
+
+ return $this->getCcBlockcontentss($query, $con);
+ }
+
+ /**
+ * Clears out the collCcBlockcriterias 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 addCcBlockcriterias()
+ */
+ public function clearCcBlockcriterias()
+ {
+ $this->collCcBlockcriterias = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Initializes the collCcBlockcriterias collection.
+ *
+ * By default this just sets the collCcBlockcriterias collection to an empty array (like clearcollCcBlockcriterias());
+ * 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 initCcBlockcriterias()
+ {
+ $this->collCcBlockcriterias = new PropelObjectCollection();
+ $this->collCcBlockcriterias->setModel('CcBlockcriteria');
+ }
+
+ /**
+ * Gets an array of CcBlockcriteria 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 CcBlockcriteria[] List of CcBlockcriteria objects
+ * @throws PropelException
+ */
+ public function getCcBlockcriterias($criteria = null, PropelPDO $con = null)
+ {
+ if(null === $this->collCcBlockcriterias || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcBlockcriterias) {
+ // return empty collection
+ $this->initCcBlockcriterias();
+ } else {
+ $collCcBlockcriterias = CcBlockcriteriaQuery::create(null, $criteria)
+ ->filterByCcBlock($this)
+ ->find($con);
+ if (null !== $criteria) {
+ return $collCcBlockcriterias;
+ }
+ $this->collCcBlockcriterias = $collCcBlockcriterias;
+ }
+ }
+ return $this->collCcBlockcriterias;
+ }
+
+ /**
+ * Returns the number of related CcBlockcriteria objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcBlockcriteria objects.
+ * @throws PropelException
+ */
+ public function countCcBlockcriterias(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ if(null === $this->collCcBlockcriterias || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcBlockcriterias) {
+ return 0;
+ } else {
+ $query = CcBlockcriteriaQuery::create(null, $criteria);
+ if($distinct) {
+ $query->distinct();
+ }
+ return $query
+ ->filterByCcBlock($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collCcBlockcriterias);
+ }
+ }
+
+ /**
+ * Method called to associate a CcBlockcriteria object to this object
+ * through the CcBlockcriteria foreign key attribute.
+ *
+ * @param CcBlockcriteria $l CcBlockcriteria
+ * @return void
+ * @throws PropelException
+ */
+ public function addCcBlockcriteria(CcBlockcriteria $l)
+ {
+ if ($this->collCcBlockcriterias === null) {
+ $this->initCcBlockcriterias();
+ }
+ if (!$this->collCcBlockcriterias->contains($l)) { // only add it if the **same** object is not already associated
+ $this->collCcBlockcriterias[]= $l;
+ $l->setCcBlock($this);
+ }
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->name = null;
+ $this->mtime = null;
+ $this->utime = null;
+ $this->creator_id = null;
+ $this->description = null;
+ $this->length = null;
+ $this->type = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all collections of referencing foreign keys.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect objects
+ * with circular references. This is currently necessary when using Propel in certain
+ * daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all associated objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ if ($this->collCcPlaylistcontentss) {
+ foreach ((array) $this->collCcPlaylistcontentss as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcBlockcontentss) {
+ foreach ((array) $this->collCcBlockcontentss as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcBlockcriterias) {
+ foreach ((array) $this->collCcBlockcriterias as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ } // if ($deep)
+
+ $this->collCcPlaylistcontentss = null;
+ $this->collCcBlockcontentss = null;
+ $this->collCcBlockcriterias = null;
+ $this->aCcSubjs = null;
+ }
+
+ // aggregate_column behavior
+
+ /**
+ * Computes the value of the aggregate column length
+ *
+ * @param PropelPDO $con A connection object
+ *
+ * @return mixed The scalar result from the aggregate query
+ */
+ public function computeDbLength(PropelPDO $con)
+ {
+ $stmt = $con->prepare('SELECT SUM(cliplength) FROM "cc_blockcontents" WHERE cc_blockcontents.BLOCK_ID = :p1');
+ $stmt->bindValue(':p1', $this->getDbId());
+ $stmt->execute();
+ return $stmt->fetchColumn();
+ }
+
+ /**
+ * Updates the aggregate column length
+ *
+ * @param PropelPDO $con A connection object
+ */
+ public function updateDbLength(PropelPDO $con)
+ {
+ $this->setDbLength($this->computeDbLength($con));
+ $this->save($con);
+ }
+
+ /**
+ * Catches calls to virtual methods
+ */
+ public function __call($name, $params)
+ {
+ if (preg_match('/get(\w+)/', $name, $matches)) {
+ $virtualColumn = $matches[1];
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ // no lcfirst in php<5.3...
+ $virtualColumn[0] = strtolower($virtualColumn[0]);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+ throw new PropelException('Call to undefined method: ' . $name);
+ }
+
+} // BaseCcBlock
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockPeer.php
new file mode 100644
index 000000000..48003ffc5
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockPeer.php
@@ -0,0 +1,1012 @@
+ array ('DbId', 'DbName', 'DbMtime', 'DbUtime', 'DbCreatorId', 'DbDescription', 'DbLength', 'DbType', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMtime', 'dbUtime', 'dbCreatorId', 'dbDescription', 'dbLength', 'dbType', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::MTIME, self::UTIME, self::CREATOR_ID, self::DESCRIPTION, self::LENGTH, self::TYPE, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MTIME', 'UTIME', 'CREATOR_ID', 'DESCRIPTION', 'LENGTH', 'TYPE', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mtime', 'utime', 'creator_id', 'description', 'length', 'type', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMtime' => 2, 'DbUtime' => 3, 'DbCreatorId' => 4, 'DbDescription' => 5, 'DbLength' => 6, 'DbType' => 7, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMtime' => 2, 'dbUtime' => 3, 'dbCreatorId' => 4, 'dbDescription' => 5, 'dbLength' => 6, 'dbType' => 7, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::MTIME => 2, self::UTIME => 3, self::CREATOR_ID => 4, self::DESCRIPTION => 5, self::LENGTH => 6, self::TYPE => 7, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MTIME' => 2, 'UTIME' => 3, 'CREATOR_ID' => 4, 'DESCRIPTION' => 5, 'LENGTH' => 6, 'TYPE' => 7, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mtime' => 2, 'utime' => 3, 'creator_id' => 4, 'description' => 5, 'length' => 6, 'type' => 7, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ */
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. CcBlockPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcBlockPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(CcBlockPeer::ID);
+ $criteria->addSelectColumn(CcBlockPeer::NAME);
+ $criteria->addSelectColumn(CcBlockPeer::MTIME);
+ $criteria->addSelectColumn(CcBlockPeer::UTIME);
+ $criteria->addSelectColumn(CcBlockPeer::CREATOR_ID);
+ $criteria->addSelectColumn(CcBlockPeer::DESCRIPTION);
+ $criteria->addSelectColumn(CcBlockPeer::LENGTH);
+ $criteria->addSelectColumn(CcBlockPeer::TYPE);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.NAME');
+ $criteria->addSelectColumn($alias . '.MTIME');
+ $criteria->addSelectColumn($alias . '.UTIME');
+ $criteria->addSelectColumn($alias . '.CREATOR_ID');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.LENGTH');
+ $criteria->addSelectColumn($alias . '.TYPE');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcBlockPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+ /**
+ * Method to select one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcBlock
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = CcBlockPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+ /**
+ * Method to do selects.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return CcBlockPeer::populateObjects(CcBlockPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcBlockPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param CcBlock $value A CcBlock object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool(CcBlock $obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A CcBlock object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcBlock) {
+ $key = (string) $value->getDbId();
+ } elseif (is_scalar($value)) {
+ // assume we've been passed a primary key
+ $key = (string) $value;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcBlock object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return CcBlock Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(self::$instances[$key])) {
+ return self::$instances[$key];
+ }
+ }
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ self::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_block
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ // 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 CcBlockcontentsPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcBlockcontentsPeer::clearInstancePool();
+ // Invalidate objects in CcBlockcriteriaPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcBlockcriteriaPeer::clearInstancePool();
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or NULL if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[$startcol] === null) {
+ return null;
+ }
+ return (string) $row[$startcol];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+ return (int) $row[$startcol];
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = CcBlockPeer::getOMClass(false);
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcBlockPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcBlockPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ CcBlockPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (CcBlock object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcBlockPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + CcBlockPeer::NUM_COLUMNS;
+ } else {
+ $cls = CcBlockPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcBlockPeer::addInstanceToPool($obj, $key);
+ }
+ return array($obj, $col);
+ }
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcSubjs table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcBlockPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of CcBlock objects pre-filled with their CcSubjs objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcBlock objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol = (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcSubjsPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcBlockPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CcBlockPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcSubjsPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcSubjsPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcSubjsPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcBlock) to $obj2 (CcSubjs)
+ $obj2->addCcBlock($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcBlockPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+ /**
+ * Selects a collection of CcBlock objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcBlock objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol2 = (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcSubjsPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcBlockPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcBlockPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcSubjs rows
+
+ $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcSubjsPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcSubjsPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcSubjsPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcBlock) to the collection in $obj2 (CcSubjs)
+ $obj2->addCcBlock($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcBlockPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcBlockPeer::TABLE_NAME))
+ {
+ $dbMap->addTableObject(new CcBlockTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is tranalted into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? CcBlockPeer::CLASS_DEFAULT : CcBlockPeer::OM_CLASS;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a CcBlock or Criteria object.
+ *
+ * @param mixed $values Criteria or CcBlock object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcBlock object
+ }
+
+ if ($criteria->containsKey(CcBlockPeer::ID) && $criteria->keyContainsValue(CcBlockPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Method perform an UPDATE on the database, given a CcBlock or Criteria object.
+ *
+ * @param mixed $values Criteria or CcBlock object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcBlockPeer::ID);
+ $value = $criteria->remove(CcBlockPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcBlockPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcBlockPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcBlock object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Method to DELETE all rows from the cc_block table.
+ *
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(CcBlockPeer::TABLE_NAME, $con, CcBlockPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ CcBlockPeer::clearInstancePool();
+ CcBlockPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a CcBlock or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcBlock object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ CcBlockPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcBlock) { // it's a model object
+ // invalidate the cache for this single object
+ CcBlockPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(CcBlockPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcBlockPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ CcBlockPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcBlock object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param CcBlock $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate(CcBlock $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcBlockPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcBlockPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcBlockPeer::DATABASE_NAME, CcBlockPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcBlock
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcBlockPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcBlockPeer::DATABASE_NAME);
+ $criteria->add(CcBlockPeer::ID, $pk);
+
+ $v = CcBlockPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param PropelPDO $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcBlockPeer::DATABASE_NAME);
+ $criteria->add(CcBlockPeer::ID, $pks, Criteria::IN);
+ $objs = CcBlockPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+} // BaseCcBlockPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCcBlockPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockQuery.php
new file mode 100644
index 000000000..100efd61e
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockQuery.php
@@ -0,0 +1,646 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+ return $query;
+ }
+
+ /**
+ * Find object by primary key
+ * Use instance pooling to avoid a database query if the object exists
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcBlock|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ((null !== ($obj = CcBlockPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
+ // the object is alredy in the instance pool
+ return $obj;
+ } else {
+ // the object has not been requested yet, or the formatter is not an object formatter
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->getSelectStatement($con);
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ return $this
+ ->filterByPrimaryKeys($keys)
+ ->find($con);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ return $this->addUsingAlias(CcBlockPeer::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ return $this->addUsingAlias(CcBlockPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * @param int|array $dbId 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 CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ return $this->addUsingAlias(CcBlockPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the name column
+ *
+ * @param string $dbName The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByDbName($dbName = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbName)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbName)) {
+ $dbName = str_replace('*', '%', $dbName);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcBlockPeer::NAME, $dbName, $comparison);
+ }
+
+ /**
+ * Filter the query on the mtime column
+ *
+ * @param string|array $dbMtime 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 CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByDbMtime($dbMtime = null, $comparison = null)
+ {
+ if (is_array($dbMtime)) {
+ $useMinMax = false;
+ if (isset($dbMtime['min'])) {
+ $this->addUsingAlias(CcBlockPeer::MTIME, $dbMtime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbMtime['max'])) {
+ $this->addUsingAlias(CcBlockPeer::MTIME, $dbMtime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcBlockPeer::MTIME, $dbMtime, $comparison);
+ }
+
+ /**
+ * Filter the query on the utime column
+ *
+ * @param string|array $dbUtime 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 CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByDbUtime($dbUtime = null, $comparison = null)
+ {
+ if (is_array($dbUtime)) {
+ $useMinMax = false;
+ if (isset($dbUtime['min'])) {
+ $this->addUsingAlias(CcBlockPeer::UTIME, $dbUtime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbUtime['max'])) {
+ $this->addUsingAlias(CcBlockPeer::UTIME, $dbUtime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcBlockPeer::UTIME, $dbUtime, $comparison);
+ }
+
+ /**
+ * Filter the query on the creator_id column
+ *
+ * @param int|array $dbCreatorId 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 CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByDbCreatorId($dbCreatorId = null, $comparison = null)
+ {
+ if (is_array($dbCreatorId)) {
+ $useMinMax = false;
+ if (isset($dbCreatorId['min'])) {
+ $this->addUsingAlias(CcBlockPeer::CREATOR_ID, $dbCreatorId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbCreatorId['max'])) {
+ $this->addUsingAlias(CcBlockPeer::CREATOR_ID, $dbCreatorId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcBlockPeer::CREATOR_ID, $dbCreatorId, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * @param string $dbDescription The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByDbDescription($dbDescription = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbDescription)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbDescription)) {
+ $dbDescription = str_replace('*', '%', $dbDescription);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcBlockPeer::DESCRIPTION, $dbDescription, $comparison);
+ }
+
+ /**
+ * Filter the query on the length column
+ *
+ * @param string $dbLength The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByDbLength($dbLength = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLength)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLength)) {
+ $dbLength = str_replace('*', '%', $dbLength);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcBlockPeer::LENGTH, $dbLength, $comparison);
+ }
+
+ /**
+ * Filter the query on the type column
+ *
+ * @param string $dbType The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByDbType($dbType = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbType)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbType)) {
+ $dbType = str_replace('*', '%', $dbType);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcBlockPeer::TYPE, $dbType, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcSubjs object
+ *
+ * @param CcSubjs $ccSubjs 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 filterByCcSubjs($ccSubjs, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcBlockPeer::CREATOR_ID, $ccSubjs->getDbId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcSubjs 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 joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcSubjs');
+
+ // 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, 'CcSubjs');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcSubjs relation CcSubjs 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 CcSubjsQuery A secondary query class using the current class as primary query
+ */
+ public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcSubjs($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery');
+ }
+
+ /**
+ * Filter the query by a related CcPlaylistcontents object
+ *
+ * @param CcPlaylistcontents $ccPlaylistcontents 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 filterByCcPlaylistcontents($ccPlaylistcontents, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcBlockPeer::ID, $ccPlaylistcontents->getDbBlockId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlaylistcontents 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 joinCcPlaylistcontents($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlaylistcontents');
+
+ // 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, 'CcPlaylistcontents');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlaylistcontents relation CcPlaylistcontents 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 CcPlaylistcontentsQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlaylistcontentsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcPlaylistcontents($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcontents', 'CcPlaylistcontentsQuery');
+ }
+
+ /**
+ * Filter the query by a related CcBlockcontents object
+ *
+ * @param CcBlockcontents $ccBlockcontents 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 filterByCcBlockcontents($ccBlockcontents, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcBlockPeer::ID, $ccBlockcontents->getDbBlockId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcBlockcontents 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 joinCcBlockcontents($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcBlockcontents');
+
+ // 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, 'CcBlockcontents');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcBlockcontents relation CcBlockcontents 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 CcBlockcontentsQuery A secondary query class using the current class as primary query
+ */
+ public function useCcBlockcontentsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcBlockcontents($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcBlockcontents', 'CcBlockcontentsQuery');
+ }
+
+ /**
+ * Filter the query by a related CcBlockcriteria object
+ *
+ * @param CcBlockcriteria $ccBlockcriteria 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 filterByCcBlockcriteria($ccBlockcriteria, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcBlockPeer::ID, $ccBlockcriteria->getDbBlockId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcBlockcriteria 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 joinCcBlockcriteria($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcBlockcriteria');
+
+ // 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, 'CcBlockcriteria');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcBlockcriteria relation CcBlockcriteria 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 CcBlockcriteriaQuery A secondary query class using the current class as primary query
+ */
+ public function useCcBlockcriteriaQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcBlockcriteria($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcBlockcriteria', 'CcBlockcriteriaQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcBlock $ccBlock Object to remove from the list of results
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function prune($ccBlock = null)
+ {
+ if ($ccBlock) {
+ $this->addUsingAlias(CcBlockPeer::ID, $ccBlock->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+} // BaseCcBlockQuery
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php
new file mode 100644
index 000000000..d6beab8b4
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php
@@ -0,0 +1,1408 @@
+cliplength = '00:00:00';
+ $this->cuein = '00:00:00';
+ $this->cueout = '00:00:00';
+ $this->fadein = '00:00:00';
+ $this->fadeout = '00:00:00';
+ }
+
+ /**
+ * Initializes internal state of BaseCcBlockcontents object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [block_id] column value.
+ *
+ * @return int
+ */
+ public function getDbBlockId()
+ {
+ return $this->block_id;
+ }
+
+ /**
+ * Get the [file_id] column value.
+ *
+ * @return int
+ */
+ public function getDbFileId()
+ {
+ return $this->file_id;
+ }
+
+ /**
+ * Get the [position] column value.
+ *
+ * @return int
+ */
+ public function getDbPosition()
+ {
+ return $this->position;
+ }
+
+ /**
+ * Get the [cliplength] column value.
+ *
+ * @return string
+ */
+ public function getDbCliplength()
+ {
+ return $this->cliplength;
+ }
+
+ /**
+ * Get the [cuein] column value.
+ *
+ * @return string
+ */
+ public function getDbCuein()
+ {
+ return $this->cuein;
+ }
+
+ /**
+ * Get the [cueout] column value.
+ *
+ * @return string
+ */
+ public function getDbCueout()
+ {
+ return $this->cueout;
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [fadein] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw DateTime object will be returned.
+ * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getDbFadein($format = '%X')
+ {
+ if ($this->fadein === null) {
+ return null;
+ }
+
+
+
+ try {
+ $dt = new DateTime($this->fadein);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->fadein, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is TRUE, we return a DateTime object.
+ return $dt;
+ } elseif (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ } else {
+ return $dt->format($format);
+ }
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [fadeout] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw DateTime object will be returned.
+ * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getDbFadeout($format = '%X')
+ {
+ if ($this->fadeout === null) {
+ return null;
+ }
+
+
+
+ try {
+ $dt = new DateTime($this->fadeout);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->fadeout, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is TRUE, we return a DateTime object.
+ return $dt;
+ } elseif (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ } else {
+ return $dt->format($format);
+ }
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::ID;
+ }
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [block_id] column.
+ *
+ * @param int $v new value
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbBlockId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->block_id !== $v) {
+ $this->block_id = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::BLOCK_ID;
+ }
+
+ if ($this->aCcBlock !== null && $this->aCcBlock->getDbId() !== $v) {
+ $this->aCcBlock = null;
+ }
+
+ return $this;
+ } // setDbBlockId()
+
+ /**
+ * Set the value of [file_id] column.
+ *
+ * @param int $v new value
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbFileId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->file_id !== $v) {
+ $this->file_id = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::FILE_ID;
+ }
+
+ if ($this->aCcFiles !== null && $this->aCcFiles->getDbId() !== $v) {
+ $this->aCcFiles = null;
+ }
+
+ return $this;
+ } // setDbFileId()
+
+ /**
+ * Set the value of [position] column.
+ *
+ * @param int $v new value
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbPosition($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->position !== $v) {
+ $this->position = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::POSITION;
+ }
+
+ return $this;
+ } // setDbPosition()
+
+ /**
+ * Set the value of [cliplength] column.
+ *
+ * @param string $v new value
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbCliplength($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->cliplength !== $v || $this->isNew()) {
+ $this->cliplength = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::CLIPLENGTH;
+ }
+
+ return $this;
+ } // setDbCliplength()
+
+ /**
+ * Set the value of [cuein] column.
+ *
+ * @param string $v new value
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbCuein($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->cuein !== $v || $this->isNew()) {
+ $this->cuein = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::CUEIN;
+ }
+
+ return $this;
+ } // setDbCuein()
+
+ /**
+ * Set the value of [cueout] column.
+ *
+ * @param string $v new value
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbCueout($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->cueout !== $v || $this->isNew()) {
+ $this->cueout = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::CUEOUT;
+ }
+
+ return $this;
+ } // setDbCueout()
+
+ /**
+ * Sets the value of [fadein] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
+ * be treated as NULL for temporal objects.
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbFadein($v)
+ {
+ // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
+ // -- which is unexpected, to say the least.
+ if ($v === null || $v === '') {
+ $dt = null;
+ } elseif ($v instanceof DateTime) {
+ $dt = $v;
+ } else {
+ // some string/numeric value passed; we normalize that so that we can
+ // validate it.
+ try {
+ if (is_numeric($v)) { // if it's a unix timestamp
+ $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
+ // We have to explicitly specify and then change the time zone because of a
+ // DateTime bug: http://bugs.php.net/bug.php?id=43003
+ $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
+ } else {
+ $dt = new DateTime($v);
+ }
+ } catch (Exception $x) {
+ throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
+ }
+ }
+
+ if ( $this->fadein !== null || $dt !== null ) {
+ // (nested ifs are a little easier to read in this case)
+
+ $currNorm = ($this->fadein !== null && $tmpDt = new DateTime($this->fadein)) ? $tmpDt->format('H:i:s') : null;
+ $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
+
+ if ( ($currNorm !== $newNorm) // normalized values don't match
+ || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
+ )
+ {
+ $this->fadein = ($dt ? $dt->format('H:i:s') : null);
+ $this->modifiedColumns[] = CcBlockcontentsPeer::FADEIN;
+ }
+ } // if either are not null
+
+ return $this;
+ } // setDbFadein()
+
+ /**
+ * Sets the value of [fadeout] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
+ * be treated as NULL for temporal objects.
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbFadeout($v)
+ {
+ // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
+ // -- which is unexpected, to say the least.
+ if ($v === null || $v === '') {
+ $dt = null;
+ } elseif ($v instanceof DateTime) {
+ $dt = $v;
+ } else {
+ // some string/numeric value passed; we normalize that so that we can
+ // validate it.
+ try {
+ if (is_numeric($v)) { // if it's a unix timestamp
+ $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
+ // We have to explicitly specify and then change the time zone because of a
+ // DateTime bug: http://bugs.php.net/bug.php?id=43003
+ $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
+ } else {
+ $dt = new DateTime($v);
+ }
+ } catch (Exception $x) {
+ throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
+ }
+ }
+
+ if ( $this->fadeout !== null || $dt !== null ) {
+ // (nested ifs are a little easier to read in this case)
+
+ $currNorm = ($this->fadeout !== null && $tmpDt = new DateTime($this->fadeout)) ? $tmpDt->format('H:i:s') : null;
+ $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
+
+ if ( ($currNorm !== $newNorm) // normalized values don't match
+ || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
+ )
+ {
+ $this->fadeout = ($dt ? $dt->format('H:i:s') : null);
+ $this->modifiedColumns[] = CcBlockcontentsPeer::FADEOUT;
+ }
+ } // if either are not null
+
+ return $this;
+ } // setDbFadeout()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->cliplength !== '00:00:00') {
+ return false;
+ }
+
+ if ($this->cuein !== '00:00:00') {
+ return false;
+ }
+
+ if ($this->cueout !== '00:00:00') {
+ return false;
+ }
+
+ if ($this->fadein !== '00:00:00') {
+ return false;
+ }
+
+ if ($this->fadeout !== '00:00:00') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->block_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
+ $this->file_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
+ $this->position = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
+ $this->cliplength = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->cuein = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->cueout = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
+ $this->fadein = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
+ $this->fadeout = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 9; // 9 = CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcBlockcontents object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aCcBlock !== null && $this->block_id !== $this->aCcBlock->getDbId()) {
+ $this->aCcBlock = null;
+ }
+ if ($this->aCcFiles !== null && $this->file_id !== $this->aCcFiles->getDbId()) {
+ $this->aCcFiles = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = CcBlockcontentsPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aCcFiles = null;
+ $this->aCcBlock = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ CcBlockcontentsQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey())
+ ->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ // aggregate_column_relation behavior
+ $this->updateRelatedCcBlock($con);
+ CcBlockcontentsPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcFiles !== null) {
+ if ($this->aCcFiles->isModified() || $this->aCcFiles->isNew()) {
+ $affectedRows += $this->aCcFiles->save($con);
+ }
+ $this->setCcFiles($this->aCcFiles);
+ }
+
+ if ($this->aCcBlock !== null) {
+ if ($this->aCcBlock->isModified() || $this->aCcBlock->isNew()) {
+ $affectedRows += $this->aCcBlock->save($con);
+ }
+ $this->setCcBlock($this->aCcBlock);
+ }
+
+ if ($this->isNew() ) {
+ $this->modifiedColumns[] = CcBlockcontentsPeer::ID;
+ }
+
+ // If this object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $criteria = $this->buildCriteria();
+ if ($criteria->keyContainsValue(CcBlockcontentsPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockcontentsPeer::ID.')');
+ }
+
+ $pk = BasePeer::doInsert($criteria, $con);
+ $affectedRows += 1;
+ $this->setDbId($pk); //[IMV] update autoincrement primary key
+ $this->setNew(false);
+ } else {
+ $affectedRows += CcBlockcontentsPeer::doUpdate($this, $con);
+ }
+
+ $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true
is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true
if all validations pass; array of ValidationFailed
objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcFiles !== null) {
+ if (!$this->aCcFiles->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcFiles->getValidationFailures());
+ }
+ }
+
+ if ($this->aCcBlock !== null) {
+ if (!$this->aCcBlock->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcBlock->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcBlockcontentsPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcBlockcontentsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getDbId();
+ break;
+ case 1:
+ return $this->getDbBlockId();
+ break;
+ case 2:
+ return $this->getDbFileId();
+ break;
+ case 3:
+ return $this->getDbPosition();
+ break;
+ case 4:
+ return $this->getDbCliplength();
+ break;
+ case 5:
+ return $this->getDbCuein();
+ break;
+ case 6:
+ return $this->getDbCueout();
+ break;
+ case 7:
+ return $this->getDbFadein();
+ break;
+ case 8:
+ return $this->getDbFadeout();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false)
+ {
+ $keys = CcBlockcontentsPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbBlockId(),
+ $keys[2] => $this->getDbFileId(),
+ $keys[3] => $this->getDbPosition(),
+ $keys[4] => $this->getDbCliplength(),
+ $keys[5] => $this->getDbCuein(),
+ $keys[6] => $this->getDbCueout(),
+ $keys[7] => $this->getDbFadein(),
+ $keys[8] => $this->getDbFadeout(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcFiles) {
+ $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true);
+ }
+ if (null !== $this->aCcBlock) {
+ $result['CcBlock'] = $this->aCcBlock->toArray($keyType, $includeLazyLoadColumns, true);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcBlockcontentsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setDbId($value);
+ break;
+ case 1:
+ $this->setDbBlockId($value);
+ break;
+ case 2:
+ $this->setDbFileId($value);
+ break;
+ case 3:
+ $this->setDbPosition($value);
+ break;
+ case 4:
+ $this->setDbCliplength($value);
+ break;
+ case 5:
+ $this->setDbCuein($value);
+ break;
+ case 6:
+ $this->setDbCueout($value);
+ break;
+ case 7:
+ $this->setDbFadein($value);
+ break;
+ case 8:
+ $this->setDbFadeout($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's phpname (e.g. 'AuthorId')
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = CcBlockcontentsPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbBlockId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbFileId($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbPosition($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbCliplength($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbCuein($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbCueout($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setDbFadein($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setDbFadeout($arr[$keys[8]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(CcBlockcontentsPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcBlockcontentsPeer::ID)) $criteria->add(CcBlockcontentsPeer::ID, $this->id);
+ if ($this->isColumnModified(CcBlockcontentsPeer::BLOCK_ID)) $criteria->add(CcBlockcontentsPeer::BLOCK_ID, $this->block_id);
+ if ($this->isColumnModified(CcBlockcontentsPeer::FILE_ID)) $criteria->add(CcBlockcontentsPeer::FILE_ID, $this->file_id);
+ if ($this->isColumnModified(CcBlockcontentsPeer::POSITION)) $criteria->add(CcBlockcontentsPeer::POSITION, $this->position);
+ if ($this->isColumnModified(CcBlockcontentsPeer::CLIPLENGTH)) $criteria->add(CcBlockcontentsPeer::CLIPLENGTH, $this->cliplength);
+ if ($this->isColumnModified(CcBlockcontentsPeer::CUEIN)) $criteria->add(CcBlockcontentsPeer::CUEIN, $this->cuein);
+ if ($this->isColumnModified(CcBlockcontentsPeer::CUEOUT)) $criteria->add(CcBlockcontentsPeer::CUEOUT, $this->cueout);
+ if ($this->isColumnModified(CcBlockcontentsPeer::FADEIN)) $criteria->add(CcBlockcontentsPeer::FADEIN, $this->fadein);
+ if ($this->isColumnModified(CcBlockcontentsPeer::FADEOUT)) $criteria->add(CcBlockcontentsPeer::FADEOUT, $this->fadeout);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(CcBlockcontentsPeer::DATABASE_NAME);
+ $criteria->add(CcBlockcontentsPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+ return null === $this->getDbId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of CcBlockcontents (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+ $copyObj->setDbBlockId($this->block_id);
+ $copyObj->setDbFileId($this->file_id);
+ $copyObj->setDbPosition($this->position);
+ $copyObj->setDbCliplength($this->cliplength);
+ $copyObj->setDbCuein($this->cuein);
+ $copyObj->setDbCueout($this->cueout);
+ $copyObj->setDbFadein($this->fadein);
+ $copyObj->setDbFadeout($this->fadeout);
+
+ $copyObj->setNew(true);
+ $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return CcBlockcontents Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return CcBlockcontentsPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcBlockcontentsPeer();
+ }
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcFiles object.
+ *
+ * @param CcFiles $v
+ * @return CcBlockcontents The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcFiles(CcFiles $v = null)
+ {
+ if ($v === null) {
+ $this->setDbFileId(NULL);
+ } else {
+ $this->setDbFileId($v->getDbId());
+ }
+
+ $this->aCcFiles = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcFiles object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcBlockcontents($this);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcFiles object
+ *
+ * @param PropelPDO Optional Connection object.
+ * @return CcFiles The associated CcFiles object.
+ * @throws PropelException
+ */
+ public function getCcFiles(PropelPDO $con = null)
+ {
+ if ($this->aCcFiles === null && ($this->file_id !== null)) {
+ $this->aCcFiles = CcFilesQuery::create()->findPk($this->file_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCcFiles->addCcBlockcontentss($this);
+ */
+ }
+ return $this->aCcFiles;
+ }
+
+ /**
+ * Declares an association between this object and a CcBlock object.
+ *
+ * @param CcBlock $v
+ * @return CcBlockcontents The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcBlock(CcBlock $v = null)
+ {
+ // aggregate_column_relation behavior
+ if (null !== $this->aCcBlock && $v !== $this->aCcBlock) {
+ $this->oldCcBlock = $this->aCcBlock;
+ }
+ if ($v === null) {
+ $this->setDbBlockId(NULL);
+ } else {
+ $this->setDbBlockId($v->getDbId());
+ }
+
+ $this->aCcBlock = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcBlock object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcBlockcontents($this);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcBlock object
+ *
+ * @param PropelPDO Optional Connection object.
+ * @return CcBlock The associated CcBlock object.
+ * @throws PropelException
+ */
+ public function getCcBlock(PropelPDO $con = null)
+ {
+ if ($this->aCcBlock === null && ($this->block_id !== null)) {
+ $this->aCcBlock = CcBlockQuery::create()->findPk($this->block_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCcBlock->addCcBlockcontentss($this);
+ */
+ }
+ return $this->aCcBlock;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->block_id = null;
+ $this->file_id = null;
+ $this->position = null;
+ $this->cliplength = null;
+ $this->cuein = null;
+ $this->cueout = null;
+ $this->fadein = null;
+ $this->fadeout = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all collections of referencing foreign keys.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect objects
+ * with circular references. This is currently necessary when using Propel in certain
+ * daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all associated objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aCcFiles = null;
+ $this->aCcBlock = null;
+ }
+
+ // aggregate_column_relation behavior
+
+ /**
+ * Update the aggregate column in the related CcBlock object
+ *
+ * @param PropelPDO $con A connection object
+ */
+ protected function updateRelatedCcBlock(PropelPDO $con)
+ {
+ if ($ccBlock = $this->getCcBlock()) {
+ $ccBlock->updateDbLength($con);
+ }
+ if ($this->oldCcBlock) {
+ $this->oldCcBlock->updateDbLength($con);
+ $this->oldCcBlock = null;
+ }
+ }
+
+ /**
+ * Catches calls to virtual methods
+ */
+ public function __call($name, $params)
+ {
+ if (preg_match('/get(\w+)/', $name, $matches)) {
+ $virtualColumn = $matches[1];
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ // no lcfirst in php<5.3...
+ $virtualColumn[0] = strtolower($virtualColumn[0]);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+ throw new PropelException('Call to undefined method: ' . $name);
+ }
+
+} // BaseCcBlockcontents
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsPeer.php
new file mode 100644
index 000000000..7bee15279
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsPeer.php
@@ -0,0 +1,1395 @@
+ array ('DbId', 'DbBlockId', 'DbFileId', 'DbPosition', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbBlockId', 'dbFileId', 'dbPosition', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::BLOCK_ID, self::FILE_ID, self::POSITION, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'BLOCK_ID', 'FILE_ID', 'POSITION', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'block_id', 'file_id', 'position', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbBlockId' => 1, 'DbFileId' => 2, 'DbPosition' => 3, 'DbCliplength' => 4, 'DbCuein' => 5, 'DbCueout' => 6, 'DbFadein' => 7, 'DbFadeout' => 8, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbBlockId' => 1, 'dbFileId' => 2, 'dbPosition' => 3, 'dbCliplength' => 4, 'dbCuein' => 5, 'dbCueout' => 6, 'dbFadein' => 7, 'dbFadeout' => 8, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::BLOCK_ID => 1, self::FILE_ID => 2, self::POSITION => 3, self::CLIPLENGTH => 4, self::CUEIN => 5, self::CUEOUT => 6, self::FADEIN => 7, self::FADEOUT => 8, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'BLOCK_ID' => 1, 'FILE_ID' => 2, 'POSITION' => 3, 'CLIPLENGTH' => 4, 'CUEIN' => 5, 'CUEOUT' => 6, 'FADEIN' => 7, 'FADEOUT' => 8, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'block_id' => 1, 'file_id' => 2, 'position' => 3, 'cliplength' => 4, 'cuein' => 5, 'cueout' => 6, 'fadein' => 7, 'fadeout' => 8, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ */
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. CcBlockcontentsPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcBlockcontentsPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(CcBlockcontentsPeer::ID);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::BLOCK_ID);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::FILE_ID);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::POSITION);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::CLIPLENGTH);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::CUEIN);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::CUEOUT);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::FADEIN);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::FADEOUT);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.BLOCK_ID');
+ $criteria->addSelectColumn($alias . '.FILE_ID');
+ $criteria->addSelectColumn($alias . '.POSITION');
+ $criteria->addSelectColumn($alias . '.CLIPLENGTH');
+ $criteria->addSelectColumn($alias . '.CUEIN');
+ $criteria->addSelectColumn($alias . '.CUEOUT');
+ $criteria->addSelectColumn($alias . '.FADEIN');
+ $criteria->addSelectColumn($alias . '.FADEOUT');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcBlockcontentsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+ /**
+ * Method to select one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcBlockcontents
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = CcBlockcontentsPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+ /**
+ * Method to do selects.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return CcBlockcontentsPeer::populateObjects(CcBlockcontentsPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param CcBlockcontents $value A CcBlockcontents object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool(CcBlockcontents $obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A CcBlockcontents object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcBlockcontents) {
+ $key = (string) $value->getDbId();
+ } elseif (is_scalar($value)) {
+ // assume we've been passed a primary key
+ $key = (string) $value;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcBlockcontents object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return CcBlockcontents Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(self::$instances[$key])) {
+ return self::$instances[$key];
+ }
+ }
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ self::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_blockcontents
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or NULL if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[$startcol] === null) {
+ return null;
+ }
+ return (string) $row[$startcol];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+ return (int) $row[$startcol];
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = CcBlockcontentsPeer::getOMClass(false);
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcBlockcontentsPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ CcBlockcontentsPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (CcBlockcontents object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcBlockcontentsPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + CcBlockcontentsPeer::NUM_COLUMNS;
+ } else {
+ $cls = CcBlockcontentsPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcBlockcontentsPeer::addInstanceToPool($obj, $key);
+ }
+ return array($obj, $col);
+ }
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcFiles table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcBlockcontentsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcBlock table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCcBlock(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcBlockcontentsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of CcBlockcontents objects pre-filled with their CcFiles objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcBlockcontents objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ $startcol = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcFilesPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockcontentsPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CcBlockcontentsPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockcontentsPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcFilesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcFilesPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcBlockcontents) to $obj2 (CcFiles)
+ $obj2->addCcBlockcontents($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of CcBlockcontents objects pre-filled with their CcBlock objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcBlockcontents objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcBlock(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ $startcol = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcBlockPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockcontentsPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CcBlockcontentsPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockcontentsPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcBlockPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcBlockPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcBlockPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcBlockcontents) to $obj2 (CcBlock)
+ $obj2->addCcBlockcontents($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcBlockcontentsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+ /**
+ * Selects a collection of CcBlockcontents objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcBlockcontents objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ $startcol2 = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockcontentsPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcBlockcontentsPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockcontentsPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcFiles rows
+
+ $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcFilesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcFilesPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcBlockcontents) to the collection in $obj2 (CcFiles)
+ $obj2->addCcBlockcontents($obj1);
+ } // if joined row not null
+
+ // Add objects for joined CcBlock rows
+
+ $key3 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcBlockPeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcBlockPeer::getOMClass(false);
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcBlockPeer::addInstanceToPool($obj3, $key3);
+ } // if obj3 loaded
+
+ // Add the $obj1 (CcBlockcontents) to the collection in $obj3 (CcBlock)
+ $obj3->addCcBlockcontents($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcFiles table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAllExceptCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcBlockcontentsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcBlock table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAllExceptCcBlock(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcBlockcontentsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of CcBlockcontents objects pre-filled with all related objects except CcFiles.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcBlockcontents objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAllExceptCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ // $criteria->getDbName() will return the same object if not set to another value
+ // so == check is okay and faster
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ $startcol2 = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockcontentsPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcBlockcontentsPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockcontentsPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcBlock rows
+
+ $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcBlockPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcBlockPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcBlockPeer::addInstanceToPool($obj2, $key2);
+ } // if $obj2 already loaded
+
+ // Add the $obj1 (CcBlockcontents) to the collection in $obj2 (CcBlock)
+ $obj2->addCcBlockcontents($obj1);
+
+ } // if joined row is not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of CcBlockcontents objects pre-filled with all related objects except CcBlock.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcBlockcontents objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAllExceptCcBlock(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ // $criteria->getDbName() will return the same object if not set to another value
+ // so == check is okay and faster
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ $startcol2 = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockcontentsPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcBlockcontentsPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockcontentsPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcFiles rows
+
+ $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcFilesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcFilesPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if $obj2 already loaded
+
+ // Add the $obj1 (CcBlockcontents) to the collection in $obj2 (CcFiles)
+ $obj2->addCcBlockcontents($obj1);
+
+ } // if joined row is not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcBlockcontentsPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcBlockcontentsPeer::TABLE_NAME))
+ {
+ $dbMap->addTableObject(new CcBlockcontentsTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is tranalted into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? CcBlockcontentsPeer::CLASS_DEFAULT : CcBlockcontentsPeer::OM_CLASS;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a CcBlockcontents or Criteria object.
+ *
+ * @param mixed $values Criteria or CcBlockcontents object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcBlockcontents object
+ }
+
+ if ($criteria->containsKey(CcBlockcontentsPeer::ID) && $criteria->keyContainsValue(CcBlockcontentsPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockcontentsPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Method perform an UPDATE on the database, given a CcBlockcontents or Criteria object.
+ *
+ * @param mixed $values Criteria or CcBlockcontents object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcBlockcontentsPeer::ID);
+ $value = $criteria->remove(CcBlockcontentsPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcBlockcontentsPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcBlockcontentsPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcBlockcontents object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Method to DELETE all rows from the cc_blockcontents table.
+ *
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(CcBlockcontentsPeer::TABLE_NAME, $con, CcBlockcontentsPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ CcBlockcontentsPeer::clearInstancePool();
+ CcBlockcontentsPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a CcBlockcontents or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcBlockcontents object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ CcBlockcontentsPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcBlockcontents) { // it's a model object
+ // invalidate the cache for this single object
+ CcBlockcontentsPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(CcBlockcontentsPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcBlockcontentsPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ CcBlockcontentsPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcBlockcontents object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param CcBlockcontents $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate(CcBlockcontents $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcBlockcontentsPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcBlockcontentsPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcBlockcontentsPeer::DATABASE_NAME, CcBlockcontentsPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcBlockcontents
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcBlockcontentsPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcBlockcontentsPeer::DATABASE_NAME);
+ $criteria->add(CcBlockcontentsPeer::ID, $pk);
+
+ $v = CcBlockcontentsPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param PropelPDO $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcBlockcontentsPeer::DATABASE_NAME);
+ $criteria->add(CcBlockcontentsPeer::ID, $pks, Criteria::IN);
+ $objs = CcBlockcontentsPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+} // BaseCcBlockcontentsPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCcBlockcontentsPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsQuery.php
new file mode 100644
index 000000000..6cc00d53c
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsQuery.php
@@ -0,0 +1,640 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+ return $query;
+ }
+
+ /**
+ * Find object by primary key
+ * Use instance pooling to avoid a database query if the object exists
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcBlockcontents|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ((null !== ($obj = CcBlockcontentsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
+ // the object is alredy in the instance pool
+ return $obj;
+ } else {
+ // the object has not been requested yet, or the formatter is not an object formatter
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->getSelectStatement($con);
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ return $this
+ ->filterByPrimaryKeys($keys)
+ ->find($con);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ return $this->addUsingAlias(CcBlockcontentsPeer::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ return $this->addUsingAlias(CcBlockcontentsPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * @param int|array $dbId 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 CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ return $this->addUsingAlias(CcBlockcontentsPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the block_id column
+ *
+ * @param int|array $dbBlockId 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 CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbBlockId($dbBlockId = null, $comparison = null)
+ {
+ if (is_array($dbBlockId)) {
+ $useMinMax = false;
+ if (isset($dbBlockId['min'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $dbBlockId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbBlockId['max'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $dbBlockId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $dbBlockId, $comparison);
+ }
+
+ /**
+ * Filter the query on the file_id column
+ *
+ * @param int|array $dbFileId 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 CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbFileId($dbFileId = null, $comparison = null)
+ {
+ if (is_array($dbFileId)) {
+ $useMinMax = false;
+ if (isset($dbFileId['min'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbFileId['max'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcBlockcontentsPeer::FILE_ID, $dbFileId, $comparison);
+ }
+
+ /**
+ * Filter the query on the position column
+ *
+ * @param int|array $dbPosition 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 CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbPosition($dbPosition = null, $comparison = null)
+ {
+ if (is_array($dbPosition)) {
+ $useMinMax = false;
+ if (isset($dbPosition['min'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::POSITION, $dbPosition['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbPosition['max'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::POSITION, $dbPosition['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcBlockcontentsPeer::POSITION, $dbPosition, $comparison);
+ }
+
+ /**
+ * Filter the query on the cliplength column
+ *
+ * @param string $dbCliplength The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbCliplength($dbCliplength = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCliplength)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCliplength)) {
+ $dbCliplength = str_replace('*', '%', $dbCliplength);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcBlockcontentsPeer::CLIPLENGTH, $dbCliplength, $comparison);
+ }
+
+ /**
+ * Filter the query on the cuein column
+ *
+ * @param string $dbCuein The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbCuein($dbCuein = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCuein)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCuein)) {
+ $dbCuein = str_replace('*', '%', $dbCuein);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcBlockcontentsPeer::CUEIN, $dbCuein, $comparison);
+ }
+
+ /**
+ * Filter the query on the cueout column
+ *
+ * @param string $dbCueout The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbCueout($dbCueout = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCueout)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCueout)) {
+ $dbCueout = str_replace('*', '%', $dbCueout);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcBlockcontentsPeer::CUEOUT, $dbCueout, $comparison);
+ }
+
+ /**
+ * Filter the query on the fadein column
+ *
+ * @param string|array $dbFadein 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 CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbFadein($dbFadein = null, $comparison = null)
+ {
+ if (is_array($dbFadein)) {
+ $useMinMax = false;
+ if (isset($dbFadein['min'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::FADEIN, $dbFadein['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbFadein['max'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::FADEIN, $dbFadein['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcBlockcontentsPeer::FADEIN, $dbFadein, $comparison);
+ }
+
+ /**
+ * Filter the query on the fadeout column
+ *
+ * @param string|array $dbFadeout 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 CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbFadeout($dbFadeout = null, $comparison = null)
+ {
+ if (is_array($dbFadeout)) {
+ $useMinMax = false;
+ if (isset($dbFadeout['min'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::FADEOUT, $dbFadeout['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbFadeout['max'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::FADEOUT, $dbFadeout['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcBlockcontentsPeer::FADEOUT, $dbFadeout, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcFiles object
+ *
+ * @param CcFiles $ccFiles the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByCcFiles($ccFiles, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcBlockcontentsPeer::FILE_ID, $ccFiles->getDbId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcFiles relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcFiles');
+
+ // 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, 'CcFiles');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcFiles relation CcFiles 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 CcFilesQuery A secondary query class using the current class as primary query
+ */
+ public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcFiles($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcBlock object
+ *
+ * @param CcBlock $ccBlock the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByCcBlock($ccBlock, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $ccBlock->getDbId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcBlock relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function joinCcBlock($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcBlock');
+
+ // 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, 'CcBlock');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcBlock relation CcBlock 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 CcBlockQuery A secondary query class using the current class as primary query
+ */
+ public function useCcBlockQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcBlock($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcBlock', 'CcBlockQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcBlockcontents $ccBlockcontents Object to remove from the list of results
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function prune($ccBlockcontents = null)
+ {
+ if ($ccBlockcontents) {
+ $this->addUsingAlias(CcBlockcontentsPeer::ID, $ccBlockcontents->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Code to execute before every DELETE statement
+ *
+ * @param PropelPDO $con The connection object used by the query
+ */
+ protected function basePreDelete(PropelPDO $con)
+ {
+ // aggregate_column_relation behavior
+ $this->findRelatedCcBlocks($con);
+
+ return $this->preDelete($con);
+ }
+
+ /**
+ * Code to execute after every DELETE statement
+ *
+ * @param int $affectedRows the number of deleted rows
+ * @param PropelPDO $con The connection object used by the query
+ */
+ protected function basePostDelete($affectedRows, PropelPDO $con)
+ {
+ // aggregate_column_relation behavior
+ $this->updateRelatedCcBlocks($con);
+
+ return $this->postDelete($affectedRows, $con);
+ }
+
+ /**
+ * Code to execute before every UPDATE statement
+ *
+ * @param array $values The associatiove array of columns and values for the update
+ * @param PropelPDO $con The connection object used by the query
+ * @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), ortherwise it is a series of save() calls on all the found objects
+ */
+ protected function basePreUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false)
+ {
+ // aggregate_column_relation behavior
+ $this->findRelatedCcBlocks($con);
+
+ return $this->preUpdate($values, $con, $forceIndividualSaves);
+ }
+
+ /**
+ * Code to execute after every UPDATE statement
+ *
+ * @param int $affectedRows the number of udated rows
+ * @param PropelPDO $con The connection object used by the query
+ */
+ protected function basePostUpdate($affectedRows, PropelPDO $con)
+ {
+ // aggregate_column_relation behavior
+ $this->updateRelatedCcBlocks($con);
+
+ return $this->postUpdate($affectedRows, $con);
+ }
+
+ // aggregate_column_relation behavior
+
+ /**
+ * Finds the related CcBlock objects and keep them for later
+ *
+ * @param PropelPDO $con A connection object
+ */
+ protected function findRelatedCcBlocks($con)
+ {
+ $criteria = clone $this;
+ if ($this->useAliasInSQL) {
+ $alias = $this->getModelAlias();
+ $criteria->removeAlias($alias);
+ } else {
+ $alias = '';
+ }
+ $this->ccBlocks = CcBlockQuery::create()
+ ->joinCcBlockcontents($alias)
+ ->mergeWith($criteria)
+ ->find($con);
+ }
+
+ protected function updateRelatedCcBlocks($con)
+ {
+ foreach ($this->ccBlocks as $ccBlock) {
+ $ccBlock->updateDbLength($con);
+ }
+ $this->ccBlocks = array();
+ }
+
+} // BaseCcBlockcontentsQuery
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteria.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteria.php
new file mode 100644
index 000000000..2982a3b86
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteria.php
@@ -0,0 +1,1001 @@
+id;
+ }
+
+ /**
+ * Get the [criteria] column value.
+ *
+ * @return string
+ */
+ public function getDbCriteria()
+ {
+ return $this->criteria;
+ }
+
+ /**
+ * Get the [modifier] column value.
+ *
+ * @return string
+ */
+ public function getDbModifier()
+ {
+ return $this->modifier;
+ }
+
+ /**
+ * Get the [value] column value.
+ *
+ * @return string
+ */
+ public function getDbValue()
+ {
+ return $this->value;
+ }
+
+ /**
+ * Get the [extra] column value.
+ *
+ * @return string
+ */
+ public function getDbExtra()
+ {
+ return $this->extra;
+ }
+
+ /**
+ * Get the [block_id] column value.
+ *
+ * @return int
+ */
+ public function getDbBlockId()
+ {
+ return $this->block_id;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcBlockcriteria The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcBlockcriteriaPeer::ID;
+ }
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [criteria] column.
+ *
+ * @param string $v new value
+ * @return CcBlockcriteria The current object (for fluent API support)
+ */
+ public function setDbCriteria($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->criteria !== $v) {
+ $this->criteria = $v;
+ $this->modifiedColumns[] = CcBlockcriteriaPeer::CRITERIA;
+ }
+
+ return $this;
+ } // setDbCriteria()
+
+ /**
+ * Set the value of [modifier] column.
+ *
+ * @param string $v new value
+ * @return CcBlockcriteria The current object (for fluent API support)
+ */
+ public function setDbModifier($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->modifier !== $v) {
+ $this->modifier = $v;
+ $this->modifiedColumns[] = CcBlockcriteriaPeer::MODIFIER;
+ }
+
+ return $this;
+ } // setDbModifier()
+
+ /**
+ * Set the value of [value] column.
+ *
+ * @param string $v new value
+ * @return CcBlockcriteria The current object (for fluent API support)
+ */
+ public function setDbValue($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->value !== $v) {
+ $this->value = $v;
+ $this->modifiedColumns[] = CcBlockcriteriaPeer::VALUE;
+ }
+
+ return $this;
+ } // setDbValue()
+
+ /**
+ * Set the value of [extra] column.
+ *
+ * @param string $v new value
+ * @return CcBlockcriteria The current object (for fluent API support)
+ */
+ public function setDbExtra($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->extra !== $v) {
+ $this->extra = $v;
+ $this->modifiedColumns[] = CcBlockcriteriaPeer::EXTRA;
+ }
+
+ return $this;
+ } // setDbExtra()
+
+ /**
+ * Set the value of [block_id] column.
+ *
+ * @param int $v new value
+ * @return CcBlockcriteria The current object (for fluent API support)
+ */
+ public function setDbBlockId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->block_id !== $v) {
+ $this->block_id = $v;
+ $this->modifiedColumns[] = CcBlockcriteriaPeer::BLOCK_ID;
+ }
+
+ if ($this->aCcBlock !== null && $this->aCcBlock->getDbId() !== $v) {
+ $this->aCcBlock = null;
+ }
+
+ return $this;
+ } // setDbBlockId()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->criteria = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->modifier = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->value = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->extra = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->block_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = CcBlockcriteriaPeer::NUM_COLUMNS - CcBlockcriteriaPeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcBlockcriteria object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aCcBlock !== null && $this->block_id !== $this->aCcBlock->getDbId()) {
+ $this->aCcBlock = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = CcBlockcriteriaPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aCcBlock = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ CcBlockcriteriaQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey())
+ ->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ CcBlockcriteriaPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcBlock !== null) {
+ if ($this->aCcBlock->isModified() || $this->aCcBlock->isNew()) {
+ $affectedRows += $this->aCcBlock->save($con);
+ }
+ $this->setCcBlock($this->aCcBlock);
+ }
+
+ if ($this->isNew() ) {
+ $this->modifiedColumns[] = CcBlockcriteriaPeer::ID;
+ }
+
+ // If this object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $criteria = $this->buildCriteria();
+ if ($criteria->keyContainsValue(CcBlockcriteriaPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockcriteriaPeer::ID.')');
+ }
+
+ $pk = BasePeer::doInsert($criteria, $con);
+ $affectedRows += 1;
+ $this->setDbId($pk); //[IMV] update autoincrement primary key
+ $this->setNew(false);
+ } else {
+ $affectedRows += CcBlockcriteriaPeer::doUpdate($this, $con);
+ }
+
+ $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true
is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true
if all validations pass; array of ValidationFailed
objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcBlock !== null) {
+ if (!$this->aCcBlock->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcBlock->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcBlockcriteriaPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcBlockcriteriaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getDbId();
+ break;
+ case 1:
+ return $this->getDbCriteria();
+ break;
+ case 2:
+ return $this->getDbModifier();
+ break;
+ case 3:
+ return $this->getDbValue();
+ break;
+ case 4:
+ return $this->getDbExtra();
+ break;
+ case 5:
+ return $this->getDbBlockId();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false)
+ {
+ $keys = CcBlockcriteriaPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbCriteria(),
+ $keys[2] => $this->getDbModifier(),
+ $keys[3] => $this->getDbValue(),
+ $keys[4] => $this->getDbExtra(),
+ $keys[5] => $this->getDbBlockId(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcBlock) {
+ $result['CcBlock'] = $this->aCcBlock->toArray($keyType, $includeLazyLoadColumns, true);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcBlockcriteriaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setDbId($value);
+ break;
+ case 1:
+ $this->setDbCriteria($value);
+ break;
+ case 2:
+ $this->setDbModifier($value);
+ break;
+ case 3:
+ $this->setDbValue($value);
+ break;
+ case 4:
+ $this->setDbExtra($value);
+ break;
+ case 5:
+ $this->setDbBlockId($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's phpname (e.g. 'AuthorId')
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = CcBlockcriteriaPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbCriteria($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbModifier($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbValue($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbExtra($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbBlockId($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(CcBlockcriteriaPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcBlockcriteriaPeer::ID)) $criteria->add(CcBlockcriteriaPeer::ID, $this->id);
+ if ($this->isColumnModified(CcBlockcriteriaPeer::CRITERIA)) $criteria->add(CcBlockcriteriaPeer::CRITERIA, $this->criteria);
+ if ($this->isColumnModified(CcBlockcriteriaPeer::MODIFIER)) $criteria->add(CcBlockcriteriaPeer::MODIFIER, $this->modifier);
+ if ($this->isColumnModified(CcBlockcriteriaPeer::VALUE)) $criteria->add(CcBlockcriteriaPeer::VALUE, $this->value);
+ if ($this->isColumnModified(CcBlockcriteriaPeer::EXTRA)) $criteria->add(CcBlockcriteriaPeer::EXTRA, $this->extra);
+ if ($this->isColumnModified(CcBlockcriteriaPeer::BLOCK_ID)) $criteria->add(CcBlockcriteriaPeer::BLOCK_ID, $this->block_id);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(CcBlockcriteriaPeer::DATABASE_NAME);
+ $criteria->add(CcBlockcriteriaPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getDbId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setDbId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+ return null === $this->getDbId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of CcBlockcriteria (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+ $copyObj->setDbCriteria($this->criteria);
+ $copyObj->setDbModifier($this->modifier);
+ $copyObj->setDbValue($this->value);
+ $copyObj->setDbExtra($this->extra);
+ $copyObj->setDbBlockId($this->block_id);
+
+ $copyObj->setNew(true);
+ $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return CcBlockcriteria Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return CcBlockcriteriaPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcBlockcriteriaPeer();
+ }
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcBlock object.
+ *
+ * @param CcBlock $v
+ * @return CcBlockcriteria The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcBlock(CcBlock $v = null)
+ {
+ if ($v === null) {
+ $this->setDbBlockId(NULL);
+ } else {
+ $this->setDbBlockId($v->getDbId());
+ }
+
+ $this->aCcBlock = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcBlock object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcBlockcriteria($this);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcBlock object
+ *
+ * @param PropelPDO Optional Connection object.
+ * @return CcBlock The associated CcBlock object.
+ * @throws PropelException
+ */
+ public function getCcBlock(PropelPDO $con = null)
+ {
+ if ($this->aCcBlock === null && ($this->block_id !== null)) {
+ $this->aCcBlock = CcBlockQuery::create()->findPk($this->block_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCcBlock->addCcBlockcriterias($this);
+ */
+ }
+ return $this->aCcBlock;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->criteria = null;
+ $this->modifier = null;
+ $this->value = null;
+ $this->extra = null;
+ $this->block_id = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all collections of referencing foreign keys.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect objects
+ * with circular references. This is currently necessary when using Propel in certain
+ * daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all associated objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aCcBlock = null;
+ }
+
+ /**
+ * Catches calls to virtual methods
+ */
+ public function __call($name, $params)
+ {
+ if (preg_match('/get(\w+)/', $name, $matches)) {
+ $virtualColumn = $matches[1];
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ // no lcfirst in php<5.3...
+ $virtualColumn[0] = strtolower($virtualColumn[0]);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+ throw new PropelException('Call to undefined method: ' . $name);
+ }
+
+} // BaseCcBlockcriteria
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaPeer.php
new file mode 100644
index 000000000..a523024ad
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaPeer.php
@@ -0,0 +1,993 @@
+ array ('DbId', 'DbCriteria', 'DbModifier', 'DbValue', 'DbExtra', 'DbBlockId', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbCriteria', 'dbModifier', 'dbValue', 'dbExtra', 'dbBlockId', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::CRITERIA, self::MODIFIER, self::VALUE, self::EXTRA, self::BLOCK_ID, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CRITERIA', 'MODIFIER', 'VALUE', 'EXTRA', 'BLOCK_ID', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'criteria', 'modifier', 'value', 'extra', 'block_id', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbCriteria' => 1, 'DbModifier' => 2, 'DbValue' => 3, 'DbExtra' => 4, 'DbBlockId' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbCriteria' => 1, 'dbModifier' => 2, 'dbValue' => 3, 'dbExtra' => 4, 'dbBlockId' => 5, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::CRITERIA => 1, self::MODIFIER => 2, self::VALUE => 3, self::EXTRA => 4, self::BLOCK_ID => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CRITERIA' => 1, 'MODIFIER' => 2, 'VALUE' => 3, 'EXTRA' => 4, 'BLOCK_ID' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'criteria' => 1, 'modifier' => 2, 'value' => 3, 'extra' => 4, 'block_id' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ */
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. CcBlockcriteriaPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcBlockcriteriaPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(CcBlockcriteriaPeer::ID);
+ $criteria->addSelectColumn(CcBlockcriteriaPeer::CRITERIA);
+ $criteria->addSelectColumn(CcBlockcriteriaPeer::MODIFIER);
+ $criteria->addSelectColumn(CcBlockcriteriaPeer::VALUE);
+ $criteria->addSelectColumn(CcBlockcriteriaPeer::EXTRA);
+ $criteria->addSelectColumn(CcBlockcriteriaPeer::BLOCK_ID);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.CRITERIA');
+ $criteria->addSelectColumn($alias . '.MODIFIER');
+ $criteria->addSelectColumn($alias . '.VALUE');
+ $criteria->addSelectColumn($alias . '.EXTRA');
+ $criteria->addSelectColumn($alias . '.BLOCK_ID');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcBlockcriteriaPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcriteriaPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+ /**
+ * Method to select one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcBlockcriteria
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = CcBlockcriteriaPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+ /**
+ * Method to do selects.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return CcBlockcriteriaPeer::populateObjects(CcBlockcriteriaPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcBlockcriteriaPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param CcBlockcriteria $value A CcBlockcriteria object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool(CcBlockcriteria $obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A CcBlockcriteria object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcBlockcriteria) {
+ $key = (string) $value->getDbId();
+ } elseif (is_scalar($value)) {
+ // assume we've been passed a primary key
+ $key = (string) $value;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcBlockcriteria object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return CcBlockcriteria Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(self::$instances[$key])) {
+ return self::$instances[$key];
+ }
+ }
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ self::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_blockcriteria
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or NULL if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[$startcol] === null) {
+ return null;
+ }
+ return (string) $row[$startcol];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+ return (int) $row[$startcol];
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = CcBlockcriteriaPeer::getOMClass(false);
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcBlockcriteriaPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcBlockcriteriaPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ CcBlockcriteriaPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (CcBlockcriteria object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcBlockcriteriaPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcBlockcriteriaPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + CcBlockcriteriaPeer::NUM_COLUMNS;
+ } else {
+ $cls = CcBlockcriteriaPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcBlockcriteriaPeer::addInstanceToPool($obj, $key);
+ }
+ return array($obj, $col);
+ }
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcBlock table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCcBlock(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcBlockcriteriaPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcriteriaPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockcriteriaPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of CcBlockcriteria objects pre-filled with their CcBlock objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcBlockcriteria objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcBlock(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcBlockcriteriaPeer::addSelectColumns($criteria);
+ $startcol = (CcBlockcriteriaPeer::NUM_COLUMNS - CcBlockcriteriaPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcBlockPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcBlockcriteriaPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockcriteriaPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockcriteriaPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CcBlockcriteriaPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockcriteriaPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcBlockPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcBlockPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcBlockPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcBlockcriteria) to $obj2 (CcBlock)
+ $obj2->addCcBlockcriteria($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcBlockcriteriaPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcriteriaPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockcriteriaPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+ /**
+ * Selects a collection of CcBlockcriteria objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcBlockcriteria objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcBlockcriteriaPeer::addSelectColumns($criteria);
+ $startcol2 = (CcBlockcriteriaPeer::NUM_COLUMNS - CcBlockcriteriaPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcBlockcriteriaPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockcriteriaPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockcriteriaPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcBlockcriteriaPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockcriteriaPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcBlock rows
+
+ $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcBlockPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcBlockPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcBlockPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcBlockcriteria) to the collection in $obj2 (CcBlock)
+ $obj2->addCcBlockcriteria($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcBlockcriteriaPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcBlockcriteriaPeer::TABLE_NAME))
+ {
+ $dbMap->addTableObject(new CcBlockcriteriaTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is tranalted into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? CcBlockcriteriaPeer::CLASS_DEFAULT : CcBlockcriteriaPeer::OM_CLASS;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a CcBlockcriteria or Criteria object.
+ *
+ * @param mixed $values Criteria or CcBlockcriteria object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcBlockcriteria object
+ }
+
+ if ($criteria->containsKey(CcBlockcriteriaPeer::ID) && $criteria->keyContainsValue(CcBlockcriteriaPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockcriteriaPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Method perform an UPDATE on the database, given a CcBlockcriteria or Criteria object.
+ *
+ * @param mixed $values Criteria or CcBlockcriteria object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcBlockcriteriaPeer::ID);
+ $value = $criteria->remove(CcBlockcriteriaPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcBlockcriteriaPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcBlockcriteriaPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcBlockcriteria object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Method to DELETE all rows from the cc_blockcriteria table.
+ *
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(CcBlockcriteriaPeer::TABLE_NAME, $con, CcBlockcriteriaPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ CcBlockcriteriaPeer::clearInstancePool();
+ CcBlockcriteriaPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a CcBlockcriteria or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcBlockcriteria object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ CcBlockcriteriaPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcBlockcriteria) { // it's a model object
+ // invalidate the cache for this single object
+ CcBlockcriteriaPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(CcBlockcriteriaPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcBlockcriteriaPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ CcBlockcriteriaPeer::clearRelatedInstancePool();
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcBlockcriteria object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param CcBlockcriteria $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate(CcBlockcriteria $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcBlockcriteriaPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcBlockcriteriaPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcBlockcriteriaPeer::DATABASE_NAME, CcBlockcriteriaPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcBlockcriteria
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcBlockcriteriaPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcBlockcriteriaPeer::DATABASE_NAME);
+ $criteria->add(CcBlockcriteriaPeer::ID, $pk);
+
+ $v = CcBlockcriteriaPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param PropelPDO $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcBlockcriteriaPeer::DATABASE_NAME);
+ $criteria->add(CcBlockcriteriaPeer::ID, $pks, Criteria::IN);
+ $objs = CcBlockcriteriaPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+} // BaseCcBlockcriteriaPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCcBlockcriteriaPeer::buildTableMap();
+
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaQuery.php
new file mode 100644
index 000000000..9baabbd74
--- /dev/null
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaQuery.php
@@ -0,0 +1,372 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+ return $query;
+ }
+
+ /**
+ * Find object by primary key
+ * Use instance pooling to avoid a database query if the object exists
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcBlockcriteria|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ((null !== ($obj = CcBlockcriteriaPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
+ // the object is alredy in the instance pool
+ return $obj;
+ } else {
+ // the object has not been requested yet, or the formatter is not an object formatter
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->getSelectStatement($con);
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ return $this
+ ->filterByPrimaryKeys($keys)
+ ->find($con);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ return $this->addUsingAlias(CcBlockcriteriaPeer::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ return $this->addUsingAlias(CcBlockcriteriaPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * @param int|array $dbId 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 CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ return $this->addUsingAlias(CcBlockcriteriaPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the criteria column
+ *
+ * @param string $dbCriteria The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByDbCriteria($dbCriteria = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCriteria)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCriteria)) {
+ $dbCriteria = str_replace('*', '%', $dbCriteria);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcBlockcriteriaPeer::CRITERIA, $dbCriteria, $comparison);
+ }
+
+ /**
+ * Filter the query on the modifier column
+ *
+ * @param string $dbModifier The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByDbModifier($dbModifier = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbModifier)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbModifier)) {
+ $dbModifier = str_replace('*', '%', $dbModifier);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcBlockcriteriaPeer::MODIFIER, $dbModifier, $comparison);
+ }
+
+ /**
+ * Filter the query on the value column
+ *
+ * @param string $dbValue The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByDbValue($dbValue = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbValue)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbValue)) {
+ $dbValue = str_replace('*', '%', $dbValue);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcBlockcriteriaPeer::VALUE, $dbValue, $comparison);
+ }
+
+ /**
+ * Filter the query on the extra column
+ *
+ * @param string $dbExtra The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByDbExtra($dbExtra = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbExtra)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbExtra)) {
+ $dbExtra = str_replace('*', '%', $dbExtra);
+ $comparison = Criteria::LIKE;
+ }
+ }
+ return $this->addUsingAlias(CcBlockcriteriaPeer::EXTRA, $dbExtra, $comparison);
+ }
+
+ /**
+ * Filter the query on the block_id column
+ *
+ * @param int|array $dbBlockId 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 CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByDbBlockId($dbBlockId = null, $comparison = null)
+ {
+ if (is_array($dbBlockId)) {
+ $useMinMax = false;
+ if (isset($dbBlockId['min'])) {
+ $this->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $dbBlockId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbBlockId['max'])) {
+ $this->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $dbBlockId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $dbBlockId, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcBlock object
+ *
+ * @param CcBlock $ccBlock the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByCcBlock($ccBlock, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $ccBlock->getDbId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcBlock relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function joinCcBlock($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcBlock');
+
+ // 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, 'CcBlock');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcBlock relation CcBlock 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 CcBlockQuery A secondary query class using the current class as primary query
+ */
+ public function useCcBlockQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcBlock($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcBlock', 'CcBlockQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcBlockcriteria $ccBlockcriteria Object to remove from the list of results
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function prune($ccBlockcriteria = null)
+ {
+ if ($ccBlockcriteria) {
+ $this->addUsingAlias(CcBlockcriteriaPeer::ID, $ccBlockcriteria->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+} // BaseCcBlockcriteriaQuery
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php
index 9473418db..807e21696 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php
@@ -436,6 +436,11 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
*/
protected $collCcPlaylistcontentss;
+ /**
+ * @var array CcBlockcontents[] Collection to store aggregation of CcBlockcontents objects.
+ */
+ protected $collCcBlockcontentss;
+
/**
* @var array CcSchedule[] Collection to store aggregation of CcSchedule objects.
*/
@@ -2829,6 +2834,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
$this->collCcPlaylistcontentss = null;
+ $this->collCcBlockcontentss = null;
+
$this->collCcSchedules = null;
} // if (deep)
@@ -2999,6 +3006,14 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
}
}
+ if ($this->collCcBlockcontentss !== null) {
+ foreach ($this->collCcBlockcontentss as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
if ($this->collCcSchedules !== null) {
foreach ($this->collCcSchedules as $referrerFK) {
if (!$referrerFK->isDeleted()) {
@@ -3112,6 +3127,14 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
}
}
+ if ($this->collCcBlockcontentss !== null) {
+ foreach ($this->collCcBlockcontentss as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
if ($this->collCcSchedules !== null) {
foreach ($this->collCcSchedules as $referrerFK) {
if (!$referrerFK->validate($columns)) {
@@ -3969,6 +3992,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
}
}
+ foreach ($this->getCcBlockcontentss() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcBlockcontents($relObj->copy($deepCopy));
+ }
+ }
+
foreach ($this->getCcSchedules() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCcSchedule($relObj->copy($deepCopy));
@@ -4387,6 +4416,31 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
}
+ /**
+ * 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 CcPlaylistcontentss 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 CcPlaylistcontents[] List of CcPlaylistcontents objects
+ */
+ public function getCcPlaylistcontentssJoinCcBlock($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcPlaylistcontentsQuery::create(null, $criteria);
+ $query->joinWith('CcBlock', $join_behavior);
+
+ return $this->getCcPlaylistcontentss($query, $con);
+ }
+
+
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
@@ -4411,6 +4465,140 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
return $this->getCcPlaylistcontentss($query, $con);
}
+ /**
+ * Clears out the collCcBlockcontentss 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 addCcBlockcontentss()
+ */
+ public function clearCcBlockcontentss()
+ {
+ $this->collCcBlockcontentss = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Initializes the collCcBlockcontentss collection.
+ *
+ * By default this just sets the collCcBlockcontentss collection to an empty array (like clearcollCcBlockcontentss());
+ * 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 initCcBlockcontentss()
+ {
+ $this->collCcBlockcontentss = new PropelObjectCollection();
+ $this->collCcBlockcontentss->setModel('CcBlockcontents');
+ }
+
+ /**
+ * Gets an array of CcBlockcontents 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 CcBlockcontents[] List of CcBlockcontents objects
+ * @throws PropelException
+ */
+ public function getCcBlockcontentss($criteria = null, PropelPDO $con = null)
+ {
+ if(null === $this->collCcBlockcontentss || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcBlockcontentss) {
+ // return empty collection
+ $this->initCcBlockcontentss();
+ } else {
+ $collCcBlockcontentss = CcBlockcontentsQuery::create(null, $criteria)
+ ->filterByCcFiles($this)
+ ->find($con);
+ if (null !== $criteria) {
+ return $collCcBlockcontentss;
+ }
+ $this->collCcBlockcontentss = $collCcBlockcontentss;
+ }
+ }
+ return $this->collCcBlockcontentss;
+ }
+
+ /**
+ * Returns the number of related CcBlockcontents objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcBlockcontents objects.
+ * @throws PropelException
+ */
+ public function countCcBlockcontentss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ if(null === $this->collCcBlockcontentss || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcBlockcontentss) {
+ return 0;
+ } else {
+ $query = CcBlockcontentsQuery::create(null, $criteria);
+ if($distinct) {
+ $query->distinct();
+ }
+ return $query
+ ->filterByCcFiles($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collCcBlockcontentss);
+ }
+ }
+
+ /**
+ * Method called to associate a CcBlockcontents object to this object
+ * through the CcBlockcontents foreign key attribute.
+ *
+ * @param CcBlockcontents $l CcBlockcontents
+ * @return void
+ * @throws PropelException
+ */
+ public function addCcBlockcontents(CcBlockcontents $l)
+ {
+ if ($this->collCcBlockcontentss === null) {
+ $this->initCcBlockcontentss();
+ }
+ if (!$this->collCcBlockcontentss->contains($l)) { // only add it if the **same** object is not already associated
+ $this->collCcBlockcontentss[]= $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 CcBlockcontentss 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 CcBlockcontents[] List of CcBlockcontents objects
+ */
+ public function getCcBlockcontentssJoinCcBlock($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcBlockcontentsQuery::create(null, $criteria);
+ $query->joinWith('CcBlock', $join_behavior);
+
+ return $this->getCcBlockcontentss($query, $con);
+ }
+
/**
* Clears out the collCcSchedules collection
*
@@ -4645,6 +4833,11 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
+ if ($this->collCcBlockcontentss) {
+ foreach ((array) $this->collCcBlockcontentss as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
if ($this->collCcSchedules) {
foreach ((array) $this->collCcSchedules as $o) {
$o->clearAllReferences($deep);
@@ -4654,6 +4847,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
$this->collCcShowInstancess = null;
$this->collCcPlaylistcontentss = null;
+ $this->collCcBlockcontentss = null;
$this->collCcSchedules = null;
$this->aCcSubjs = 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 46e971785..eb6d15d2d 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php
@@ -659,6 +659,9 @@ abstract class BaseCcFilesPeer {
// 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 CcBlockcontentsPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcBlockcontentsPeer::clearInstancePool();
// Invalidate objects in CcSchedulePeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcSchedulePeer::clearInstancePool();
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php
index d3cef566a..c08ba557f 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php
@@ -156,6 +156,10 @@
* @method CcFilesQuery rightJoinCcPlaylistcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
* @method CcFilesQuery innerJoinCcPlaylistcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
*
+ * @method CcFilesQuery leftJoinCcBlockcontents($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlockcontents relation
+ * @method CcFilesQuery rightJoinCcBlockcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlockcontents relation
+ * @method CcFilesQuery innerJoinCcBlockcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlockcontents relation
+ *
* @method CcFilesQuery leftJoinCcSchedule($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSchedule relation
* @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
@@ -2172,6 +2176,70 @@ abstract class BaseCcFilesQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcontents', 'CcPlaylistcontentsQuery');
}
+ /**
+ * Filter the query by a related CcBlockcontents object
+ *
+ * @param CcBlockcontents $ccBlockcontents 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 filterByCcBlockcontents($ccBlockcontents, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcFilesPeer::ID, $ccBlockcontents->getDbFileId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcBlockcontents 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 joinCcBlockcontents($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcBlockcontents');
+
+ // 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, 'CcBlockcontents');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcBlockcontents relation CcBlockcontents 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 CcBlockcontentsQuery A secondary query class using the current class as primary query
+ */
+ public function useCcBlockcontentsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcBlockcontents($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcBlockcontents', 'CcBlockcontentsQuery');
+ }
+
/**
* Filter the query by a related CcSchedule object
*
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylist.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylist.php
index 5e8e9f23a..e1c683d0f 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylist.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylist.php
@@ -85,11 +85,6 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
*/
protected $collCcPlaylistcontentss;
- /**
- * @var array CcPlaylistcriteria[] Collection to store aggregation of CcPlaylistcriteria objects.
- */
- protected $collCcPlaylistcriterias;
-
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -603,8 +598,6 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
$this->aCcSubjs = null;
$this->collCcPlaylistcontentss = null;
- $this->collCcPlaylistcriterias = null;
-
} // if (deep)
}
@@ -758,14 +751,6 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
}
}
- if ($this->collCcPlaylistcriterias !== null) {
- foreach ($this->collCcPlaylistcriterias as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
$this->alreadyInSave = false;
}
@@ -857,14 +842,6 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
}
}
- if ($this->collCcPlaylistcriterias !== null) {
- foreach ($this->collCcPlaylistcriterias as $referrerFK) {
- if (!$referrerFK->validate($columns)) {
- $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
- }
- }
- }
-
$this->alreadyInValidation = false;
}
@@ -1145,12 +1122,6 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
}
}
- foreach ($this->getCcPlaylistcriterias() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcPlaylistcriteria($relObj->copy($deepCopy));
- }
- }
-
} // if ($deepCopy)
@@ -1379,113 +1350,29 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
return $this->getCcPlaylistcontentss($query, $con);
}
- /**
- * Clears out the collCcPlaylistcriterias 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 addCcPlaylistcriterias()
- */
- public function clearCcPlaylistcriterias()
- {
- $this->collCcPlaylistcriterias = null; // important to set this to NULL since that means it is uninitialized
- }
/**
- * Initializes the collCcPlaylistcriterias collection.
+ * 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 CcPlaylistcontentss from storage.
*
- * By default this just sets the collCcPlaylistcriterias collection to an empty array (like clearcollCcPlaylistcriterias());
- * 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 initCcPlaylistcriterias()
- {
- $this->collCcPlaylistcriterias = new PropelObjectCollection();
- $this->collCcPlaylistcriterias->setModel('CcPlaylistcriteria');
- }
-
- /**
- * Gets an array of CcPlaylistcriteria 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.
+ * 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
- * @return PropelCollection|array CcPlaylistcriteria[] List of CcPlaylistcriteria objects
- * @throws PropelException
+ * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return PropelCollection|array CcPlaylistcontents[] List of CcPlaylistcontents objects
*/
- public function getCcPlaylistcriterias($criteria = null, PropelPDO $con = null)
+ public function getCcPlaylistcontentssJoinCcBlock($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
- if(null === $this->collCcPlaylistcriterias || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcPlaylistcriterias) {
- // return empty collection
- $this->initCcPlaylistcriterias();
- } else {
- $collCcPlaylistcriterias = CcPlaylistcriteriaQuery::create(null, $criteria)
- ->filterByCcPlaylist($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcPlaylistcriterias;
- }
- $this->collCcPlaylistcriterias = $collCcPlaylistcriterias;
- }
- }
- return $this->collCcPlaylistcriterias;
- }
+ $query = CcPlaylistcontentsQuery::create(null, $criteria);
+ $query->joinWith('CcBlock', $join_behavior);
- /**
- * Returns the number of related CcPlaylistcriteria objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CcPlaylistcriteria objects.
- * @throws PropelException
- */
- public function countCcPlaylistcriterias(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcPlaylistcriterias || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcPlaylistcriterias) {
- return 0;
- } else {
- $query = CcPlaylistcriteriaQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByCcPlaylist($this)
- ->count($con);
- }
- } else {
- return count($this->collCcPlaylistcriterias);
- }
- }
-
- /**
- * Method called to associate a CcPlaylistcriteria object to this object
- * through the CcPlaylistcriteria foreign key attribute.
- *
- * @param CcPlaylistcriteria $l CcPlaylistcriteria
- * @return void
- * @throws PropelException
- */
- public function addCcPlaylistcriteria(CcPlaylistcriteria $l)
- {
- if ($this->collCcPlaylistcriterias === null) {
- $this->initCcPlaylistcriterias();
- }
- if (!$this->collCcPlaylistcriterias->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcPlaylistcriterias[]= $l;
- $l->setCcPlaylist($this);
- }
+ return $this->getCcPlaylistcontentss($query, $con);
}
/**
@@ -1527,15 +1414,9 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
- if ($this->collCcPlaylistcriterias) {
- foreach ((array) $this->collCcPlaylistcriterias as $o) {
- $o->clearAllReferences($deep);
- }
- }
} // if ($deep)
$this->collCcPlaylistcontentss = null;
- $this->collCcPlaylistcriterias = 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 16f69e6db..afc5c3b3c 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistPeer.php
@@ -376,9 +376,6 @@ 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 CcPlaylistcriteriaPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcPlaylistcriteriaPeer::clearInstancePool();
}
/**
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistQuery.php
index 4031f9755..3a912f866 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistQuery.php
@@ -36,10 +36,6 @@
* @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 leftJoinCcPlaylistcriteria($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlaylistcriteria relation
- * @method CcPlaylistQuery rightJoinCcPlaylistcriteria($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylistcriteria relation
- * @method CcPlaylistQuery innerJoinCcPlaylistcriteria($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylistcriteria 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
*
@@ -495,70 +491,6 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcontents', 'CcPlaylistcontentsQuery');
}
- /**
- * Filter the query by a related CcPlaylistcriteria object
- *
- * @param CcPlaylistcriteria $ccPlaylistcriteria 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 filterByCcPlaylistcriteria($ccPlaylistcriteria, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcPlaylistPeer::ID, $ccPlaylistcriteria->getDbPlaylistId(), $comparison);
- }
-
- /**
- * Adds a JOIN clause to the query using the CcPlaylistcriteria 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 joinCcPlaylistcriteria($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcPlaylistcriteria');
-
- // 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, 'CcPlaylistcriteria');
- }
-
- return $this;
- }
-
- /**
- * Use the CcPlaylistcriteria relation CcPlaylistcriteria 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 CcPlaylistcriteriaQuery A secondary query class using the current class as primary query
- */
- public function useCcPlaylistcriteriaQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCcPlaylistcriteria($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcriteria', 'CcPlaylistcriteriaQuery');
- }
-
/**
* Exclude object from result
*
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php
index 8f823a25e..572bc9849 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php
@@ -42,6 +42,12 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
*/
protected $file_id;
+ /**
+ * The value for the block_id field.
+ * @var int
+ */
+ protected $block_id;
+
/**
* The value for the position field.
* @var int
@@ -88,6 +94,11 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
*/
protected $aCcFiles;
+ /**
+ * @var CcBlock
+ */
+ protected $aCcBlock;
+
/**
* @var CcPlaylist
*/
@@ -165,6 +176,16 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
return $this->file_id;
}
+ /**
+ * Get the [block_id] column value.
+ *
+ * @return int
+ */
+ public function getDbBlockId()
+ {
+ return $this->block_id;
+ }
+
/**
* Get the [position] column value.
*
@@ -339,6 +360,30 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
return $this;
} // setDbFileId()
+ /**
+ * Set the value of [block_id] column.
+ *
+ * @param int $v new value
+ * @return CcPlaylistcontents The current object (for fluent API support)
+ */
+ public function setDbBlockId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->block_id !== $v) {
+ $this->block_id = $v;
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::BLOCK_ID;
+ }
+
+ if ($this->aCcBlock !== null && $this->aCcBlock->getDbId() !== $v) {
+ $this->aCcBlock = null;
+ }
+
+ return $this;
+ } // setDbBlockId()
+
/**
* Set the value of [position] column.
*
@@ -574,12 +619,13 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->playlist_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
$this->file_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
- $this->position = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
- $this->cliplength = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
- $this->cuein = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
- $this->cueout = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
- $this->fadein = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
- $this->fadeout = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
+ $this->block_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
+ $this->position = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
+ $this->cliplength = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->cuein = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
+ $this->cueout = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
+ $this->fadein = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
+ $this->fadeout = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
$this->resetModified();
$this->setNew(false);
@@ -588,7 +634,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$this->ensureConsistency();
}
- return $startcol + 9; // 9 = CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS).
+ return $startcol + 10; // 10 = CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcPlaylistcontents object", $e);
@@ -617,6 +663,9 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
if ($this->aCcFiles !== null && $this->file_id !== $this->aCcFiles->getDbId()) {
$this->aCcFiles = null;
}
+ if ($this->aCcBlock !== null && $this->block_id !== $this->aCcBlock->getDbId()) {
+ $this->aCcBlock = null;
+ }
} // ensureConsistency
/**
@@ -657,6 +706,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
$this->aCcFiles = null;
+ $this->aCcBlock = null;
$this->aCcPlaylist = null;
} // if (deep)
}
@@ -782,6 +832,13 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$this->setCcFiles($this->aCcFiles);
}
+ if ($this->aCcBlock !== null) {
+ if ($this->aCcBlock->isModified() || $this->aCcBlock->isNew()) {
+ $affectedRows += $this->aCcBlock->save($con);
+ }
+ $this->setCcBlock($this->aCcBlock);
+ }
+
if ($this->aCcPlaylist !== null) {
if ($this->aCcPlaylist->isModified() || $this->aCcPlaylist->isNew()) {
$affectedRows += $this->aCcPlaylist->save($con);
@@ -889,6 +946,12 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
}
}
+ if ($this->aCcBlock !== null) {
+ if (!$this->aCcBlock->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcBlock->getValidationFailures());
+ }
+ }
+
if ($this->aCcPlaylist !== null) {
if (!$this->aCcPlaylist->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aCcPlaylist->getValidationFailures());
@@ -944,21 +1007,24 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
return $this->getDbFileId();
break;
case 3:
- return $this->getDbPosition();
+ return $this->getDbBlockId();
break;
case 4:
- return $this->getDbCliplength();
+ return $this->getDbPosition();
break;
case 5:
- return $this->getDbCuein();
+ return $this->getDbCliplength();
break;
case 6:
- return $this->getDbCueout();
+ return $this->getDbCuein();
break;
case 7:
- return $this->getDbFadein();
+ return $this->getDbCueout();
break;
case 8:
+ return $this->getDbFadein();
+ break;
+ case 9:
return $this->getDbFadeout();
break;
default:
@@ -988,17 +1054,21 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$keys[0] => $this->getDbId(),
$keys[1] => $this->getDbPlaylistId(),
$keys[2] => $this->getDbFileId(),
- $keys[3] => $this->getDbPosition(),
- $keys[4] => $this->getDbCliplength(),
- $keys[5] => $this->getDbCuein(),
- $keys[6] => $this->getDbCueout(),
- $keys[7] => $this->getDbFadein(),
- $keys[8] => $this->getDbFadeout(),
+ $keys[3] => $this->getDbBlockId(),
+ $keys[4] => $this->getDbPosition(),
+ $keys[5] => $this->getDbCliplength(),
+ $keys[6] => $this->getDbCuein(),
+ $keys[7] => $this->getDbCueout(),
+ $keys[8] => $this->getDbFadein(),
+ $keys[9] => $this->getDbFadeout(),
);
if ($includeForeignObjects) {
if (null !== $this->aCcFiles) {
$result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true);
}
+ if (null !== $this->aCcBlock) {
+ $result['CcBlock'] = $this->aCcBlock->toArray($keyType, $includeLazyLoadColumns, true);
+ }
if (null !== $this->aCcPlaylist) {
$result['CcPlaylist'] = $this->aCcPlaylist->toArray($keyType, $includeLazyLoadColumns, true);
}
@@ -1043,21 +1113,24 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$this->setDbFileId($value);
break;
case 3:
- $this->setDbPosition($value);
+ $this->setDbBlockId($value);
break;
case 4:
- $this->setDbCliplength($value);
+ $this->setDbPosition($value);
break;
case 5:
- $this->setDbCuein($value);
+ $this->setDbCliplength($value);
break;
case 6:
- $this->setDbCueout($value);
+ $this->setDbCuein($value);
break;
case 7:
- $this->setDbFadein($value);
+ $this->setDbCueout($value);
break;
case 8:
+ $this->setDbFadein($value);
+ break;
+ case 9:
$this->setDbFadeout($value);
break;
} // switch()
@@ -1087,12 +1160,13 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setDbPlaylistId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDbFileId($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setDbPosition($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setDbCliplength($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setDbCuein($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setDbCueout($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setDbFadein($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setDbFadeout($arr[$keys[8]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbBlockId($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbPosition($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbCliplength($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbCuein($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setDbCueout($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setDbFadein($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setDbFadeout($arr[$keys[9]]);
}
/**
@@ -1107,6 +1181,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
if ($this->isColumnModified(CcPlaylistcontentsPeer::ID)) $criteria->add(CcPlaylistcontentsPeer::ID, $this->id);
if ($this->isColumnModified(CcPlaylistcontentsPeer::PLAYLIST_ID)) $criteria->add(CcPlaylistcontentsPeer::PLAYLIST_ID, $this->playlist_id);
if ($this->isColumnModified(CcPlaylistcontentsPeer::FILE_ID)) $criteria->add(CcPlaylistcontentsPeer::FILE_ID, $this->file_id);
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::BLOCK_ID)) $criteria->add(CcPlaylistcontentsPeer::BLOCK_ID, $this->block_id);
if ($this->isColumnModified(CcPlaylistcontentsPeer::POSITION)) $criteria->add(CcPlaylistcontentsPeer::POSITION, $this->position);
if ($this->isColumnModified(CcPlaylistcontentsPeer::CLIPLENGTH)) $criteria->add(CcPlaylistcontentsPeer::CLIPLENGTH, $this->cliplength);
if ($this->isColumnModified(CcPlaylistcontentsPeer::CUEIN)) $criteria->add(CcPlaylistcontentsPeer::CUEIN, $this->cuein);
@@ -1176,6 +1251,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
{
$copyObj->setDbPlaylistId($this->playlist_id);
$copyObj->setDbFileId($this->file_id);
+ $copyObj->setDbBlockId($this->block_id);
$copyObj->setDbPosition($this->position);
$copyObj->setDbCliplength($this->cliplength);
$copyObj->setDbCuein($this->cuein);
@@ -1274,6 +1350,55 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
return $this->aCcFiles;
}
+ /**
+ * Declares an association between this object and a CcBlock object.
+ *
+ * @param CcBlock $v
+ * @return CcPlaylistcontents The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcBlock(CcBlock $v = null)
+ {
+ if ($v === null) {
+ $this->setDbBlockId(NULL);
+ } else {
+ $this->setDbBlockId($v->getDbId());
+ }
+
+ $this->aCcBlock = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcBlock object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcPlaylistcontents($this);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcBlock object
+ *
+ * @param PropelPDO Optional Connection object.
+ * @return CcBlock The associated CcBlock object.
+ * @throws PropelException
+ */
+ public function getCcBlock(PropelPDO $con = null)
+ {
+ if ($this->aCcBlock === null && ($this->block_id !== null)) {
+ $this->aCcBlock = CcBlockQuery::create()->findPk($this->block_id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCcBlock->addCcPlaylistcontentss($this);
+ */
+ }
+ return $this->aCcBlock;
+ }
+
/**
* Declares an association between this object and a CcPlaylist object.
*
@@ -1335,6 +1460,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$this->id = null;
$this->playlist_id = null;
$this->file_id = null;
+ $this->block_id = null;
$this->position = null;
$this->cliplength = null;
$this->cuein = null;
@@ -1365,6 +1491,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
} // if ($deep)
$this->aCcFiles = null;
+ $this->aCcBlock = null;
$this->aCcPlaylist = null;
}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsPeer.php
index 0bb899b67..de309bde6 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsPeer.php
@@ -26,7 +26,7 @@ abstract class BaseCcPlaylistcontentsPeer {
const TM_CLASS = 'CcPlaylistcontentsTableMap';
/** The total number of columns. */
- const NUM_COLUMNS = 9;
+ const NUM_COLUMNS = 10;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -40,6 +40,9 @@ abstract class BaseCcPlaylistcontentsPeer {
/** the column name for the FILE_ID field */
const FILE_ID = 'cc_playlistcontents.FILE_ID';
+ /** the column name for the BLOCK_ID field */
+ const BLOCK_ID = 'cc_playlistcontents.BLOCK_ID';
+
/** the column name for the POSITION field */
const POSITION = 'cc_playlistcontents.POSITION';
@@ -74,12 +77,12 @@ abstract class BaseCcPlaylistcontentsPeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbFileId', 'DbPosition', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbFileId', 'dbPosition', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::FILE_ID, self::POSITION, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'FILE_ID', 'POSITION', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'file_id', 'position', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbFileId', 'DbBlockId', 'DbPosition', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbFileId', 'dbBlockId', 'dbPosition', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::FILE_ID, self::BLOCK_ID, self::POSITION, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'FILE_ID', 'BLOCK_ID', 'POSITION', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'file_id', 'block_id', 'position', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
);
/**
@@ -89,12 +92,12 @@ abstract class BaseCcPlaylistcontentsPeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbFileId' => 2, 'DbPosition' => 3, 'DbCliplength' => 4, 'DbCuein' => 5, 'DbCueout' => 6, 'DbFadein' => 7, 'DbFadeout' => 8, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbFileId' => 2, 'dbPosition' => 3, 'dbCliplength' => 4, 'dbCuein' => 5, 'dbCueout' => 6, 'dbFadein' => 7, 'dbFadeout' => 8, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::FILE_ID => 2, self::POSITION => 3, self::CLIPLENGTH => 4, self::CUEIN => 5, self::CUEOUT => 6, self::FADEIN => 7, self::FADEOUT => 8, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'FILE_ID' => 2, 'POSITION' => 3, 'CLIPLENGTH' => 4, 'CUEIN' => 5, 'CUEOUT' => 6, 'FADEIN' => 7, 'FADEOUT' => 8, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'file_id' => 2, 'position' => 3, 'cliplength' => 4, 'cuein' => 5, 'cueout' => 6, 'fadein' => 7, 'fadeout' => 8, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbFileId' => 2, 'DbBlockId' => 3, 'DbPosition' => 4, 'DbCliplength' => 5, 'DbCuein' => 6, 'DbCueout' => 7, 'DbFadein' => 8, 'DbFadeout' => 9, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbFileId' => 2, 'dbBlockId' => 3, 'dbPosition' => 4, 'dbCliplength' => 5, 'dbCuein' => 6, 'dbCueout' => 7, 'dbFadein' => 8, 'dbFadeout' => 9, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::FILE_ID => 2, self::BLOCK_ID => 3, self::POSITION => 4, self::CLIPLENGTH => 5, self::CUEIN => 6, self::CUEOUT => 7, self::FADEIN => 8, self::FADEOUT => 9, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'FILE_ID' => 2, 'BLOCK_ID' => 3, 'POSITION' => 4, 'CLIPLENGTH' => 5, 'CUEIN' => 6, 'CUEOUT' => 7, 'FADEIN' => 8, 'FADEOUT' => 9, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'file_id' => 2, 'block_id' => 3, 'position' => 4, 'cliplength' => 5, 'cuein' => 6, 'cueout' => 7, 'fadein' => 8, 'fadeout' => 9, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
);
/**
@@ -169,6 +172,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->addSelectColumn(CcPlaylistcontentsPeer::ID);
$criteria->addSelectColumn(CcPlaylistcontentsPeer::PLAYLIST_ID);
$criteria->addSelectColumn(CcPlaylistcontentsPeer::FILE_ID);
+ $criteria->addSelectColumn(CcPlaylistcontentsPeer::BLOCK_ID);
$criteria->addSelectColumn(CcPlaylistcontentsPeer::POSITION);
$criteria->addSelectColumn(CcPlaylistcontentsPeer::CLIPLENGTH);
$criteria->addSelectColumn(CcPlaylistcontentsPeer::CUEIN);
@@ -179,6 +183,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.PLAYLIST_ID');
$criteria->addSelectColumn($alias . '.FILE_ID');
+ $criteria->addSelectColumn($alias . '.BLOCK_ID');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CLIPLENGTH');
$criteria->addSelectColumn($alias . '.CUEIN');
@@ -520,6 +525,56 @@ abstract class BaseCcPlaylistcontentsPeer {
}
+ /**
+ * Returns the number of rows matching criteria, joining the related CcBlock table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCcBlock(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlaylistcontentsPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
/**
* Returns the number of rows matching criteria, joining the related CcPlaylist table
*
@@ -636,6 +691,72 @@ abstract class BaseCcPlaylistcontentsPeer {
}
+ /**
+ * Selects a collection of CcPlaylistcontents objects pre-filled with their CcBlock objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcPlaylistcontents objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcBlock(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcPlaylistcontentsPeer::addSelectColumns($criteria);
+ $startcol = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcBlockPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlaylistcontentsPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CcPlaylistcontentsPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcBlockPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcBlockPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcBlockPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcPlaylistcontents) to $obj2 (CcBlock)
+ $obj2->addCcPlaylistcontents($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
/**
* Selects a collection of CcPlaylistcontents objects pre-filled with their CcPlaylist objects.
* @param Criteria $criteria
@@ -740,6 +861,8 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+ $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
$criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
@@ -778,11 +901,16 @@ abstract class BaseCcPlaylistcontentsPeer {
CcFilesPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
+
CcPlaylistPeer::addSelectColumns($criteria);
- $startcol4 = $startcol3 + (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS);
+ $startcol5 = $startcol4 + (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+ $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
$criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
@@ -820,24 +948,42 @@ abstract class BaseCcPlaylistcontentsPeer {
$obj2->addCcPlaylistcontents($obj1);
} // if joined row not null
- // Add objects for joined CcPlaylist rows
+ // Add objects for joined CcBlock rows
- $key3 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ $key3 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol3);
if ($key3 !== null) {
- $obj3 = CcPlaylistPeer::getInstanceFromPool($key3);
+ $obj3 = CcBlockPeer::getInstanceFromPool($key3);
if (!$obj3) {
- $cls = CcPlaylistPeer::getOMClass(false);
+ $cls = CcBlockPeer::getOMClass(false);
$obj3 = new $cls();
$obj3->hydrate($row, $startcol3);
- CcPlaylistPeer::addInstanceToPool($obj3, $key3);
+ CcBlockPeer::addInstanceToPool($obj3, $key3);
} // if obj3 loaded
- // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcPlaylist)
+ // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcBlock)
$obj3->addCcPlaylistcontents($obj1);
} // if joined row not null
+ // Add objects for joined CcPlaylist rows
+
+ $key4 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol4);
+ if ($key4 !== null) {
+ $obj4 = CcPlaylistPeer::getInstanceFromPool($key4);
+ if (!$obj4) {
+
+ $cls = CcPlaylistPeer::getOMClass(false);
+
+ $obj4 = new $cls();
+ $obj4->hydrate($row, $startcol4);
+ CcPlaylistPeer::addInstanceToPool($obj4, $key4);
+ } // if obj4 loaded
+
+ // Add the $obj1 (CcPlaylistcontents) to the collection in $obj4 (CcPlaylist)
+ $obj4->addCcPlaylistcontents($obj1);
+ } // if joined row not null
+
$results[] = $obj1;
}
$stmt->closeCursor();
@@ -881,6 +1027,60 @@ abstract class BaseCcPlaylistcontentsPeer {
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
+ $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+ return $count;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcBlock table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAllExceptCcBlock(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlaylistcontentsPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
$criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
@@ -933,6 +1133,8 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+ $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
@@ -969,8 +1171,13 @@ abstract class BaseCcPlaylistcontentsPeer {
CcPlaylistcontentsPeer::addSelectColumns($criteria);
$startcol2 = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
+
CcPlaylistPeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS);
+ $startcol4 = $startcol3 + (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
$criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior);
@@ -992,23 +1199,139 @@ abstract class BaseCcPlaylistcontentsPeer {
CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded
- // Add objects for joined CcPlaylist rows
+ // Add objects for joined CcBlock rows
- $key2 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
- $obj2 = CcPlaylistPeer::getInstanceFromPool($key2);
+ $obj2 = CcBlockPeer::getInstanceFromPool($key2);
if (!$obj2) {
- $cls = CcPlaylistPeer::getOMClass(false);
+ $cls = CcBlockPeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
- CcPlaylistPeer::addInstanceToPool($obj2, $key2);
+ CcBlockPeer::addInstanceToPool($obj2, $key2);
} // if $obj2 already loaded
- // Add the $obj1 (CcPlaylistcontents) to the collection in $obj2 (CcPlaylist)
+ // Add the $obj1 (CcPlaylistcontents) to the collection in $obj2 (CcBlock)
$obj2->addCcPlaylistcontents($obj1);
+ } // if joined row is not null
+
+ // Add objects for joined CcPlaylist rows
+
+ $key3 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcPlaylistPeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcPlaylistPeer::getOMClass(false);
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcPlaylistPeer::addInstanceToPool($obj3, $key3);
+ } // if $obj3 already loaded
+
+ // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcPlaylist)
+ $obj3->addCcPlaylistcontents($obj1);
+
+ } // if joined row is not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of CcPlaylistcontents objects pre-filled with all related objects except CcBlock.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CcPlaylistcontents objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAllExceptCcBlock(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ // $criteria->getDbName() will return the same object if not set to another value
+ // so == check is okay and faster
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(self::DATABASE_NAME);
+ }
+
+ CcPlaylistcontentsPeer::addSelectColumns($criteria);
+ $startcol2 = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ CcPlaylistPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS);
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlaylistcontentsPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CcPlaylistcontentsPeer::getOMClass(false);
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcFiles rows
+
+ $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcFilesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcFilesPeer::getOMClass(false);
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if $obj2 already loaded
+
+ // Add the $obj1 (CcPlaylistcontents) to the collection in $obj2 (CcFiles)
+ $obj2->addCcPlaylistcontents($obj1);
+
+ } // if joined row is not null
+
+ // Add objects for joined CcPlaylist rows
+
+ $key3 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcPlaylistPeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcPlaylistPeer::getOMClass(false);
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcPlaylistPeer::addInstanceToPool($obj3, $key3);
+ } // if $obj3 already loaded
+
+ // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcPlaylist)
+ $obj3->addCcPlaylistcontents($obj1);
+
} // if joined row is not null
$results[] = $obj1;
@@ -1045,8 +1368,13 @@ abstract class BaseCcPlaylistcontentsPeer {
CcFilesPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
+
$criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+ $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
@@ -1082,6 +1410,25 @@ abstract class BaseCcPlaylistcontentsPeer {
// Add the $obj1 (CcPlaylistcontents) to the collection in $obj2 (CcFiles)
$obj2->addCcPlaylistcontents($obj1);
+ } // if joined row is not null
+
+ // Add objects for joined CcBlock rows
+
+ $key3 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcBlockPeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcBlockPeer::getOMClass(false);
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcBlockPeer::addInstanceToPool($obj3, $key3);
+ } // if $obj3 already loaded
+
+ // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcBlock)
+ $obj3->addCcPlaylistcontents($obj1);
+
} // if joined row is not null
$results[] = $obj1;
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php
index 8769dfe60..c9c0b42b5 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php
@@ -9,6 +9,7 @@
* @method CcPlaylistcontentsQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcPlaylistcontentsQuery orderByDbPlaylistId($order = Criteria::ASC) Order by the playlist_id column
* @method CcPlaylistcontentsQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
+ * @method CcPlaylistcontentsQuery orderByDbBlockId($order = Criteria::ASC) Order by the block_id column
* @method CcPlaylistcontentsQuery orderByDbPosition($order = Criteria::ASC) Order by the position column
* @method CcPlaylistcontentsQuery orderByDbCliplength($order = Criteria::ASC) Order by the cliplength column
* @method CcPlaylistcontentsQuery orderByDbCuein($order = Criteria::ASC) Order by the cuein column
@@ -19,6 +20,7 @@
* @method CcPlaylistcontentsQuery groupByDbId() Group by the id column
* @method CcPlaylistcontentsQuery groupByDbPlaylistId() Group by the playlist_id column
* @method CcPlaylistcontentsQuery groupByDbFileId() Group by the file_id column
+ * @method CcPlaylistcontentsQuery groupByDbBlockId() Group by the block_id column
* @method CcPlaylistcontentsQuery groupByDbPosition() Group by the position column
* @method CcPlaylistcontentsQuery groupByDbCliplength() Group by the cliplength column
* @method CcPlaylistcontentsQuery groupByDbCuein() Group by the cuein column
@@ -34,6 +36,10 @@
* @method CcPlaylistcontentsQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
* @method CcPlaylistcontentsQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
*
+ * @method CcPlaylistcontentsQuery leftJoinCcBlock($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlock relation
+ * @method CcPlaylistcontentsQuery rightJoinCcBlock($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlock relation
+ * @method CcPlaylistcontentsQuery innerJoinCcBlock($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlock relation
+ *
* @method CcPlaylistcontentsQuery leftJoinCcPlaylist($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlaylist relation
* @method CcPlaylistcontentsQuery rightJoinCcPlaylist($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylist relation
* @method CcPlaylistcontentsQuery innerJoinCcPlaylist($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylist relation
@@ -44,6 +50,7 @@
* @method CcPlaylistcontents findOneByDbId(int $id) Return the first CcPlaylistcontents filtered by the id column
* @method CcPlaylistcontents findOneByDbPlaylistId(int $playlist_id) Return the first CcPlaylistcontents filtered by the playlist_id column
* @method CcPlaylistcontents findOneByDbFileId(int $file_id) Return the first CcPlaylistcontents filtered by the file_id column
+ * @method CcPlaylistcontents findOneByDbBlockId(int $block_id) Return the first CcPlaylistcontents filtered by the block_id column
* @method CcPlaylistcontents findOneByDbPosition(int $position) Return the first CcPlaylistcontents filtered by the position column
* @method CcPlaylistcontents findOneByDbCliplength(string $cliplength) Return the first CcPlaylistcontents filtered by the cliplength column
* @method CcPlaylistcontents findOneByDbCuein(string $cuein) Return the first CcPlaylistcontents filtered by the cuein column
@@ -54,6 +61,7 @@
* @method array findByDbId(int $id) Return CcPlaylistcontents objects filtered by the id column
* @method array findByDbPlaylistId(int $playlist_id) Return CcPlaylistcontents objects filtered by the playlist_id column
* @method array findByDbFileId(int $file_id) Return CcPlaylistcontents objects filtered by the file_id column
+ * @method array findByDbBlockId(int $block_id) Return CcPlaylistcontents objects filtered by the block_id column
* @method array findByDbPosition(int $position) Return CcPlaylistcontents objects filtered by the position column
* @method array findByDbCliplength(string $cliplength) Return CcPlaylistcontents objects filtered by the cliplength column
* @method array findByDbCuein(string $cuein) Return CcPlaylistcontents objects filtered by the cuein column
@@ -248,6 +256,37 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
return $this->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $dbFileId, $comparison);
}
+ /**
+ * Filter the query on the block_id column
+ *
+ * @param int|array $dbBlockId 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 CcPlaylistcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbBlockId($dbBlockId = null, $comparison = null)
+ {
+ if (is_array($dbBlockId)) {
+ $useMinMax = false;
+ if (isset($dbBlockId['min'])) {
+ $this->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $dbBlockId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbBlockId['max'])) {
+ $this->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $dbBlockId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $dbBlockId, $comparison);
+ }
+
/**
* Filter the query on the position column
*
@@ -471,6 +510,70 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
}
+ /**
+ * Filter the query by a related CcBlock object
+ *
+ * @param CcBlock $ccBlock the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlaylistcontentsQuery The current query, for fluid interface
+ */
+ public function filterByCcBlock($ccBlock, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $ccBlock->getDbId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcBlock relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlaylistcontentsQuery The current query, for fluid interface
+ */
+ public function joinCcBlock($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcBlock');
+
+ // 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, 'CcBlock');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcBlock relation CcBlock 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 CcBlockQuery A secondary query class using the current class as primary query
+ */
+ public function useCcBlockQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcBlock($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcBlock', 'CcBlockQuery');
+ }
+
/**
* Filter the query by a related CcPlaylist object
*
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcriteria.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcriteria.php
index 6cc3e4bc1..52359cc90 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcriteria.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcriteria.php
@@ -60,6 +60,12 @@ abstract class BaseCcPlaylistcriteria extends BaseObject implements Persistent
*/
protected $playlist_id;
+ /**
+ * The value for the set_number field.
+ * @var int
+ */
+ protected $set_number;
+
/**
* @var CcPlaylist
*/
@@ -139,6 +145,16 @@ abstract class BaseCcPlaylistcriteria extends BaseObject implements Persistent
return $this->playlist_id;
}
+ /**
+ * Get the [set_number] column value.
+ *
+ * @return int
+ */
+ public function getDbSetNumber()
+ {
+ return $this->set_number;
+ }
+
/**
* Set the value of [id] column.
*
@@ -263,6 +279,26 @@ abstract class BaseCcPlaylistcriteria extends BaseObject implements Persistent
return $this;
} // setDbPlaylistId()
+ /**
+ * Set the value of [set_number] column.
+ *
+ * @param int $v new value
+ * @return CcPlaylistcriteria The current object (for fluent API support)
+ */
+ public function setDbSetNumber($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->set_number !== $v) {
+ $this->set_number = $v;
+ $this->modifiedColumns[] = CcPlaylistcriteriaPeer::SET_NUMBER;
+ }
+
+ return $this;
+ } // setDbSetNumber()
+
/**
* Indicates whether the columns in this object are only set to default values.
*
@@ -301,6 +337,7 @@ abstract class BaseCcPlaylistcriteria extends BaseObject implements Persistent
$this->value = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->extra = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
$this->playlist_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
+ $this->set_number = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
$this->resetModified();
$this->setNew(false);
@@ -309,7 +346,7 @@ abstract class BaseCcPlaylistcriteria extends BaseObject implements Persistent
$this->ensureConsistency();
}
- return $startcol + 6; // 6 = CcPlaylistcriteriaPeer::NUM_COLUMNS - CcPlaylistcriteriaPeer::NUM_LAZY_LOAD_COLUMNS).
+ return $startcol + 7; // 7 = CcPlaylistcriteriaPeer::NUM_COLUMNS - CcPlaylistcriteriaPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcPlaylistcriteria object", $e);
@@ -654,6 +691,9 @@ abstract class BaseCcPlaylistcriteria extends BaseObject implements Persistent
case 5:
return $this->getDbPlaylistId();
break;
+ case 6:
+ return $this->getDbSetNumber();
+ break;
default:
return null;
break;
@@ -684,6 +724,7 @@ abstract class BaseCcPlaylistcriteria extends BaseObject implements Persistent
$keys[3] => $this->getDbValue(),
$keys[4] => $this->getDbExtra(),
$keys[5] => $this->getDbPlaylistId(),
+ $keys[6] => $this->getDbSetNumber(),
);
if ($includeForeignObjects) {
if (null !== $this->aCcPlaylist) {
@@ -738,6 +779,9 @@ abstract class BaseCcPlaylistcriteria extends BaseObject implements Persistent
case 5:
$this->setDbPlaylistId($value);
break;
+ case 6:
+ $this->setDbSetNumber($value);
+ break;
} // switch()
}
@@ -768,6 +812,7 @@ abstract class BaseCcPlaylistcriteria extends BaseObject implements Persistent
if (array_key_exists($keys[3], $arr)) $this->setDbValue($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setDbExtra($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setDbPlaylistId($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbSetNumber($arr[$keys[6]]);
}
/**
@@ -785,6 +830,7 @@ abstract class BaseCcPlaylistcriteria extends BaseObject implements Persistent
if ($this->isColumnModified(CcPlaylistcriteriaPeer::VALUE)) $criteria->add(CcPlaylistcriteriaPeer::VALUE, $this->value);
if ($this->isColumnModified(CcPlaylistcriteriaPeer::EXTRA)) $criteria->add(CcPlaylistcriteriaPeer::EXTRA, $this->extra);
if ($this->isColumnModified(CcPlaylistcriteriaPeer::PLAYLIST_ID)) $criteria->add(CcPlaylistcriteriaPeer::PLAYLIST_ID, $this->playlist_id);
+ if ($this->isColumnModified(CcPlaylistcriteriaPeer::SET_NUMBER)) $criteria->add(CcPlaylistcriteriaPeer::SET_NUMBER, $this->set_number);
return $criteria;
}
@@ -851,6 +897,7 @@ abstract class BaseCcPlaylistcriteria extends BaseObject implements Persistent
$copyObj->setDbValue($this->value);
$copyObj->setDbExtra($this->extra);
$copyObj->setDbPlaylistId($this->playlist_id);
+ $copyObj->setDbSetNumber($this->set_number);
$copyObj->setNew(true);
$copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
@@ -954,6 +1001,7 @@ abstract class BaseCcPlaylistcriteria extends BaseObject implements Persistent
$this->value = null;
$this->extra = null;
$this->playlist_id = null;
+ $this->set_number = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->clearAllReferences();
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcriteriaPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcriteriaPeer.php
index 753b365a1..8ab217965 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcriteriaPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcriteriaPeer.php
@@ -26,7 +26,7 @@ abstract class BaseCcPlaylistcriteriaPeer {
const TM_CLASS = 'CcPlaylistcriteriaTableMap';
/** The total number of columns. */
- const NUM_COLUMNS = 6;
+ const NUM_COLUMNS = 7;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -49,6 +49,9 @@ abstract class BaseCcPlaylistcriteriaPeer {
/** the column name for the PLAYLIST_ID field */
const PLAYLIST_ID = 'cc_playlistcriteria.PLAYLIST_ID';
+ /** the column name for the SET_NUMBER field */
+ const SET_NUMBER = 'cc_playlistcriteria.SET_NUMBER';
+
/**
* An identiy map to hold any loaded instances of CcPlaylistcriteria objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
@@ -65,12 +68,12 @@ abstract class BaseCcPlaylistcriteriaPeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbCriteria', 'DbModifier', 'DbValue', 'DbExtra', 'DbPlaylistId', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbCriteria', 'dbModifier', 'dbValue', 'dbExtra', 'dbPlaylistId', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::CRITERIA, self::MODIFIER, self::VALUE, self::EXTRA, self::PLAYLIST_ID, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CRITERIA', 'MODIFIER', 'VALUE', 'EXTRA', 'PLAYLIST_ID', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'criteria', 'modifier', 'value', 'extra', 'playlist_id', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbCriteria', 'DbModifier', 'DbValue', 'DbExtra', 'DbPlaylistId', 'DbSetNumber', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbCriteria', 'dbModifier', 'dbValue', 'dbExtra', 'dbPlaylistId', 'dbSetNumber', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::CRITERIA, self::MODIFIER, self::VALUE, self::EXTRA, self::PLAYLIST_ID, self::SET_NUMBER, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CRITERIA', 'MODIFIER', 'VALUE', 'EXTRA', 'PLAYLIST_ID', 'SET_NUMBER', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'criteria', 'modifier', 'value', 'extra', 'playlist_id', 'set_number', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
);
/**
@@ -80,12 +83,12 @@ abstract class BaseCcPlaylistcriteriaPeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbCriteria' => 1, 'DbModifier' => 2, 'DbValue' => 3, 'DbExtra' => 4, 'DbPlaylistId' => 5, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbCriteria' => 1, 'dbModifier' => 2, 'dbValue' => 3, 'dbExtra' => 4, 'dbPlaylistId' => 5, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::CRITERIA => 1, self::MODIFIER => 2, self::VALUE => 3, self::EXTRA => 4, self::PLAYLIST_ID => 5, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CRITERIA' => 1, 'MODIFIER' => 2, 'VALUE' => 3, 'EXTRA' => 4, 'PLAYLIST_ID' => 5, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'criteria' => 1, 'modifier' => 2, 'value' => 3, 'extra' => 4, 'playlist_id' => 5, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbCriteria' => 1, 'DbModifier' => 2, 'DbValue' => 3, 'DbExtra' => 4, 'DbPlaylistId' => 5, 'DbSetNumber' => 6, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbCriteria' => 1, 'dbModifier' => 2, 'dbValue' => 3, 'dbExtra' => 4, 'dbPlaylistId' => 5, 'dbSetNumber' => 6, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::CRITERIA => 1, self::MODIFIER => 2, self::VALUE => 3, self::EXTRA => 4, self::PLAYLIST_ID => 5, self::SET_NUMBER => 6, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CRITERIA' => 1, 'MODIFIER' => 2, 'VALUE' => 3, 'EXTRA' => 4, 'PLAYLIST_ID' => 5, 'SET_NUMBER' => 6, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'criteria' => 1, 'modifier' => 2, 'value' => 3, 'extra' => 4, 'playlist_id' => 5, 'set_number' => 6, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
);
/**
@@ -163,6 +166,7 @@ abstract class BaseCcPlaylistcriteriaPeer {
$criteria->addSelectColumn(CcPlaylistcriteriaPeer::VALUE);
$criteria->addSelectColumn(CcPlaylistcriteriaPeer::EXTRA);
$criteria->addSelectColumn(CcPlaylistcriteriaPeer::PLAYLIST_ID);
+ $criteria->addSelectColumn(CcPlaylistcriteriaPeer::SET_NUMBER);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.CRITERIA');
@@ -170,6 +174,7 @@ abstract class BaseCcPlaylistcriteriaPeer {
$criteria->addSelectColumn($alias . '.VALUE');
$criteria->addSelectColumn($alias . '.EXTRA');
$criteria->addSelectColumn($alias . '.PLAYLIST_ID');
+ $criteria->addSelectColumn($alias . '.SET_NUMBER');
}
}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcriteriaQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcriteriaQuery.php
index 1216e6cf7..42cd8ecbd 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcriteriaQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcriteriaQuery.php
@@ -12,6 +12,7 @@
* @method CcPlaylistcriteriaQuery orderByDbValue($order = Criteria::ASC) Order by the value column
* @method CcPlaylistcriteriaQuery orderByDbExtra($order = Criteria::ASC) Order by the extra column
* @method CcPlaylistcriteriaQuery orderByDbPlaylistId($order = Criteria::ASC) Order by the playlist_id column
+ * @method CcPlaylistcriteriaQuery orderByDbSetNumber($order = Criteria::ASC) Order by the set_number column
*
* @method CcPlaylistcriteriaQuery groupByDbId() Group by the id column
* @method CcPlaylistcriteriaQuery groupByDbCriteria() Group by the criteria column
@@ -19,6 +20,7 @@
* @method CcPlaylistcriteriaQuery groupByDbValue() Group by the value column
* @method CcPlaylistcriteriaQuery groupByDbExtra() Group by the extra column
* @method CcPlaylistcriteriaQuery groupByDbPlaylistId() Group by the playlist_id column
+ * @method CcPlaylistcriteriaQuery groupByDbSetNumber() Group by the set_number column
*
* @method CcPlaylistcriteriaQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcPlaylistcriteriaQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -37,6 +39,7 @@
* @method CcPlaylistcriteria findOneByDbValue(string $value) Return the first CcPlaylistcriteria filtered by the value column
* @method CcPlaylistcriteria findOneByDbExtra(string $extra) Return the first CcPlaylistcriteria filtered by the extra column
* @method CcPlaylistcriteria findOneByDbPlaylistId(int $playlist_id) Return the first CcPlaylistcriteria filtered by the playlist_id column
+ * @method CcPlaylistcriteria findOneByDbSetNumber(int $set_number) Return the first CcPlaylistcriteria filtered by the set_number column
*
* @method array findByDbId(int $id) Return CcPlaylistcriteria objects filtered by the id column
* @method array findByDbCriteria(string $criteria) Return CcPlaylistcriteria objects filtered by the criteria column
@@ -44,6 +47,7 @@
* @method array findByDbValue(string $value) Return CcPlaylistcriteria objects filtered by the value column
* @method array findByDbExtra(string $extra) Return CcPlaylistcriteria objects filtered by the extra column
* @method array findByDbPlaylistId(int $playlist_id) Return CcPlaylistcriteria objects filtered by the playlist_id column
+ * @method array findByDbSetNumber(int $set_number) Return CcPlaylistcriteria objects filtered by the set_number column
*
* @package propel.generator.airtime.om
*/
@@ -289,6 +293,37 @@ abstract class BaseCcPlaylistcriteriaQuery extends ModelCriteria
return $this->addUsingAlias(CcPlaylistcriteriaPeer::PLAYLIST_ID, $dbPlaylistId, $comparison);
}
+ /**
+ * Filter the query on the set_number column
+ *
+ * @param int|array $dbSetNumber 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 CcPlaylistcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByDbSetNumber($dbSetNumber = null, $comparison = null)
+ {
+ if (is_array($dbSetNumber)) {
+ $useMinMax = false;
+ if (isset($dbSetNumber['min'])) {
+ $this->addUsingAlias(CcPlaylistcriteriaPeer::SET_NUMBER, $dbSetNumber['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbSetNumber['max'])) {
+ $this->addUsingAlias(CcPlaylistcriteriaPeer::SET_NUMBER, $dbSetNumber['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcPlaylistcriteriaPeer::SET_NUMBER, $dbSetNumber, $comparison);
+ }
+
/**
* Filter the query by a related CcPlaylist object
*
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php
index 40cd181bf..fa8359d84 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php
@@ -133,6 +133,11 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
*/
protected $collCcPlaylists;
+ /**
+ * @var array CcBlock[] Collection to store aggregation of CcBlock objects.
+ */
+ protected $collCcBlocks;
+
/**
* @var array CcPref[] Collection to store aggregation of CcPref objects.
*/
@@ -831,6 +836,8 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
$this->collCcPlaylists = null;
+ $this->collCcBlocks = null;
+
$this->collCcPrefs = null;
$this->collCcSesss = null;
@@ -1010,6 +1017,14 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
}
}
+ if ($this->collCcBlocks !== null) {
+ foreach ($this->collCcBlocks as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
if ($this->collCcPrefs !== null) {
foreach ($this->collCcPrefs as $referrerFK) {
if (!$referrerFK->isDeleted()) {
@@ -1145,6 +1160,14 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
}
}
+ if ($this->collCcBlocks !== null) {
+ foreach ($this->collCcBlocks as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
if ($this->collCcPrefs !== null) {
foreach ($this->collCcPrefs as $referrerFK) {
if (!$referrerFK->validate($columns)) {
@@ -1517,6 +1540,12 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
}
}
+ foreach ($this->getCcBlocks() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcBlock($relObj->copy($deepCopy));
+ }
+ }
+
foreach ($this->getCcPrefs() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCcPref($relObj->copy($deepCopy));
@@ -2175,6 +2204,115 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
}
}
+ /**
+ * Clears out the collCcBlocks 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 addCcBlocks()
+ */
+ public function clearCcBlocks()
+ {
+ $this->collCcBlocks = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Initializes the collCcBlocks collection.
+ *
+ * By default this just sets the collCcBlocks collection to an empty array (like clearcollCcBlocks());
+ * 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 initCcBlocks()
+ {
+ $this->collCcBlocks = new PropelObjectCollection();
+ $this->collCcBlocks->setModel('CcBlock');
+ }
+
+ /**
+ * Gets an array of CcBlock 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 CcSubjs 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 CcBlock[] List of CcBlock objects
+ * @throws PropelException
+ */
+ public function getCcBlocks($criteria = null, PropelPDO $con = null)
+ {
+ if(null === $this->collCcBlocks || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcBlocks) {
+ // return empty collection
+ $this->initCcBlocks();
+ } else {
+ $collCcBlocks = CcBlockQuery::create(null, $criteria)
+ ->filterByCcSubjs($this)
+ ->find($con);
+ if (null !== $criteria) {
+ return $collCcBlocks;
+ }
+ $this->collCcBlocks = $collCcBlocks;
+ }
+ }
+ return $this->collCcBlocks;
+ }
+
+ /**
+ * Returns the number of related CcBlock objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcBlock objects.
+ * @throws PropelException
+ */
+ public function countCcBlocks(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ if(null === $this->collCcBlocks || null !== $criteria) {
+ if ($this->isNew() && null === $this->collCcBlocks) {
+ return 0;
+ } else {
+ $query = CcBlockQuery::create(null, $criteria);
+ if($distinct) {
+ $query->distinct();
+ }
+ return $query
+ ->filterByCcSubjs($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collCcBlocks);
+ }
+ }
+
+ /**
+ * Method called to associate a CcBlock object to this object
+ * through the CcBlock foreign key attribute.
+ *
+ * @param CcBlock $l CcBlock
+ * @return void
+ * @throws PropelException
+ */
+ public function addCcBlock(CcBlock $l)
+ {
+ if ($this->collCcBlocks === null) {
+ $this->initCcBlocks();
+ }
+ if (!$this->collCcBlocks->contains($l)) { // only add it if the **same** object is not already associated
+ $this->collCcBlocks[]= $l;
+ $l->setCcSubjs($this);
+ }
+ }
+
/**
* Clears out the collCcPrefs collection
*
@@ -2566,6 +2704,11 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
+ if ($this->collCcBlocks) {
+ foreach ((array) $this->collCcBlocks as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
if ($this->collCcPrefs) {
foreach ((array) $this->collCcPrefs as $o) {
$o->clearAllReferences($deep);
@@ -2588,6 +2731,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
$this->collCcPermss = null;
$this->collCcShowHostss = null;
$this->collCcPlaylists = null;
+ $this->collCcBlocks = null;
$this->collCcPrefs = null;
$this->collCcSesss = null;
$this->collCcSubjsTokens = null;
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php
index c76e2a1f8..d5af8835f 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php
@@ -58,6 +58,10 @@
* @method CcSubjsQuery rightJoinCcPlaylist($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylist relation
* @method CcSubjsQuery innerJoinCcPlaylist($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylist relation
*
+ * @method CcSubjsQuery leftJoinCcBlock($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlock relation
+ * @method CcSubjsQuery rightJoinCcBlock($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlock relation
+ * @method CcSubjsQuery innerJoinCcBlock($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlock relation
+ *
* @method CcSubjsQuery leftJoinCcPref($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPref relation
* @method CcSubjsQuery rightJoinCcPref($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPref relation
* @method CcSubjsQuery innerJoinCcPref($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPref relation
@@ -837,6 +841,70 @@ abstract class BaseCcSubjsQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CcPlaylist', 'CcPlaylistQuery');
}
+ /**
+ * Filter the query by a related CcBlock object
+ *
+ * @param CcBlock $ccBlock the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcSubjsQuery The current query, for fluid interface
+ */
+ public function filterByCcBlock($ccBlock, $comparison = null)
+ {
+ return $this
+ ->addUsingAlias(CcSubjsPeer::ID, $ccBlock->getDbCreatorId(), $comparison);
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcBlock relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcSubjsQuery The current query, for fluid interface
+ */
+ public function joinCcBlock($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcBlock');
+
+ // 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, 'CcBlock');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcBlock relation CcBlock 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 CcBlockQuery A secondary query class using the current class as primary query
+ */
+ public function useCcBlockQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcBlock($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcBlock', 'CcBlockQuery');
+ }
+
/**
* Filter the query by a related CcPref object
*
diff --git a/airtime_mvc/application/views/scripts/playlist/index.phtml b/airtime_mvc/application/views/scripts/playlist/index.phtml
index e4e9991e7..dd7c9f5f1 100644
--- a/airtime_mvc/application/views/scripts/playlist/index.phtml
+++ b/airtime_mvc/application/views/scripts/playlist/index.phtml
@@ -3,5 +3,9 @@