Revert "Merge branch 'ryerson-history'"

This reverts commit a554c6f72c, reversing
changes made to 2a0c9769aa.
This commit is contained in:
Naomi Aro 2013-09-23 11:00:43 +02:00
parent a554c6f72c
commit c8b73850b9
200 changed files with 5491 additions and 41784 deletions

20
CREDITS
View file

@ -2,24 +2,10 @@
CREDITS CREDITS
======= =======
Version 2.5.0 Version 2.4.0
-------------
Denise Rigato (denise.rigato@sourcefabric.org)
Role: Software Developer
Naomi Aro (naomi.aro@sourcefabric.org)
Role: Software Developer
Cliff Wang (cliff.wang@sourcefabric.org)
Role: QA
Daniel James (daniel.james@sourcefabric.org)
Role: Documentor & QA
Version 2.4.1
------------- -------------
Martin Konecny (martin.konecny@sourcefabric.org)
Role: Developer Team Lead
Denise Rigato (denise.rigato@sourcefabric.org) Denise Rigato (denise.rigato@sourcefabric.org)
Role: Software Developer Role: Software Developer

View file

@ -8,7 +8,7 @@ Common Non-linked Code
- Web site: https://github.com/torvalds/linux - Web site: https://github.com/torvalds/linux
- License: GPLv2 - License: GPLv2
* RabbitMQ * RabbitMQ (works with version 1.7.2 and above)
- What is it: Interprocess Message Passing with Queuing - What is it: Interprocess Message Passing with Queuing
- Web site: http://www.rabbitmq.com/ - Web site: http://www.rabbitmq.com/
- License: Mozilla Public License (http://www.rabbitmq.com/mpl.html) - License: Mozilla Public License (http://www.rabbitmq.com/mpl.html)
@ -63,11 +63,11 @@ Non-linked code:
- Web site: http://httpd.apache.org/ - Web site: http://httpd.apache.org/
- License: Apache 2.0. See http://httpd.apache.org/docs/2.2/license.html - License: Apache 2.0. See http://httpd.apache.org/docs/2.2/license.html
* PostgreSQL 9.1 * PostgreSQL 8.4
- Web site: http://www.postgresql.org/ - Web site: http://www.postgresql.org/
- License: The PostgreSQL License. See http://www.postgresql.org/about/licence - License: The PostgreSQL License. See http://www.postgresql.org/about/licence
* PHP 5.3 * PHP 5.3
- Web site: http://www.php.net/ - Web site: http://www.php.net/
- License: The PHP License. See http://www.php.net/license/3_01.txt - License: The PHP License. See http://www.php.net/license/3_01.txt
@ -137,7 +137,7 @@ Linked code:
- License: MIT - License: MIT
Non-linked code: Non-linked code:
* Python 2.7 * Python 2.6
- Web site: http://www.python.org/ - Web site: http://www.python.org/
- License: PSF License. See http://docs.python.org/license.html - License: PSF License. See http://docs.python.org/license.html
@ -158,11 +158,11 @@ Linked code:
- Compatible with GPLv3? Yes. - Compatible with GPLv3? Yes.
Non-linked code: Non-linked code:
* Python 2.7 * Python 2.6
- Web site: http://www.python.org/ - Web site: http://www.python.org/
- License: PSF License. See http://docs.python.org/license.html - License: PSF License. See http://docs.python.org/license.html
* ecasound 2.8.1 * ecasound 2.7.2
- What is it: Records audio from line-in - What is it: Records audio from line-in
- Web site: http://www.eca.cx/ecasound/ - Web site: http://www.eca.cx/ecasound/
- License: GPLv2 - License: GPLv2
@ -177,10 +177,10 @@ Linked code:
- Compatible with GPLv3? Yes. - Compatible with GPLv3? Yes.
Non-linked code: Non-linked code:
* Python 2.7 * Python 2.6
- Web site: http://www.python.org/ - Web site: http://www.python.org/
- License: PSF License. See http://docs.python.org/license.html - License: PSF License. See http://docs.python.org/license.html
* Liquidsoap 1.1.1 * Liquidsoap 1.0.1
- Web site: http://savonet.sourceforge.net/ - Web site: http://savonet.sourceforge.net/
- License: GPLv2 - License: GPLv2

View file

@ -1,2 +1,2 @@
PRODUCT_ID=Airtime PRODUCT_ID=Airtime
PRODUCT_RELEASE=2.5.0 PRODUCT_RELEASE=2.4.0

View file

@ -43,14 +43,14 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view = $this->getResource('view'); $view = $this->getResource('view');
$view->doctype('XHTML1_STRICT'); $view->doctype('XHTML1_STRICT');
} }
protected function _initGlobals() protected function _initGlobals()
{ {
$view = $this->getResource('view'); $view = $this->getResource('view');
$baseUrl = Application_Common_OsPath::getBaseDir(); $baseUrl = Application_Common_OsPath::getBaseDir();
$view->headScript()->appendScript("var baseUrl = '$baseUrl'"); $view->headScript()->appendScript("var baseUrl = '$baseUrl'");
$user = Application_Model_User::GetCurrentUser(); $user = Application_Model_User::GetCurrentUser();
if (!is_null($user)){ if (!is_null($user)){
$userType = $user->getType(); $userType = $user->getType();
@ -58,7 +58,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$userType = ""; $userType = "";
} }
$view->headScript()->appendScript("var userType = '$userType';"); $view->headScript()->appendScript("var userType = '$userType';");
} }
protected function _initHeadLink() protected function _initHeadLink()
@ -68,13 +68,13 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view = $this->getResource('view'); $view = $this->getResource('view');
$baseUrl = Application_Common_OsPath::getBaseDir(); $baseUrl = Application_Common_OsPath::getBaseDir();
$view->headLink()->appendStylesheet($baseUrl.'css/bootstrap.css?'.$CC_CONFIG['airtime_version']);
$view->headLink()->appendStylesheet($baseUrl.'css/redmond/jquery-ui-1.8.8.custom.css?'.$CC_CONFIG['airtime_version']); $view->headLink()->appendStylesheet($baseUrl.'css/redmond/jquery-ui-1.8.8.custom.css?'.$CC_CONFIG['airtime_version']);
$view->headLink()->appendStylesheet($baseUrl.'css/pro_dropdown_3.css?'.$CC_CONFIG['airtime_version']); $view->headLink()->appendStylesheet($baseUrl.'css/pro_dropdown_3.css?'.$CC_CONFIG['airtime_version']);
$view->headLink()->appendStylesheet($baseUrl.'css/qtip/jquery.qtip.min.css?'.$CC_CONFIG['airtime_version']); $view->headLink()->appendStylesheet($baseUrl.'css/qtip/jquery.qtip.min.css?'.$CC_CONFIG['airtime_version']);
$view->headLink()->appendStylesheet($baseUrl.'css/styles.css?'.$CC_CONFIG['airtime_version']); $view->headLink()->appendStylesheet($baseUrl.'css/styles.css?'.$CC_CONFIG['airtime_version']);
$view->headLink()->appendStylesheet($baseUrl.'css/masterpanel.css?'.$CC_CONFIG['airtime_version']); $view->headLink()->appendStylesheet($baseUrl.'css/masterpanel.css?'.$CC_CONFIG['airtime_version']);
$view->headLink()->appendStylesheet($baseUrl.'css/bootstrap.css?'.$CC_CONFIG['airtime_version']);
$view->headLink()->appendStylesheet($baseUrl.'css/tipsy/jquery.tipsy.css?'.$CC_CONFIG['airtime_version']); $view->headLink()->appendStylesheet($baseUrl.'css/tipsy/jquery.tipsy.css?'.$CC_CONFIG['airtime_version']);
} }
@ -83,26 +83,23 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$CC_CONFIG = Config::getConfig(); $CC_CONFIG = Config::getConfig();
$view = $this->getResource('view'); $view = $this->getResource('view');
$baseUrl = Application_Common_OsPath::getBaseDir(); $baseUrl = Application_Common_OsPath::getBaseDir();
$view->headScript()->appendFile($baseUrl.'js/libs/jquery-1.8.3.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'js/libs/jquery-1.7.2.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/libs/jquery-ui-1.8.24.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'js/libs/jquery-ui-1.8.18.custom.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/bootstrap/bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/libs/underscore-min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/libs/jquery.stickyPanel.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'js/libs/jquery.stickyPanel.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/qtip/jquery.qtip.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'js/qtip/jquery.qtip.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/jplayer/jquery.jplayer.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $view->headScript()->appendFile($baseUrl.'js/jplayer/jquery.jplayer.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/sprintf/sprintf-0.7-beta1.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'js/sprintf/sprintf-0.7-beta1.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/bootstrap/bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/cookie/jquery.cookie.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'js/cookie/jquery.cookie.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/i18n/jquery.i18n.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'js/i18n/jquery.i18n.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'locale/general-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'locale/general-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'locale/datatables-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'locale/datatables-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendScript("$.i18n.setDictionary(general_dict)"); $view->headScript()->appendScript("$.i18n.setDictionary(general_dict)");
$view->headScript()->appendScript("var baseUrl='$baseUrl'"); $view->headScript()->appendScript("var baseUrl='$baseUrl'");
//scripts for now playing bar //scripts for now playing bar
$view->headScript()->appendFile($baseUrl.'js/airtime/airtime_bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'js/airtime/airtime_bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'js/airtime/dashboard/helperfunctions.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'js/airtime/dashboard/helperfunctions.js?'.$CC_CONFIG['airtime_version'],'text/javascript');

View file

@ -14,8 +14,7 @@ class Application_Common_Timezone
'Australia' => DateTimeZone::AUSTRALIA, 'Australia' => DateTimeZone::AUSTRALIA,
'Europe' => DateTimeZone::EUROPE, 'Europe' => DateTimeZone::EUROPE,
'Indian' => DateTimeZone::INDIAN, 'Indian' => DateTimeZone::INDIAN,
'Pacific' => DateTimeZone::PACIFIC, 'Pacific' => DateTimeZone::PACIFIC
'UTC' => DateTimeZone::UTC
); );
$tzlist = array(); $tzlist = array();

View file

@ -23,7 +23,6 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
->add(new Zend_Acl_Resource('preference')) ->add(new Zend_Acl_Resource('preference'))
->add(new Zend_Acl_Resource('showbuilder')) ->add(new Zend_Acl_Resource('showbuilder'))
->add(new Zend_Acl_Resource('playouthistory')) ->add(new Zend_Acl_Resource('playouthistory'))
->add(new Zend_Acl_Resource('playouthistorytemplate'))
->add(new Zend_Acl_Resource('listenerstat')) ->add(new Zend_Acl_Resource('listenerstat'))
->add(new Zend_Acl_Resource('usersettings')) ->add(new Zend_Acl_Resource('usersettings'))
->add(new Zend_Acl_Resource('audiopreview')) ->add(new Zend_Acl_Resource('audiopreview'))
@ -47,8 +46,7 @@ $ccAcl->allow('G', 'index')
->allow('H', 'plupload') ->allow('H', 'plupload')
->allow('H', 'library') ->allow('H', 'library')
->allow('H', 'playlist') ->allow('H', 'playlist')
->allow('H', 'playouthistory') ->allow('A', 'playouthistory')
->allow('A', 'playouthistorytemplate')
->allow('A', 'listenerstat') ->allow('A', 'listenerstat')
->allow('A', 'user') ->allow('A', 'user')
->allow('A', 'systemstatus') ->allow('A', 'systemstatus')

View file

@ -183,13 +183,6 @@ return array (
'BaseCcWebstreamMetadataPeer' => 'airtime/om/BaseCcWebstreamMetadataPeer.php', 'BaseCcWebstreamMetadataPeer' => 'airtime/om/BaseCcWebstreamMetadataPeer.php',
'BaseCcWebstreamMetadata' => 'airtime/om/BaseCcWebstreamMetadata.php', 'BaseCcWebstreamMetadata' => 'airtime/om/BaseCcWebstreamMetadata.php',
'BaseCcWebstreamMetadataQuery' => 'airtime/om/BaseCcWebstreamMetadataQuery.php', 'BaseCcWebstreamMetadataQuery' => 'airtime/om/BaseCcWebstreamMetadataQuery.php',
'CcMountNameTableMap' => 'airtime/map/CcMountNameTableMap.php',
'CcMountNamePeer' => 'airtime/CcMountNamePeer.php',
'CcMountName' => 'airtime/CcMountName.php',
'CcMountNameQuery' => 'airtime/CcMountNameQuery.php',
'BaseCcMountNamePeer' => 'airtime/om/BaseCcMountNamePeer.php',
'BaseCcMountName' => 'airtime/om/BaseCcMountName.php',
'BaseCcMountNameQuery' => 'airtime/om/BaseCcMountNameQuery.php',
'CcTimestampTableMap' => 'airtime/map/CcTimestampTableMap.php', 'CcTimestampTableMap' => 'airtime/map/CcTimestampTableMap.php',
'CcTimestampPeer' => 'airtime/CcTimestampPeer.php', 'CcTimestampPeer' => 'airtime/CcTimestampPeer.php',
'CcTimestamp' => 'airtime/CcTimestamp.php', 'CcTimestamp' => 'airtime/CcTimestamp.php',
@ -211,32 +204,4 @@ return array (
'BaseCcLocalePeer' => 'airtime/om/BaseCcLocalePeer.php', 'BaseCcLocalePeer' => 'airtime/om/BaseCcLocalePeer.php',
'BaseCcLocale' => 'airtime/om/BaseCcLocale.php', 'BaseCcLocale' => 'airtime/om/BaseCcLocale.php',
'BaseCcLocaleQuery' => 'airtime/om/BaseCcLocaleQuery.php', 'BaseCcLocaleQuery' => 'airtime/om/BaseCcLocaleQuery.php',
'CcPlayoutHistoryTableMap' => 'airtime/map/CcPlayoutHistoryTableMap.php',
'CcPlayoutHistoryPeer' => 'airtime/CcPlayoutHistoryPeer.php',
'CcPlayoutHistory' => 'airtime/CcPlayoutHistory.php',
'CcPlayoutHistoryQuery' => 'airtime/CcPlayoutHistoryQuery.php',
'BaseCcPlayoutHistoryPeer' => 'airtime/om/BaseCcPlayoutHistoryPeer.php',
'BaseCcPlayoutHistory' => 'airtime/om/BaseCcPlayoutHistory.php',
'BaseCcPlayoutHistoryQuery' => 'airtime/om/BaseCcPlayoutHistoryQuery.php',
'CcPlayoutHistoryMetaDataTableMap' => 'airtime/map/CcPlayoutHistoryMetaDataTableMap.php',
'CcPlayoutHistoryMetaDataPeer' => 'airtime/CcPlayoutHistoryMetaDataPeer.php',
'CcPlayoutHistoryMetaData' => 'airtime/CcPlayoutHistoryMetaData.php',
'CcPlayoutHistoryMetaDataQuery' => 'airtime/CcPlayoutHistoryMetaDataQuery.php',
'BaseCcPlayoutHistoryMetaDataPeer' => 'airtime/om/BaseCcPlayoutHistoryMetaDataPeer.php',
'BaseCcPlayoutHistoryMetaData' => 'airtime/om/BaseCcPlayoutHistoryMetaData.php',
'BaseCcPlayoutHistoryMetaDataQuery' => 'airtime/om/BaseCcPlayoutHistoryMetaDataQuery.php',
'CcPlayoutHistoryTemplateTableMap' => 'airtime/map/CcPlayoutHistoryTemplateTableMap.php',
'CcPlayoutHistoryTemplatePeer' => 'airtime/CcPlayoutHistoryTemplatePeer.php',
'CcPlayoutHistoryTemplate' => 'airtime/CcPlayoutHistoryTemplate.php',
'CcPlayoutHistoryTemplateQuery' => 'airtime/CcPlayoutHistoryTemplateQuery.php',
'BaseCcPlayoutHistoryTemplatePeer' => 'airtime/om/BaseCcPlayoutHistoryTemplatePeer.php',
'BaseCcPlayoutHistoryTemplate' => 'airtime/om/BaseCcPlayoutHistoryTemplate.php',
'BaseCcPlayoutHistoryTemplateQuery' => 'airtime/om/BaseCcPlayoutHistoryTemplateQuery.php',
'CcPlayoutHistoryTemplateFieldTableMap' => 'airtime/map/CcPlayoutHistoryTemplateFieldTableMap.php',
'CcPlayoutHistoryTemplateFieldPeer' => 'airtime/CcPlayoutHistoryTemplateFieldPeer.php',
'CcPlayoutHistoryTemplateField' => 'airtime/CcPlayoutHistoryTemplateField.php',
'CcPlayoutHistoryTemplateFieldQuery' => 'airtime/CcPlayoutHistoryTemplateFieldQuery.php',
'BaseCcPlayoutHistoryTemplateFieldPeer' => 'airtime/om/BaseCcPlayoutHistoryTemplateFieldPeer.php',
'BaseCcPlayoutHistoryTemplateField' => 'airtime/om/BaseCcPlayoutHistoryTemplateField.php',
'BaseCcPlayoutHistoryTemplateFieldQuery' => 'airtime/om/BaseCcPlayoutHistoryTemplateFieldQuery.php',
); );

View file

@ -38,21 +38,6 @@ define('MDATA_KEY_CUE_OUT' , 'cueout');
define('UI_MDATA_VALUE_FORMAT_FILE' , 'File'); define('UI_MDATA_VALUE_FORMAT_FILE' , 'File');
define('UI_MDATA_VALUE_FORMAT_STREAM' , 'live stream'); define('UI_MDATA_VALUE_FORMAT_STREAM' , 'live stream');
//User types
define('UTYPE_HOST' , 'H');
define('UTYPE_ADMIN' , 'A');
define('UTYPE_GUEST' , 'G');
define('UTYPE_PROGRAM_MANAGER' , 'P');
//Constants for playout history template fields
define('TEMPLATE_DATE', 'date');
define('TEMPLATE_TIME', 'time');
define('TEMPLATE_DATETIME', 'datetime');
define('TEMPLATE_STRING', 'string');
define('TEMPLATE_BOOLEAN', 'boolean');
define('TEMPLATE_INT', 'integer');
define('TEMPLATE_FLOAT', 'float');
// Session Keys // Session Keys
define('UI_PLAYLISTCONTROLLER_OBJ_SESSNAME', 'PLAYLISTCONTROLLER_OBJ'); define('UI_PLAYLISTCONTROLLER_OBJ_SESSNAME', 'PLAYLISTCONTROLLER_OBJ');
/*define('UI_PLAYLIST_SESSNAME', 'PLAYLIST'); /*define('UI_PLAYLIST_SESSNAME', 'PLAYLIST');

View file

@ -20,7 +20,7 @@ $pages = array(
'module' => 'default', 'module' => 'default',
'controller' => 'Plupload', 'controller' => 'Plupload',
'action' => 'index', 'action' => 'index',
'resource' => 'plupload' 'resource' => 'plupload'
), ),
array( array(
'label' => _('Library'), 'label' => _('Library'),
@ -79,6 +79,13 @@ $pages = array(
'action' => 'index', 'action' => 'index',
'resource' => 'systemstatus' 'resource' => 'systemstatus'
), ),
array(
'label' => _('Playout History'),
'module' => 'default',
'controller' => 'playouthistory',
'action' => 'index',
'resource' => 'playouthistory'
),
array( array(
'label' => _('Listener Stats'), 'label' => _('Listener Stats'),
'module' => 'default', 'module' => 'default',
@ -88,27 +95,6 @@ $pages = array(
) )
) )
), ),
array(
'label' => _('History'),
'uri' => '#',
'resource' => 'playouthistory',
'pages' => array(
array(
'label' => _('Playout History'),
'module' => 'default',
'controller' => 'playouthistory',
'action' => 'index',
'resource' => 'playouthistory'
),
array(
'label' => _('History Templates'),
'module' => 'default',
'controller' => 'playouthistorytemplate',
'action' => 'index',
'resource' => 'playouthistorytemplate'
),
)
),
array( array(
'label' => _('Help'), 'label' => _('Help'),
'uri' => '#', 'uri' => '#',

View file

@ -209,43 +209,6 @@ class ApiController extends Zend_Controller_Action
} }
} }
public function onAirLightAction()
{
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$result = array();
$result["on_air_light"] = false;
$result["on_air_light_expected_status"] = false;
$result["station_down"] = false;
$range = Application_Model_Schedule::GetPlayOrderRange();
$isItemCurrentlyScheduled = !is_null($range["current"]) && count($range["currentShow"]) > 0 ? true : false;
$isCurrentItemPlaying = $range["current"]["media_item_played"] ? true : false;
if ($isItemCurrentlyScheduled ||
Application_Model_Preference::GetSourceSwitchStatus("live_dj") == "on" ||
Application_Model_Preference::GetSourceSwitchStatus("master_dj") == "on")
{
$result["on_air_light_expected_status"] = true;
}
if (($isItemCurrentlyScheduled && $isCurrentItemPlaying) ||
Application_Model_Preference::GetSourceSwitchStatus("live_dj") == "on" ||
Application_Model_Preference::GetSourceSwitchStatus("master_dj") == "on")
{
$result["on_air_light"] = true;
}
if ($result["on_air_light_expected_status"] != $result["on_air_light"]) {
$result["station_down"] = true;
}
echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result);
}
/** /**
* Retrieve the currently playing show as well as upcoming shows. * Retrieve the currently playing show as well as upcoming shows.
* Number of shows returned and the time interval in which to * Number of shows returned and the time interval in which to
@ -400,9 +363,6 @@ class ApiController extends Zend_Controller_Action
$media_id = $this->_getParam("media_id"); $media_id = $this->_getParam("media_id");
Logging::debug("Received notification of new media item start: $media_id"); Logging::debug("Received notification of new media item start: $media_id");
Application_Model_Schedule::UpdateMediaPlayedStatus($media_id); Application_Model_Schedule::UpdateMediaPlayedStatus($media_id);
$historyService = new Application_Service_HistoryService();
$historyService->insertPlayedItem($media_id);
//set a 'last played' timestamp for media item //set a 'last played' timestamp for media item
//needed for smart blocks //needed for smart blocks
@ -1009,30 +969,23 @@ class ApiController extends Zend_Controller_Action
//calculated with silan by actually scanning the entire file. This //calculated with silan by actually scanning the entire file. This
//process takes a really long time, and so we only do it in the background //process takes a really long time, and so we only do it in the background
//after the file has already been imported -MK //after the file has already been imported -MK
try { $length = $file->getDbLength();
$length = $file->getDbLength(); if (isset($info['length'])) {
if (isset($info['length'])) { $length = $info['length'];
$length = $info['length']; //length decimal number in seconds. Need to convert it to format
//length decimal number in seconds. Need to convert it to format //HH:mm:ss to get around silly PHP limitations.
//HH:mm:ss to get around silly PHP limitations. $length = Application_Common_DateHelper::secondsToPlaylistTime($length);
$length = Application_Common_DateHelper::secondsToPlaylistTime($length);
$file->setDbLength($length);
}
$cuein = isset($info['cuein']) ? $info['cuein'] : 0; $file->setDbLength($length);
$cueout = isset($info['cueout']) ? $info['cueout'] : $length;
$file->setDbCuein($cuein);
$file->setDbCueout($cueout);
$file->setDbSilanCheck(true);
$file->save();
} catch (Exception $e) {
Logging::info("Failed to update silan values for ".$file->getDbTrackTitle());
Logging::info("File length analyzed by Silan is: ".$length);
//set silan_check to true so we don't attempt to re-anaylze again
$file->setDbSilanCheck(true);
$file->save();
} }
$cuein = isset($info['cuein']) ? $info['cuein'] : 0;
$cueout = isset($info['cueout']) ? $info['cueout'] : $length;
$file->setDbCuein($cuein);
$file->setDbCueout($cueout);
$file->setDbSilanCheck(true);
$file->save();
} }
$this->_helper->json->sendJson(array()); $this->_helper->json->sendJson(array());

View file

@ -53,7 +53,7 @@ class LibraryController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/observer/observer.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/observer/observer.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/config.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/config.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/curves.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/waveformplaylist/curves.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
@ -68,9 +68,9 @@ class LibraryController extends Zend_Controller_Action
//arbitrary attributes need to be allowed to set an id for the templates. //arbitrary attributes need to be allowed to set an id for the templates.
$this->view->headScript()->setAllowArbitraryAttributes(true); $this->view->headScript()->setAllowArbitraryAttributes(true);
//$this->view->headScript()->appendScript(file_get_contents(APPLICATION_PATH.'/../public/js/waveformplaylist/templates/bottombar.tpl'), //$this->view->headScript()->appendScript(file_get_contents(APPLICATION_PATH.'/../public/js/waveformplaylist/templates/bottombar.tpl'),
// 'text/template', array('id' => 'tpl_playlist_cues', 'noescape' => true)); // 'text/template', array('id' => 'tpl_playlist_cues', 'noescape' => true));
$this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
try { try {
@ -179,7 +179,9 @@ class LibraryController extends Zend_Controller_Action
$type = $this->_getParam('type'); $type = $this->_getParam('type');
//playlist||timeline //playlist||timeline
$screen = $this->_getParam('screen'); $screen = $this->_getParam('screen');
$baseUrl = Application_Common_OsPath::getBaseDir();
$menu = array(); $menu = array();
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
@ -248,7 +250,7 @@ class LibraryController extends Zend_Controller_Action
} elseif ($type == "stream") { } elseif ($type == "stream") {
$webstream = CcWebstreamQuery::create()->findPK($id); $webstream = CcWebstreamQuery::create()->findPK($id);
$obj = new Application_Model_Webstream($webstream); $obj = new Application_Model_Webstream($webstream);
$menu["play"]["mime"] = $webstream->getDbMime(); $menu["play"]["mime"] = $webstream->getDbMime();
if (isset($obj_sess->id) && $screen == "playlist") { if (isset($obj_sess->id) && $screen == "playlist") {
@ -371,15 +373,15 @@ class LibraryController extends Zend_Controller_Action
$this->view->message = $message; $this->view->message = $message;
} }
} }
// duplicate playlist // duplicate playlist
public function duplicateAction(){ public function duplicateAction(){
$params = $this->getRequest()->getParams(); $params = $this->getRequest()->getParams();
$id = $params['id']; $id = $params['id'];
$originalPl = new Application_Model_Playlist($id); $originalPl = new Application_Model_Playlist($id);
$newPl = new Application_Model_Playlist(); $newPl = new Application_Model_Playlist();
$contents = $originalPl->getContents(); $contents = $originalPl->getContents();
foreach ($contents as &$c) { foreach ($contents as &$c) {
if ($c['type'] == '0') { if ($c['type'] == '0') {
@ -391,15 +393,15 @@ class LibraryController extends Zend_Controller_Action
} }
$c[0] = $c['item_id']; $c[0] = $c['item_id'];
} }
$newPl->addAudioClips($contents, null, 'before'); $newPl->addAudioClips($contents, null, 'before');
$newPl->setCreator(Application_Model_User::getCurrentUser()->getId()); $newPl->setCreator(Application_Model_User::getCurrentUser()->getId());
$newPl->setDescription($originalPl->getDescription()); $newPl->setDescription($originalPl->getDescription());
list($plFadeIn, ) = $originalPl->getFadeInfo(0); list($plFadeIn, ) = $originalPl->getFadeInfo(0);
list(, $plFadeOut) = $originalPl->getFadeInfo($originalPl->getSize()-1); list(, $plFadeOut) = $originalPl->getFadeInfo($originalPl->getSize()-1);
$newPl->setfades($plFadeIn, $plFadeOut); $newPl->setfades($plFadeIn, $plFadeOut);
$newPl->setName(sprintf(_("Copy of %s"), $originalPl->getName())); $newPl->setName(sprintf(_("Copy of %s"), $originalPl->getName()));
} }
@ -547,7 +549,7 @@ class LibraryController extends Zend_Controller_Action
$id = $this->_getParam('id'); $id = $this->_getParam('id');
Application_Model_Soundcloud::uploadSoundcloud($id); Application_Model_Soundcloud::uploadSoundcloud($id);
// we should die with ui info // we should die with ui info
$this->_helper->json->sendJson(null); $this->_helper->json->sendJson(null);
} }
public function getUploadToSoundcloudStatusAction() public function getUploadToSoundcloudStatusAction()

View file

@ -9,36 +9,36 @@ class ListenerstatController extends Zend_Controller_Action
->addActionContext('get-data', 'json') ->addActionContext('get-data', 'json')
->initContext(); ->initContext();
} }
public function indexAction() public function indexAction()
{ {
$CC_CONFIG = Config::getConfig(); $CC_CONFIG = Config::getConfig();
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = Application_Common_OsPath::getBaseDir(); $baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'js/flot/jquery.flot.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/flot/jquery.flot.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/flot/jquery.flot.crosshair.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/flot/jquery.flot.crosshair.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/listenerstat/listenerstat.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/listenerstat/listenerstat.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$offset = date("Z") * -1; $offset = date("Z") * -1;
$this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds"); $this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds");
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
//default time is the last 24 hours. //default time is the last 24 hours.
$now = time(); $now = time();
$from = $request->getParam("from", $now - (24*60*60)); $from = $request->getParam("from", $now - (24*60*60));
$to = $request->getParam("to", $now); $to = $request->getParam("to", $now);
$start = DateTime::createFromFormat("U", $from, new DateTimeZone("UTC")); $start = DateTime::createFromFormat("U", $from, new DateTimeZone("UTC"));
$start->setTimezone(new DateTimeZone(date_default_timezone_get())); $start->setTimezone(new DateTimeZone(date_default_timezone_get()));
$end = DateTime::createFromFormat("U", $to, new DateTimeZone("UTC")); $end = DateTime::createFromFormat("U", $to, new DateTimeZone("UTC"));
$end->setTimezone(new DateTimeZone(date_default_timezone_get())); $end->setTimezone(new DateTimeZone(date_default_timezone_get()));
$form = new Application_Form_DateRange(); $form = new Application_Form_DateRange();
$form->populate(array( $form->populate(array(
'his_date_start' => $start->format("Y-m-d"), 'his_date_start' => $start->format("Y-m-d"),
@ -46,7 +46,7 @@ class ListenerstatController extends Zend_Controller_Action
'his_date_end' => $end->format("Y-m-d"), 'his_date_end' => $end->format("Y-m-d"),
'his_time_end' => $end->format("H:i") 'his_time_end' => $end->format("H:i")
)); ));
$errorStatus = Application_Model_StreamSetting::GetAllListenerStatErrors(); $errorStatus = Application_Model_StreamSetting::GetAllListenerStatErrors();
Logging::info($errorStatus); Logging::info($errorStatus);
$out = array(); $out = array();
@ -57,24 +57,25 @@ class ListenerstatController extends Zend_Controller_Action
} }
$out[$key[0]] = $v['value']; $out[$key[0]] = $v['value'];
} }
$this->view->errorStatus = $out; $this->view->errorStatus = $out;
$this->view->date_form = $form; $this->view->date_form = $form;
} }
public function getDataAction(){ public function getDataAction(){
$request = $this->getRequest(); $request = $this->getRequest();
$current_time = time(); $current_time = time();
$params = $request->getParams(); $params = $request->getParams();
$starts_epoch = $request->getParam("startTimestamp", $current_time - (60*60*24)); $starts_epoch = $request->getParam("startTimestamp", $current_time - (60*60*24));
$ends_epoch = $request->getParam("endTimestamp", $current_time); $ends_epoch = $request->getParam("endTimestamp", $current_time);
$mountName = $request->getParam("mountName", null);
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC")); $startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC")); $endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
$data = Application_Model_ListenerStat::getDataPointsWithinRange($startsDT->format("Y-m-d H:i:s"), $endsDT->format("Y-m-d H:i:s")); $data = Application_Model_ListenerStat::getDataPointsWithinRange($startsDT->format("Y-m-d H:i:s"), $endsDT->format("Y-m-d H:i:s"), $mountName);
$this->_helper->json->sendJson($data); $this->_helper->json->sendJson($data);
} }
} }

View file

@ -6,16 +6,7 @@ class PlayouthistoryController extends Zend_Controller_Action
{ {
$ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext $ajaxContext
->addActionContext('file-history-feed', 'json') ->addActionContext('playout-history-feed', 'json')
->addActionContext('item-history-feed', 'json')
->addActionContext('show-history-feed', 'json')
->addActionContext('edit-file-item', 'json')
->addActionContext('create-list-item', 'json')
->addActionContext('edit-list-item', 'json')
->addActionContext('delete-list-item', 'json')
->addActionContext('delete-list-items', 'json')
->addActionContext('update-list-item', 'json')
->addActionContext('update-file-item', 'json')
->initContext(); ->initContext();
} }
@ -51,219 +42,45 @@ class PlayouthistoryController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools-2.1.5/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools-2.1.5/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$offset = date("Z") * -1; $offset = date("Z") * -1;
$this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds"); $this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds");
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/bootstrap-datetime/bootstrap-datetimepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/historytable.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/historytable.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/bootstrap-datetimepicker.min.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'js/datatables/plugin/TableTools/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'js/datatables/plugin/TableTools-2.1.5/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/playouthistory.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/playouthistory.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
//set datatables columns for display of data.
$historyService = new Application_Service_HistoryService();
$columns = json_encode($historyService->getDatatablesLogSheetColumns());
$script = "localStorage.setItem( 'datatables-historyitem-aoColumns', JSON.stringify($columns) ); ";
$columns = json_encode($historyService->getDatatablesFileSummaryColumns());
$script.= "localStorage.setItem( 'datatables-historyfile-aoColumns', JSON.stringify($columns) );";
$this->view->headScript()->appendScript($script);
$user = Application_Model_User::getCurrentUser();
$this->view->userType = $user->getType();
} }
public function fileHistoryFeedAction() public function playoutHistoryFeedAction()
{
try {
$request = $this->getRequest();
$current_time = time();
$params = $request->getParams();
$starts_epoch = $request->getParam("start", $current_time - (60*60*24));
$ends_epoch = $request->getParam("end", $current_time);
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
$historyService = new Application_Service_HistoryService();
$r = $historyService->getFileSummaryData($startsDT, $endsDT, $params);
$this->view->sEcho = $r["sEcho"];
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
$this->view->iTotalRecords = $r["iTotalRecords"];
$this->view->history = $r["history"];
}
catch (Exception $e) {
Logging::info($e);
Logging::info($e->getMessage());
}
}
public function itemHistoryFeedAction()
{
try {
$request = $this->getRequest();
$current_time = time();
$params = $request->getParams();
$starts_epoch = $request->getParam("start", $current_time - (60*60*24));
$ends_epoch = $request->getParam("end", $current_time);
$instance = $request->getParam("instance_id", null);
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
$historyService = new Application_Service_HistoryService();
$r = $historyService->getPlayedItemData($startsDT, $endsDT, $params, $instance);
$this->view->sEcho = $r["sEcho"];
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
$this->view->iTotalRecords = $r["iTotalRecords"];
$this->view->history = $r["history"];
}
catch (Exception $e) {
Logging::info($e);
Logging::info($e->getMessage());
}
}
public function showHistoryFeedAction()
{
try {
$request = $this->getRequest();
$current_time = time();
$starts_epoch = $request->getParam("start", $current_time - (60*60*24));
$ends_epoch = $request->getParam("end", $current_time);
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
$historyService = new Application_Service_HistoryService();
$shows = $historyService->getShowList($startsDT, $endsDT);
$this->_helper->json->sendJson($shows);
}
catch (Exception $e) {
Logging::info($e);
Logging::info($e->getMessage());
}
}
public function editFileItemAction()
{
$file_id = $this->_getParam('id');
$historyService = new Application_Service_HistoryService();
$form = $historyService->makeHistoryFileForm($file_id);
$this->view->form = $form;
$this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
unset($this->view->form);
}
public function createListItemAction()
{
try {
$request = $this->getRequest();
$params = $request->getPost();
Logging::info($params);
$historyService = new Application_Service_HistoryService();
$json = $historyService->createPlayedItem($params);
if (isset($json["form"])) {
$this->view->form = $json["form"];
$json["form"] = $this->view->render('playouthistory/dialog.phtml');
unset($this->view->form);
}
$this->_helper->json->sendJson($json);
}
catch (Exception $e) {
Logging::info($e);
Logging::info($e->getMessage());
}
}
public function editListItemAction()
{
$id = $this->_getParam('id', null);
$populate = isset($id) ? true : false;
$historyService = new Application_Service_HistoryService();
$form = $historyService->makeHistoryItemForm($id, $populate);
$this->view->form = $form;
$this->view->dialog = $this->view->render('playouthistory/dialog.phtml');
unset($this->view->form);
}
public function deleteListItemAction()
{
$history_id = $this->_getParam('id');
$historyService = new Application_Service_HistoryService();
$historyService->deletePlayedItem($history_id);
}
public function deleteListItemsAction()
{
$history_ids = $this->_getParam('ids');
$historyService = new Application_Service_HistoryService();
$historyService->deletePlayedItems($history_ids);
}
public function updateListItemAction()
{
try {
$request = $this->getRequest();
$params = $request->getPost();
Logging::info($params);
$historyService = new Application_Service_HistoryService();
$json = $historyService->editPlayedItem($params);
if (isset($json["form"])) {
$this->view->form = $json["form"];
$json["form"] = $this->view->render('playouthistory/dialog.phtml');
unset($this->view->form);
}
$this->_helper->json->sendJson($json);
}
catch (Exception $e) {
Logging::info($e);
Logging::info($e->getMessage());
}
}
public function updateFileItemAction()
{ {
$request = $this->getRequest(); $request = $this->getRequest();
$params = $request->getPost(); $current_time = time();
Logging::info($params);
$historyService = new Application_Service_HistoryService(); $params = $request->getParams();
$json = $historyService->editPlayedFile($params);
$this->_helper->json->sendJson($json); $starts_epoch = $request->getParam("start", $current_time - (60*60*24));
$ends_epoch = $request->getParam("end", $current_time);
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
Logging::info("history starts {$startsDT->format("Y-m-d H:i:s")}");
Logging::info("history ends {$endsDT->format("Y-m-d H:i:s")}");
$history = new Application_Model_PlayoutHistory($startsDT, $endsDT, $params);
$r = $history->getItems();
$this->view->sEcho = $r["sEcho"];
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
$this->view->iTotalRecords = $r["iTotalRecords"];
$this->view->history = $r["history"];
} }
} }

View file

@ -1,143 +0,0 @@
<?php
class PlayouthistorytemplateController extends Zend_Controller_Action
{
public function init()
{
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext
->addActionContext('create-template', 'json')
->addActionContext('update-template', 'json')
->addActionContext('delete-template', 'json')
->addActionContext('set-template-default', 'json')
->initContext();
}
public function indexAction()
{
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/template.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
$historyService = new Application_Service_HistoryService();
$this->view->template_list = $historyService->getListItemTemplates();
$this->view->template_file = $historyService->getFileTemplates();
$this->view->configured = $historyService->getConfiguredTemplateIds();
}
public function configureTemplateAction() {
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/configuretemplate.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/history_styles.css?'.$CC_CONFIG['airtime_version']);
try {
$templateId = $this->_getParam('id');
$historyService = new Application_Service_HistoryService();
$template = $historyService->loadTemplate($templateId);
$templateType = $template["type"];
$supportedTypes = $historyService->getSupportedTemplateTypes();
if (!in_array($templateType, $supportedTypes)) {
throw new Exception("Error: $templateType is not supported.");
}
$getMandatoryFields = "mandatory".ucfirst($templateType)."Fields";
$mandatoryFields = $historyService->$getMandatoryFields();
$this->view->template_id = $templateId;
$this->view->template_name = $template["name"];
$this->view->template_fields = $template["fields"];
$this->view->template_type = $templateType;
$this->view->fileMD = $historyService->getFileMetadataTypes();
$this->view->fields = $historyService->getFieldTypes();
$this->view->required_fields = $mandatoryFields;
$this->view->configured = $historyService->getConfiguredTemplateIds();
}
catch (Exception $e) {
Logging::info("Error?");
Logging::info($e);
Logging::info($e->getMessage());
$this->_forward('index', 'playouthistorytemplate');
}
}
public function createTemplateAction()
{
$templateType = $this->_getParam('type', null);
$request = $this->getRequest();
$params = $request->getPost();
try {
$historyService = new Application_Service_HistoryService();
$supportedTypes = $historyService->getSupportedTemplateTypes();
if (!in_array($templateType, $supportedTypes)) {
throw new Exception("Error: $templateType is not supported.");
}
$id = $historyService->createTemplate($params);
$this->view->url = $this->view->baseUrl("Playouthistorytemplate/configure-template/id/{$id}");
}
catch (Exception $e) {
Logging::info($e);
Logging::info($e->getMessage());
$this->view->error = $e->getMessage();
}
}
public function setTemplateDefaultAction()
{
$templateId = $this->_getParam('id', null);
try {
$historyService = new Application_Service_HistoryService();
$historyService->setConfiguredTemplate($templateId);
}
catch (Exception $e) {
Logging::info($e);
Logging::info($e->getMessage());
}
}
public function updateTemplateAction()
{
$templateId = $this->_getParam('id', null);
$name = $this->_getParam('name', null);
$fields = $this->_getParam('fields', array());
try {
$historyService = new Application_Service_HistoryService();
$historyService->updateItemTemplate($templateId, $name, $fields);
}
catch (Exception $e) {
Logging::info($e);
Logging::info($e->getMessage());
}
}
public function deleteTemplateAction()
{
$templateId = $this->_getParam('id');
try {
$historyService = new Application_Service_HistoryService();
$historyService->deleteTemplate($templateId);
}
catch (Exception $e) {
Logging::info($e);
Logging::info($e->getMessage());
}
}
}

View file

@ -46,17 +46,6 @@ class ScheduleController extends Zend_Controller_Action
$baseUrl = Application_Common_OsPath::getBaseDir(); $baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendScript(
"var calendarPref = {};\n".
"calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n".
"calendarPref.timestamp = ".time().";\n".
"calendarPref.timezoneOffset = ".date("Z").";\n".
"calendarPref.timeScale = '".Application_Model_Preference::GetCalendarTimeScale()."';\n".
"calendarPref.timeInterval = ".Application_Model_Preference::GetCalendarTimeInterval().";\n".
"calendarPref.weekStartDay = ".Application_Model_Preference::GetWeekStartDay().";\n".
"var calendarEvents = null;"
);
$this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
//full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time //full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time
@ -85,6 +74,7 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -96,6 +86,7 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/TableTools.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
//End Show builder JS/CSS requirements //End Show builder JS/CSS requirements
@ -107,6 +98,16 @@ class ScheduleController extends Zend_Controller_Action
} }
$this->view->addNewShow = true; $this->view->addNewShow = true;
$this->view->headScript()->appendScript(
"var calendarPref = {};\n".
"calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n".
"calendarPref.timestamp = ".time().";\n".
"calendarPref.timezoneOffset = ".date("Z").";\n".
"calendarPref.timeScale = '".Application_Model_Preference::GetCalendarTimeScale()."';\n".
"calendarPref.timeInterval = ".Application_Model_Preference::GetCalendarTimeInterval().";\n".
"calendarPref.weekStartDay = ".Application_Model_Preference::GetWeekStartDay().";\n".
"var calendarEvents = null;"
);
} }
public function eventFeedAction() public function eventFeedAction()

View file

@ -1,211 +0,0 @@
<?php
class Application_Form_EditHistory extends Zend_Form
{
const VALIDATE_DATETIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
//this is used by the javascript widget, unfortunately h/H is opposite from Zend.
const TIMEPICKER_DATETIME_FORMAT = 'yyyy-MM-dd hh:mm:ss';
const VALIDATE_DATE_FORMAT = 'yyyy-MM-dd';
const VALIDATE_TIME_FORMAT = 'HH:mm:ss';
const ITEM_TYPE = "type";
const ITEM_CLASS = "class";
const ITEM_OPTIONS = "options";
const ITEM_ID_SUFFIX = "name";
const TEXT_INPUT_CLASS = "input_text";
private $formElTypes = array(
TEMPLATE_DATE => array(
"class" => "Zend_Form_Element_Text",
"attrs" => array(
"class" => self::TEXT_INPUT_CLASS
),
"validators" => array(
array(
"class" => "Zend_Validate_Date",
"params" => array(
"format" => self::VALIDATE_DATE_FORMAT
)
)
),
"filters" => array(
"StringTrim"
)
),
TEMPLATE_TIME => array(
"class" => "Zend_Form_Element_Text",
"attrs" => array(
"class" => self::TEXT_INPUT_CLASS
),
"validators" => array(
array(
"class" => "Zend_Validate_Date",
"params" => array(
"format" => self::VALIDATE_TIME_FORMAT
)
)
),
"filters" => array(
"StringTrim"
)
),
TEMPLATE_DATETIME => array(
"class" => "Zend_Form_Element_Text",
"attrs" => array(
"class" => self::TEXT_INPUT_CLASS
),
"validators" => array(
array(
"class" => "Zend_Validate_Date",
"params" => array(
"format" => self::VALIDATE_DATETIME_FORMAT
)
)
),
"filters" => array(
"StringTrim"
)
),
TEMPLATE_STRING => array(
"class" => "Zend_Form_Element_Text",
"attrs" => array(
"class" => self::TEXT_INPUT_CLASS
),
"filters" => array(
"StringTrim"
)
),
TEMPLATE_BOOLEAN => array(
"class" => "Zend_Form_Element_Checkbox",
"validators" => array(
array(
"class" => "Zend_Validate_InArray",
"options" => array(
"haystack" => array(0,1)
)
)
)
),
TEMPLATE_INT => array(
"class" => "Zend_Form_Element_Text",
"validators" => array(
array(
"class" => "Zend_Validate_Int",
)
),
"attrs" => array(
"class" => self::TEXT_INPUT_CLASS
)
),
TEMPLATE_FLOAT => array(
"class" => "Zend_Form_Element_Text",
"attrs" => array(
"class" => self::TEXT_INPUT_CLASS
),
"validators" => array(
array(
"class" => "Zend_Validate_Float",
)
)
),
);
public function init() {
$history_id = new Zend_Form_Element_Hidden($this::ID_PREFIX.'id');
$history_id->setValidators(array(
new Zend_Validate_Int()
));
$history_id->setDecorators(array('ViewHelper'));
$this->addElement($history_id);
$dynamic_attrs = new Zend_Form_SubForm();
$this->addSubForm($dynamic_attrs, $this::ID_PREFIX.'template');
// Add the submit button
$this->addElement('button', $this::ID_PREFIX.'save', array(
'ignore' => true,
'class' => 'btn '.$this::ID_PREFIX.'save',
'label' => _('Save'),
'decorators' => array(
'ViewHelper'
)
));
// Add the cancel button
$this->addElement('button', $this::ID_PREFIX.'cancel', array(
'ignore' => true,
'class' => 'btn '.$this::ID_PREFIX.'cancel',
'label' => _('Cancel'),
'decorators' => array(
'ViewHelper'
)
));
}
public function createFromTemplate($template, $required) {
$templateSubForm = $this->getSubForm($this::ID_PREFIX.'template');
for ($i = 0, $len = count($template); $i < $len; $i++) {
$item = $template[$i];
//don't dynamically add this as it should be included in the
//init() function already if it should show up in the UI..
if (in_array($item["name"], $required)) {
continue;
}
$formElType = $this->formElTypes[$item[self::ITEM_TYPE]];
$label = $item[self::ITEM_ID_SUFFIX];
$id = $this::ID_PREFIX.$label;
$el = new $formElType[self::ITEM_CLASS]($id);
$el->setLabel($item["label"]);
if (isset($formElType["attrs"])) {
$attrs = $formElType["attrs"];
foreach ($attrs as $key => $value) {
$el->setAttrib($key, $value);
}
}
if (isset($formElType["filters"])) {
$filters = $formElType["filters"];
foreach ($filters as $filter) {
$el->addFilter($filter);
}
}
if (isset($formElType["validators"])) {
$validators = $formElType["validators"];
foreach ($validators as $index => $arr) {
$options = isset($arr[self::ITEM_OPTIONS]) ? $arr[self::ITEM_OPTIONS] : null;
$validator = new $arr[self::ITEM_CLASS]($options);
//extra validator info
if (isset($arr["params"])) {
foreach ($arr["params"] as $key => $value) {
$method = "set".ucfirst($key);
$validator->$method($value);
}
}
$el->addValidator($validator);
}
}
$el->setDecorators(array('ViewHelper'));
$templateSubForm->addElement($el);
}
}
}

View file

@ -1,22 +0,0 @@
<?php
class Application_Form_EditHistoryFile extends Application_Form_EditHistory
{
const ID_PREFIX = "his_file_";
public function init() {
parent::init();
$this->setDecorators(
array(
array('ViewScript', array('viewScript' => 'form/edit-history-file.phtml'))
)
);
}
public function createFromTemplate($template, $required) {
parent::createFromTemplate($template, $required);
}
}

View file

@ -1,66 +0,0 @@
<?php
class Application_Form_EditHistoryItem extends Application_Form_EditHistory
{
const ID_PREFIX = "his_item_";
public function init() {
parent::init();
$this->setDecorators(array(
'PrepareElements',
array('ViewScript', array('viewScript' => 'form/edit-history-item.phtml'))
));
/*
$instance = new Zend_Form_Element_Select("instance_id");
$instance->setLabel(_("Choose Show Instance"));
$instance->setMultiOptions(array("0" => "-----------"));
$instance->setValue(0);
$instance->setDecorators(array('ViewHelper'));
$this->addElement($instance);
*/
$starts = new Zend_Form_Element_Text(self::ID_PREFIX.'starts');
$starts->setValidators(array(
new Zend_Validate_Date(self::VALIDATE_DATETIME_FORMAT)
));
$starts->setAttrib('class', self::TEXT_INPUT_CLASS." datepicker");
$starts->setAttrib('data-format', self::TIMEPICKER_DATETIME_FORMAT);
$starts->addFilter('StringTrim');
$starts->setLabel(_('Start Time'));
$starts->setDecorators(array('ViewHelper'));
$starts->setRequired(true);
$this->addElement($starts);
$ends = new Zend_Form_Element_Text(self::ID_PREFIX.'ends');
$ends->setValidators(array(
new Zend_Validate_Date(self::VALIDATE_DATETIME_FORMAT)
));
$ends->setAttrib('class', self::TEXT_INPUT_CLASS." datepicker");
$ends->setAttrib('data-format', self::TIMEPICKER_DATETIME_FORMAT);
$ends->addFilter('StringTrim');
$ends->setLabel(_('End Time'));
$ends->setDecorators(array('ViewHelper'));
$ends->setRequired(true);
$this->addElement($ends);
}
public function createFromTemplate($template, $required) {
parent::createFromTemplate($template, $required);
}
public function populateShowInstances($possibleInstances, $default) {
$possibleInstances["0"] = _("No Show");
$instance = new Zend_Form_Element_Select("his_instance_select");
//$instance->setLabel(_("Choose Show Instance"));
$instance->setMultiOptions($possibleInstances);
$instance->setValue($default);
$instance->setDecorators(array('ViewHelper'));
$this->addElement($instance);
}
}

View file

@ -5,7 +5,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
private $stringCriteriaOptions; private $stringCriteriaOptions;
private $numericCriteriaOptions; private $numericCriteriaOptions;
private $limitOptions; private $limitOptions;
/* We need to know if the criteria value will be a string /* We need to know if the criteria value will be a string
* or numeric value in order to populate the modifier * or numeric value in order to populate the modifier
* select list * select list
@ -40,7 +40,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
"info_url" => "s", "info_url" => "s",
"year" => "n" "year" => "n"
); );
private function getCriteriaOptions($option = null) private function getCriteriaOptions($option = null)
{ {
if (!isset($this->criteriaOptions)) { if (!isset($this->criteriaOptions)) {
@ -75,7 +75,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
"year" => _("Year") "year" => _("Year")
); );
} }
if (is_null($option)) return $this->criteriaOptions; if (is_null($option)) return $this->criteriaOptions;
else return $this->criteriaOptions[$option]; else return $this->criteriaOptions[$option];
} }
@ -122,7 +122,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
} }
return $this->limitOptions; return $this->limitOptions;
} }
public function init() public function init()
{ {
@ -259,7 +259,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$repeatTracks->setChecked($storedCrit["repeat_tracks"]["value"] == 1?true:false); $repeatTracks->setChecked($storedCrit["repeat_tracks"]["value"] == 1?true:false);
} }
$this->addElement($repeatTracks); $this->addElement($repeatTracks);
$limit = new Zend_Form_Element_Select('sp_limit_options'); $limit = new Zend_Form_Element_Select('sp_limit_options');
$limit->setAttrib('class', 'sp_input_select') $limit->setAttrib('class', 'sp_input_select')
->setDecorators(array('viewHelper')) ->setDecorators(array('viewHelper'))
@ -268,7 +268,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$limit->setValue($storedCrit["limit"]["modifier"]); $limit->setValue($storedCrit["limit"]["modifier"]);
} }
$this->addElement($limit); $this->addElement($limit);
$limitValue = new Zend_Form_Element_Text('sp_limit_value'); $limitValue = new Zend_Form_Element_Text('sp_limit_value');
$limitValue->setAttrib('class', 'sp_input_text_limit') $limitValue->setAttrib('class', 'sp_input_text_limit')
->setLabel(_('Limit to')) ->setLabel(_('Limit to'))
@ -541,7 +541,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$isValid = false; $isValid = false;
} }
// length check // length check
if ($d['sp_criteria_value'] >= pow(2,31)) { if (intval($d['sp_criteria_value']) >= pow(2,31)) {
$element->addError(_("The value should be less then 2147483648")); $element->addError(_("The value should be less then 2147483648"));
$isValid = false; $isValid = false;
} }

View file

@ -58,6 +58,43 @@ class Application_Model_Datatables
public static function findEntries($con, $displayColumns, $fromTable, public static function findEntries($con, $displayColumns, $fromTable,
$data, $dataProp = "aaData") $data, $dataProp = "aaData")
{ {
$librarySetting =
Application_Model_Preference::getCurrentLibraryTableColumnMap();
//$displayColumns[] = 'owner';
// map that maps original column position to db name
$current2dbname = array();
// array of search terms
$orig2searchTerm = array();
foreach ($data as $key => $d) {
if (strstr($key, "mDataProp_")) {
list($dump, $index) = explode("_", $key);
$current2dbname[$index] = $d;
} elseif (strstr($key, "sSearch_")) {
list($dump, $index) = explode("_", $key);
$orig2searchTerm[$index] = $d;
}
}
// map that maps dbname to searchTerm
$dbname2searchTerm = array();
foreach ($current2dbname as $currentPos => $dbname) {
$new_index = $librarySetting($currentPos);
// TODO : Fix this retarded hack later. Just a band aid for
// now at least we print some warnings so that we don't
// forget about this -- cc-4462
if ( array_key_exists($new_index, $orig2searchTerm) ) {
$dbname2searchTerm[$dbname] = $orig2searchTerm[$new_index];
} else {
Logging::warn("Trying to reorder to unknown index
printing as much debugging as possible...");
$debug = array(
'$new_index' => $new_index,
'$currentPos' => $currentPos,
'$orig2searchTerm' => $orig2searchTerm);
Logging::warn($debug);
}
}
$where = array(); $where = array();
/* Holds the parameters for binding after the statement has been /* Holds the parameters for binding after the statement has been
@ -65,45 +102,6 @@ class Application_Model_Datatables
$params = array(); $params = array();
if (isset($data['advSearch']) && $data['advSearch'] === 'true') { if (isset($data['advSearch']) && $data['advSearch'] === 'true') {
$librarySetting =
Application_Model_Preference::getCurrentLibraryTableColumnMap();
//$displayColumns[] = 'owner';
// map that maps original column position to db name
$current2dbname = array();
// array of search terms
$orig2searchTerm = array();
foreach ($data as $key => $d) {
if (strstr($key, "mDataProp_")) {
list($dump, $index) = explode("_", $key);
$current2dbname[$index] = $d;
} elseif (strstr($key, "sSearch_")) {
list($dump, $index) = explode("_", $key);
$orig2searchTerm[$index] = $d;
}
}
// map that maps dbname to searchTerm
$dbname2searchTerm = array();
foreach ($current2dbname as $currentPos => $dbname) {
$new_index = $librarySetting($currentPos);
// TODO : Fix this retarded hack later. Just a band aid for
// now at least we print some warnings so that we don't
// forget about this -- cc-4462
if ( array_key_exists($new_index, $orig2searchTerm) ) {
$dbname2searchTerm[$dbname] = $orig2searchTerm[$new_index];
} else {
Logging::warn("Trying to reorder to unknown index
printing as much debugging as possible...");
$debug = array(
'$new_index' => $new_index,
'$currentPos' => $currentPos,
'$orig2searchTerm' => $orig2searchTerm);
Logging::warn($debug);
}
}
$advancedWhere = self::buildWhereClauseForAdvancedSearch($dbname2searchTerm); $advancedWhere = self::buildWhereClauseForAdvancedSearch($dbname2searchTerm);
if (!empty($advancedWhere['clause'])) { if (!empty($advancedWhere['clause'])) {
$where[] = join(" AND ", $advancedWhere['clause']); $where[] = join(" AND ", $advancedWhere['clause']);
@ -121,6 +119,7 @@ class Application_Model_Datatables
$sql = $selectorCount." FROM ".$fromTable; $sql = $selectorCount." FROM ".$fromTable;
$sqlTotalRows = $sql; $sqlTotalRows = $sql;
if (isset($searchTerms)) { if (isset($searchTerms)) {
$searchCols = array(); $searchCols = array();
for ($i = 0; $i < $data["iColumns"]; $i++) { for ($i = 0; $i < $data["iColumns"]; $i++) {
@ -165,47 +164,57 @@ class Application_Model_Datatables
$sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby; $sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby;
} //limit the results returned.
else { if ($displayLength !== -1) {
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
}
} else {
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby; $sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby;
}
//limit the results returned. //limit the results returned.
if ($displayLength !== -1) { if ($displayLength !== -1) {
$sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength; $sql .= " OFFSET ".$data["iDisplayStart"]." LIMIT ".$displayLength;
}
} }
try { try {
//Logging::info($sqlTotalRows);
$r = $con->query($sqlTotalRows); $r = $con->query($sqlTotalRows);
$totalRows = $r->fetchColumn(0); $totalRows = $r->fetchColumn(0);
if (isset($sqlTotalDisplayRows)) { if (isset($sqlTotalDisplayRows)) {
//Logging::info("sql is set");
//Logging::info($sqlTotalDisplayRows);
$totalDisplayRows = Application_Common_Database::prepareAndExecute($sqlTotalDisplayRows, $params, 'column'); $totalDisplayRows = Application_Common_Database::prepareAndExecute($sqlTotalDisplayRows, $params, 'column');
} } else {
else {
//Logging::info("sql is not set.");
$totalDisplayRows = $totalRows; $totalDisplayRows = $totalRows;
} }
//TODO //TODO
if ($needToBind) { if ($needToBind) {
$results = Application_Common_Database::prepareAndExecute($sql, $params); $results = Application_Common_Database::prepareAndExecute($sql, $params);
} } else {
else {
$stmt = $con->query($sql); $stmt = $con->query($sql);
$stmt->setFetchMode(PDO::FETCH_ASSOC); $stmt->setFetchMode(PDO::FETCH_ASSOC);
$results = $stmt->fetchAll(); $results = $stmt->fetchAll();
} }
// we need to go over all items and fix length for playlist
// in case the playlist contains dynamic block
foreach ($results as &$r) {
//this function is also called for Manage Users so in
//this case there will be no 'ftype'
if (isset($r['ftype'])) {
if ($r['ftype'] == 'playlist') {
$pl = new Application_Model_Playlist($r['id']);
$r['length'] = $pl->getLength();
} elseif ($r['ftype'] == "block") {
$bl = new Application_Model_Block($r['id']);
$r['bl_type'] = $bl->isStatic() ? 'static' : 'dynamic';
$r['length'] = $bl->getLength();
}
}
}
} catch (Exception $e) {
Logging::debug($e->getMessage());
} }
catch (Exception $e) {
Logging::info($e->getMessage());
}
return array( return array(
"sEcho" => intval($data["sEcho"]), "sEcho" => intval($data["sEcho"]),
"iTotalDisplayRecords" => intval($totalDisplayRows), "iTotalDisplayRecords" => intval($totalDisplayRows),

View file

@ -4,7 +4,7 @@ class Application_Model_ListenerStat
public function __construct() public function __construct()
{ {
} }
public static function getDataPointsWithinRange($p_start, $p_end) { public static function getDataPointsWithinRange($p_start, $p_end) {
$sql = <<<SQL $sql = <<<SQL
SELECT mount_name, count(*) SELECT mount_name, count(*)
@ -16,13 +16,13 @@ group by mount_name
SQL; SQL;
$data = Application_Common_Database::prepareAndExecute($sql, $data = Application_Common_Database::prepareAndExecute($sql,
array('p1'=>$p_start, 'p2'=>$p_end)); array('p1'=>$p_start, 'p2'=>$p_end));
$out = array(); $out = array();
foreach ($data as $d) { foreach ($data as $d) {
$jump = intval($d['count']/1000); $jump = intval($d['count']/1000);
$jump = max(1, $jump); $jump = max(1, $jump);
$remainder = $jump == 1?0:1; $remainder = $jump == 1?0:1;
$sql = <<<SQL $sql = <<<SQL
SELECT * SELECT *
FROM FROM
@ -41,36 +41,29 @@ SQL;
$t->setTimezone(new DateTimeZone(date_default_timezone_get())); $t->setTimezone(new DateTimeZone(date_default_timezone_get()));
// tricking javascript so it thinks the server timezone is in UTC // tricking javascript so it thinks the server timezone is in UTC
$dt = new DateTime($t->format("Y-m-d H:i:s"), new DateTimeZone("UTC")); $dt = new DateTime($t->format("Y-m-d H:i:s"), new DateTimeZone("UTC"));
$r['timestamp'] = $dt->format("U"); $r['timestamp'] = $dt->format("U");
$out[$r['mount_name']][] = $r; $out[$r['mount_name']][] = $r;
} }
} }
$enabledStreamIds = Application_Model_StreamSetting::getEnabledStreamIds(); $enabledStreamIds = Application_Model_StreamSetting::getEnabledStreamIds();
$enabledOut = array(); $enabledOut = array();
foreach ($enabledStreamIds as $sId) { foreach ($enabledStreamIds as $sId) {
$sql = "SELECT value FROM cc_stream_setting" $sql = "SELECT value FROM cc_stream_setting"
." WHERE keyname = :key"; ." WHERE keyname = :key";
$result = Application_Common_Database::prepareAndExecute($sql, array('key' => $sId."_mount"), "single"); $result = Application_Common_Database::prepareAndExecute($sql, array('key' => $sId."_mount"), "single");
$enabledMountPoint = $result["value"]; $enabledMountPoint = $result["value"];
if (isset($out[$enabledMountPoint])) { if (isset($out[$enabledMountPoint])) {
$enabledOut[$enabledMountPoint] = $out[$enabledMountPoint]; $enabledOut[$enabledMountPoint] = $out[$enabledMountPoint];
} }
else {
//TODO fix this hack (here for CC-5254)
//all shoutcast streams are automatically put under "shoutcast" mount point.
if (isset($out["shoutcast"])) {
$enabledOut["shoutcast"] = $out["shoutcast"];
}
}
} }
return $enabledOut; return $enabledOut;
} }

View file

@ -505,12 +505,11 @@ SQL;
foreach ($p_items as $ac) { foreach ($p_items as $ac) {
$res = $this->insertPlaylistElement($this->buildEntry($ac, $pos)); $res = $this->insertPlaylistElement($this->buildEntry($ac, $pos));
// update is_playlist flag in cc_files to indicate the // update is_playlist flag in cc_files to indicate the
// file belongs to a playlist or block (in this case a playlist) // file belongs to a playlist or block (in this case a playlist)
if ($ac[1] == "audioclip") { $db_file = CcFilesQuery::create()->findPk($ac[0], $this->con);
$db_file = CcFilesQuery::create()->findPk($ac[0], $this->con); $db_file->setDbIsPlaylist(true)->save($this->con);
$db_file->setDbIsPlaylist(true)->save($this->con);
}
$pos = $pos + 1; $pos = $pos + 1;
} }

View file

@ -0,0 +1,83 @@
<?php
require_once 'formatters/LengthFormatter.php';
class Application_Model_PlayoutHistory
{
private $con;
private $timezone;
//in UTC timezone
private $startDT;
//in UTC timezone
private $endDT;
private $epoch_now;
private $opts;
private $mDataPropMap = array(
"artist" => "artist_name",
"title" => "track_title",
"played" => "played",
"length" => "length",
"composer" => "composer",
"copyright" => "copyright",
);
public function __construct($p_startDT, $p_endDT, $p_opts)
{
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
$this->startDT = $p_startDT;
$this->endDT = $p_endDT;
$this->timezone = date_default_timezone_get();
$this->epoch_now = time();
$this->opts = $p_opts;
}
/*
* map front end mDataProp labels to proper column names for searching etc.
*/
private function translateColumns()
{
for ($i = 0; $i < $this->opts["iColumns"]; $i++) {
$this->opts["mDataProp_{$i}"] = $this->mDataPropMap[$this->opts["mDataProp_{$i}"]];
}
}
public function getItems()
{
$this->translateColumns();
$select = array(
"file.track_title as title",
"file.artist_name as artist",
"playout.played",
"playout.file_id",
"file.composer",
"file.copyright",
"file.length"
);
$start = $this->startDT->format("Y-m-d H:i:s");
$end = $this->endDT->format("Y-m-d H:i:s");
$historyTable = "(
select count(schedule.file_id) as played, schedule.file_id as file_id
from cc_schedule as schedule
where schedule.starts >= '{$start}' and schedule.starts < '{$end}'
and schedule.playout_status > 0 and schedule.media_item_played != FALSE and schedule.broadcasted = 1
group by schedule.file_id
)
AS playout left join cc_files as file on (file.id = playout.file_id)";
$results = Application_Model_Datatables::findEntries($this->con, $select, $historyTable, $this->opts, "history");
foreach ($results["history"] as &$row) {
$formatter = new LengthFormatter($row['length']);
$row['length'] = $formatter->format();
}
return $results;
}
}

View file

@ -1369,20 +1369,4 @@ class Application_Model_Preference
{ {
self::setValue("replay_gain_modifier", $rg_modifier, true); self::setValue("replay_gain_modifier", $rg_modifier, true);
} }
public static function SetHistoryItemTemplate($value) {
self::setValue("history_item_template", $value);
}
public static function GetHistoryItemTemplate() {
return self::getValue("history_item_template");
}
public static function SetHistoryFileTemplate($value) {
self::setValue("history_file_template", $value);
}
public static function GetHistoryFileTemplate() {
return self::getValue("history_file_template");
}
} }

View file

@ -17,7 +17,7 @@ class Application_Model_Scheduler
private $epochNow; private $epochNow;
private $nowDT; private $nowDT;
private $user; private $user;
private $crossfadeDuration; private $crossfadeDuration;
private $checkUserPermissions = true; private $checkUserPermissions = true;
@ -40,7 +40,7 @@ class Application_Model_Scheduler
} }
$this->user = Application_Model_User::getCurrentUser(); $this->user = Application_Model_User::getCurrentUser();
$this->crossfadeDuration = Application_Model_Preference::GetDefaultCrossfadeDuration(); $this->crossfadeDuration = Application_Model_Preference::GetDefaultCrossfadeDuration();
} }
@ -200,12 +200,9 @@ class Application_Model_Scheduler
} else { } else {
$data = $this->fileInfo; $data = $this->fileInfo;
$data["id"] = $id; $data["id"] = $id;
$data["cliplength"] = Application_Model_StoredFile::getRealClipLength(
$cuein = Application_Common_DateHelper::playlistTimeToSeconds($file->getDbCuein()); $file->getDbCuein(),
$cueout = Application_Common_DateHelper::playlistTimeToSeconds($file->getDbCueout()); $file->getDbCueout());
$row_length = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein);
$data["cliplength"] = $row_length;
$data["cuein"] = $file->getDbCuein(); $data["cuein"] = $file->getDbCuein();
$data["cueout"] = $file->getDbCueout(); $data["cueout"] = $file->getDbCueout();
@ -268,11 +265,11 @@ class Application_Model_Scheduler
$cuein = Application_Common_DateHelper::calculateLengthInSeconds($data["cuein"]); $cuein = Application_Common_DateHelper::calculateLengthInSeconds($data["cuein"]);
$cueout = Application_Common_DateHelper::calculateLengthInSeconds($data["cueout"]); $cueout = Application_Common_DateHelper::calculateLengthInSeconds($data["cueout"]);
$data["cliplength"] = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein); $data["cliplength"] = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein);
//fade is in format SS.uuuuuu //fade is in format SS.uuuuuu
$data["fadein"] = $defaultFadeIn; $data["fadein"] = $defaultFadeIn;
$data["fadeout"] = $defaultFadeOut; $data["fadeout"] = $defaultFadeOut;
$data["type"] = 0; $data["type"] = 0;
$files[] = $data; $files[] = $data;
} }
@ -327,11 +324,11 @@ class Application_Model_Scheduler
$cuein = Application_Common_DateHelper::calculateLengthInSeconds($data["cuein"]); $cuein = Application_Common_DateHelper::calculateLengthInSeconds($data["cuein"]);
$cueout = Application_Common_DateHelper::calculateLengthInSeconds($data["cueout"]); $cueout = Application_Common_DateHelper::calculateLengthInSeconds($data["cueout"]);
$data["cliplength"] = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein); $data["cliplength"] = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein);
//fade is in format SS.uuuuuu //fade is in format SS.uuuuuu
$data["fadein"] = $defaultFadeIn; $data["fadein"] = $defaultFadeIn;
$data["fadeout"] = $defaultFadeOut; $data["fadeout"] = $defaultFadeOut;
$data["type"] = 0; $data["type"] = 0;
$files[] = $data; $files[] = $data;
} }
@ -341,7 +338,7 @@ class Application_Model_Scheduler
return $files; return $files;
} }
/* /*
* @param DateTime startDT in UTC * @param DateTime startDT in UTC
* @param string duration * @param string duration
@ -352,18 +349,18 @@ class Application_Model_Scheduler
private function findTimeDifference($p_startDT, $p_seconds) private function findTimeDifference($p_startDT, $p_seconds)
{ {
$startEpoch = $p_startDT->format("U.u"); $startEpoch = $p_startDT->format("U.u");
//add two float numbers to 6 subsecond precision //add two float numbers to 6 subsecond precision
//DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number. //DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number.
$newEpoch = bcsub($startEpoch , (string) $p_seconds, 6); $newEpoch = bcsub($startEpoch , (string) $p_seconds, 6);
$dt = DateTime::createFromFormat("U.u", $newEpoch, new DateTimeZone("UTC")); $dt = DateTime::createFromFormat("U.u", $newEpoch, new DateTimeZone("UTC"));
if ($dt === false) { if ($dt === false) {
//PHP 5.3.2 problem //PHP 5.3.2 problem
$dt = DateTime::createFromFormat("U", intval($newEpoch), new DateTimeZone("UTC")); $dt = DateTime::createFromFormat("U", intval($newEpoch), new DateTimeZone("UTC"));
} }
return $dt; return $dt;
} }
@ -423,7 +420,7 @@ class Application_Model_Scheduler
return $nextDT; return $nextDT;
} }
/* /*
* @param int $showInstance * @param int $showInstance
* This function recalculates the start/end times of items in a gapless show to * This function recalculates the start/end times of items in a gapless show to
@ -502,7 +499,7 @@ class Application_Model_Scheduler
} }
/** /**
* *
* Enter description here ... * Enter description here ...
* @param $scheduleItems * @param $scheduleItems
* cc_schedule items, where the items get inserted after * cc_schedule items, where the items get inserted after
@ -885,7 +882,7 @@ class Application_Model_Scheduler
private function updateMovedItem() private function updateMovedItem()
{ {
} }
private function getInstances($instanceId) private function getInstances($instanceId)
@ -1105,7 +1102,7 @@ class Application_Model_Scheduler
} else { } else {
$removedItem->delete($this->con); $removedItem->delete($this->con);
} }
// update is_scheduled in cc_files but only if // update is_scheduled in cc_files but only if
// the file is not scheduled somewhere else // the file is not scheduled somewhere else
$fileId = $removedItem->getDbFileId(); $fileId = $removedItem->getDbFileId();

View file

@ -949,7 +949,6 @@ SQL;
AND ((si1.starts >= :start1::TIMESTAMP AND si1.starts < :end1::TIMESTAMP) AND ((si1.starts >= :start1::TIMESTAMP AND si1.starts < :end1::TIMESTAMP)
OR (si1.ends > :start2::TIMESTAMP AND si1.ends <= :end2::TIMESTAMP) OR (si1.ends > :start2::TIMESTAMP AND si1.ends <= :end2::TIMESTAMP)
OR (si1.starts <= :start3::TIMESTAMP AND si1.ends >= :end3::TIMESTAMP)) OR (si1.starts <= :start3::TIMESTAMP AND si1.ends >= :end3::TIMESTAMP))
ORDER BY si1.starts
SQL; SQL;
return Application_Common_Database::prepareAndExecute( $sql, return Application_Common_Database::prepareAndExecute( $sql,
array( array(

View file

@ -778,30 +778,17 @@ SQL;
foreach ($results['aaData'] as &$row) { foreach ($results['aaData'] as &$row) {
$row['id'] = intval($row['id']); $row['id'] = intval($row['id']);
//taken from Datatables.php, needs to be cleaned up there. $len_formatter = new LengthFormatter(
if (isset($r['ftype'])) { self::getRealClipLength($row["cuein"], $row["cueout"]));
if ($r['ftype'] == 'playlist') { $row['length'] = $len_formatter->format();
$pl = new Application_Model_Playlist($r['id']);
$r['length'] = $pl->getLength(); $cuein_formatter = new LengthFormatter($row["cuein"]);
} elseif ($r['ftype'] == "block") { $row["cuein"] = $cuein_formatter->format();
$bl = new Application_Model_Block($r['id']);
$r['bl_type'] = $bl->isStatic() ? 'static' : 'dynamic'; $cueout_formatter = new LengthFormatter($row["cueout"]);
$r['length'] = $bl->getLength(); $row["cueout"] = $cueout_formatter->format();
}
}
if ($row['ftype'] === "audioclip") { if ($row['ftype'] === "audioclip") {
$cuein_formatter = new LengthFormatter($row["cuein"]);
$row["cuein"] = $cuein_formatter->format();
$cueout_formatter = new LengthFormatter($row["cueout"]);
$row["cueout"] = $cueout_formatter->format();
$cuein = Application_Common_DateHelper::playlistTimeToSeconds($row["cuein"]);
$cueout = Application_Common_DateHelper::playlistTimeToSeconds($row["cueout"]);
$row_length = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein);
$formatter = new SamplerateFormatter($row['sample_rate']); $formatter = new SamplerateFormatter($row['sample_rate']);
$row['sample_rate'] = $formatter->format(); $row['sample_rate'] = $formatter->format();
@ -814,17 +801,10 @@ SQL;
// for audio preview // for audio preview
$row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION); $row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
} else {
}
else {
$row['audioFile'] = $row['id']; $row['audioFile'] = $row['id'];
$row_length = $row['length'];
} }
$len_formatter = new LengthFormatter($row_length);
$row['length'] = $len_formatter->format();
//convert mtime and utime to localtime //convert mtime and utime to localtime
$row['mtime'] = new DateTime($row['mtime'], new DateTimeZone('UTC')); $row['mtime'] = new DateTime($row['mtime'], new DateTimeZone('UTC'));
$row['mtime']->setTimeZone(new DateTimeZone(date_default_timezone_get())); $row['mtime']->setTimeZone(new DateTimeZone(date_default_timezone_get()));
@ -1367,6 +1347,14 @@ SQL;
Application_Common_Database::prepareAndExecute($sql, array(), Application_Common_Database::prepareAndExecute($sql, array(),
Application_Common_Database::EXECUTE); Application_Common_Database::EXECUTE);
} }
public static function getRealClipLength($p_cuein, $p_cueout) {
$sql = "SELECT :cueout::INTERVAL - :cuein::INTERVAL";
return Application_Common_Database::prepareAndExecute($sql, array(
':cueout' => $p_cueout,
':cuein' => $p_cuein), 'column');
}
} }
class DeleteScheduledFileException extends Exception {} class DeleteScheduledFileException extends Exception {}

View file

@ -1,5 +1,10 @@
<?php <?php
define('UTYPE_HOST' , 'H');
define('UTYPE_ADMIN' , 'A');
define('UTYPE_GUEST' , 'G');
define('UTYPE_PROGRAM_MANAGER' , 'P');
class Application_Model_User class Application_Model_User
{ {
private $_userInstance; private $_userInstance;

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_file_tag' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcFileTag extends BaseCcFileTag {
} // CcFileTag

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_file_tag' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcFileTagPeer extends BaseCcFileTagPeer {
} // CcFileTagPeer

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_file_tag' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcFileTagQuery extends BaseCcFileTagQuery {
} // CcFileTagQuery

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_mount_name' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcMountName extends BaseCcMountName {
} // CcMountName

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_mount_name' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcMountNamePeer extends BaseCcMountNamePeer {
} // CcMountNamePeer

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_mount_name' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcMountNameQuery extends BaseCcMountNameQuery {
} // CcMountNameQuery

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_playout_history' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlayoutHistory extends BaseCcPlayoutHistory {
} // CcPlayoutHistory

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_playout_history_metadata' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlayoutHistoryMetaData extends BaseCcPlayoutHistoryMetaData {
} // CcPlayoutHistoryMetaData

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playout_history_metadata' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlayoutHistoryMetaDataPeer extends BaseCcPlayoutHistoryMetaDataPeer {
} // CcPlayoutHistoryMetaDataPeer

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playout_history_metadata' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlayoutHistoryMetaDataQuery extends BaseCcPlayoutHistoryMetaDataQuery {
} // CcPlayoutHistoryMetaDataQuery

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playout_history' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlayoutHistoryPeer extends BaseCcPlayoutHistoryPeer {
} // CcPlayoutHistoryPeer

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playout_history' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlayoutHistoryQuery extends BaseCcPlayoutHistoryQuery {
} // CcPlayoutHistoryQuery

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_playout_history_template' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlayoutHistoryTemplate extends BaseCcPlayoutHistoryTemplate {
} // CcPlayoutHistoryTemplate

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_playout_history_template_field' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlayoutHistoryTemplateField extends BaseCcPlayoutHistoryTemplateField {
} // CcPlayoutHistoryTemplateField

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playout_history_template_field' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlayoutHistoryTemplateFieldPeer extends BaseCcPlayoutHistoryTemplateFieldPeer {
} // CcPlayoutHistoryTemplateFieldPeer

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playout_history_template_field' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlayoutHistoryTemplateFieldQuery extends BaseCcPlayoutHistoryTemplateFieldQuery {
} // CcPlayoutHistoryTemplateFieldQuery

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playout_history_template' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlayoutHistoryTemplatePeer extends BaseCcPlayoutHistoryTemplatePeer {
} // CcPlayoutHistoryTemplatePeer

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_playout_history_template' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcPlayoutHistoryTemplateQuery extends BaseCcPlayoutHistoryTemplateQuery {
} // CcPlayoutHistoryTemplateQuery

View file

@ -1,9 +1,11 @@
<?php <?php
/** /**
* Skeleton subclass for representing a row from the 'cc_subjs' table. * Skeleton subclass for representing a row from the 'cc_subjs' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
@ -25,15 +27,4 @@ class CcSubjs extends BaseCcSubjs {
->filterByDbHost($this->getDbId()) ->filterByDbHost($this->getDbId())
->count() > 0; ->count() > 0;
} }
public function isHostOfShowInstance($instanceId)
{
$showInstance = CcShowInstancesQuery::create()
->findPk($instanceId);
return CcShowHostsQuery::create()
->filterByDbShow($showInstance->getDbShowId())
->filterByDbHost($this->getDbId())
->count() > 0;
}
} // CcSubjs } // CcSubjs

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_tag' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcTag extends BaseCcTag {
} // CcTag

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_tag' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcTagPeer extends BaseCcTagPeer {
} // CcTagPeer

View file

@ -1,18 +0,0 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_tag' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcTagQuery extends BaseCcTagQuery {
} // CcTagQuery

View file

@ -1,56 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_file_tag' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcFileTagTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcFileTagTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_file_tag');
$this->setPhpName('CcFileTag');
$this->setClassname('CcFileTag');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_file_tag_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', true, null, null);
$this->addForeignKey('TAG_ID', 'DbTagId', 'INTEGER', 'cc_tag', 'ID', true, null, null);
// 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('CcTag', 'CcTag', RelationMap::MANY_TO_ONE, array('tag_id' => 'id', ), 'CASCADE', null);
} // buildRelations()
} // CcFileTagTableMap

View file

@ -123,7 +123,6 @@ class CcFilesTableMap extends TableMap {
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', 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('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null); $this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
$this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
} // buildRelations() } // buildRelations()
} // CcFilesTableMap } // CcFilesTableMap

View file

@ -51,7 +51,7 @@ class CcListenerCountTableMap extends TableMap {
public function buildRelations() public function buildRelations()
{ {
$this->addRelation('CcTimestamp', 'CcTimestamp', RelationMap::MANY_TO_ONE, array('timestamp_id' => 'id', ), 'CASCADE', null); $this->addRelation('CcTimestamp', 'CcTimestamp', RelationMap::MANY_TO_ONE, array('timestamp_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcMountName', 'CcMountName', RelationMap::MANY_TO_ONE, array('mount_name_id' => 'id', ), 'CASCADE', null); $this->addRelation('CcTimestamp', 'CcTimestamp', RelationMap::MANY_TO_ONE, array('mount_name_id' => 'id', ), 'CASCADE', null);
} // buildRelations() } // buildRelations()
} // CcListenerCountTableMap } // CcListenerCountTableMap

View file

@ -1,54 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_mount_name' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcMountNameTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcMountNameTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_mount_name');
$this->setPhpName('CcMountName');
$this->setClassname('CcMountName');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_mount_name_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('MOUNT_NAME', 'DbMountName', 'VARCHAR', true, 255, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcListenerCount', 'CcListenerCount', RelationMap::ONE_TO_MANY, array('id' => 'mount_name_id', ), 'CASCADE', null);
} // buildRelations()
} // CcMountNameTableMap

View file

@ -1,56 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_playout_history_metadata' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcPlayoutHistoryMetaDataTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcPlayoutHistoryMetaDataTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_playout_history_metadata');
$this->setPhpName('CcPlayoutHistoryMetaData');
$this->setClassname('CcPlayoutHistoryMetaData');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_playout_history_metadata_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('HISTORY_ID', 'DbHistoryId', 'INTEGER', 'cc_playout_history', 'ID', true, null, null);
$this->addColumn('KEY', 'DbKey', 'VARCHAR', true, 128, null);
$this->addColumn('VALUE', 'DbValue', 'VARCHAR', true, 128, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::MANY_TO_ONE, array('history_id' => 'id', ), 'CASCADE', null);
} // buildRelations()
} // CcPlayoutHistoryMetaDataTableMap

View file

@ -1,59 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_playout_history' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcPlayoutHistoryTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcPlayoutHistoryTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_playout_history');
$this->setPhpName('CcPlayoutHistory');
$this->setClassname('CcPlayoutHistory');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_playout_history_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
$this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
$this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', false, null, null);
// 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('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'SET NULL', null);
$this->addRelation('CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaData', RelationMap::ONE_TO_MANY, array('id' => 'history_id', ), 'CASCADE', null);
} // buildRelations()
} // CcPlayoutHistoryTableMap

View file

@ -1,59 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_playout_history_template_field' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcPlayoutHistoryTemplateFieldTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcPlayoutHistoryTemplateFieldTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_playout_history_template_field');
$this->setPhpName('CcPlayoutHistoryTemplateField');
$this->setClassname('CcPlayoutHistoryTemplateField');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_playout_history_template_field_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('TEMPLATE_ID', 'DbTemplateId', 'INTEGER', 'cc_playout_history_template', 'ID', true, null, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 128, null);
$this->addColumn('LABEL', 'DbLabel', 'VARCHAR', true, 128, null);
$this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 128, null);
$this->addColumn('IS_FILE_MD', 'DbIsFileMD', 'BOOLEAN', true, null, false);
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', true, null, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcPlayoutHistoryTemplate', 'CcPlayoutHistoryTemplate', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), 'CASCADE', null);
} // buildRelations()
} // CcPlayoutHistoryTemplateFieldTableMap

View file

@ -1,55 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_playout_history_template' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcPlayoutHistoryTemplateTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcPlayoutHistoryTemplateTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_playout_history_template');
$this->setPhpName('CcPlayoutHistoryTemplate');
$this->setClassname('CcPlayoutHistoryTemplate');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_playout_history_template_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 128, null);
$this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 35, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcPlayoutHistoryTemplateField', 'CcPlayoutHistoryTemplateField', RelationMap::ONE_TO_MANY, array('id' => 'template_id', ), 'CASCADE', null);
} // buildRelations()
} // CcPlayoutHistoryTemplateTableMap

View file

@ -1,58 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_playout_history_template_field' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcPlayoutHistoryTemplateTagTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcPlayoutHistoryTemplateTagTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_playout_history_template_field');
$this->setPhpName('CcPlayoutHistoryTemplateTag');
$this->setClassname('CcPlayoutHistoryTemplateTag');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_playout_history_template_field_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('TEMPLATE_ID', 'DbTemplateId', 'INTEGER', 'cc_playout_history_template', 'ID', true, null, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 128, null);
$this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 128, null);
$this->addColumn('IS_FILE_MD', 'DbIsFileMD', 'BOOLEAN', true, null, false);
$this->addColumn('POSITION', 'DbTagPosition', 'INTEGER', true, null, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcPlayoutHistoryTemplate', 'CcPlayoutHistoryTemplate', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), 'CASCADE', null);
} // buildRelations()
} // CcPlayoutHistoryTemplateTagTableMap

View file

@ -63,7 +63,6 @@ class CcShowInstancesTableMap extends TableMap {
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null); $this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcShowInstancesRelatedByDbId', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null); $this->addRelation('CcShowInstancesRelatedByDbId', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null);
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null); $this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null);
$this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'SET NULL', null);
} // buildRelations() } // buildRelations()
} // CcShowInstancesTableMap } // CcShowInstancesTableMap

View file

@ -1,57 +0,0 @@
<?php
/**
* This class defines the structure of the 'cc_tag' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.airtime.map
*/
class CcTagTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CcTagTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_tag');
$this->setPhpName('CcTag');
$this->setClassname('CcTag');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_tag_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('TAG_NAME', 'DbTagName', 'VARCHAR', true, 128, null);
$this->addColumn('TAG_TYPE', 'DbTagType', 'VARCHAR', true, 128, 'boolean');
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcFileTag', 'CcFileTag', RelationMap::ONE_TO_MANY, array('id' => 'tag_id', ), 'CASCADE', null);
$this->addRelation('CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaData', RelationMap::ONE_TO_MANY, array('id' => 'tag_id', ), 'CASCADE', null);
$this->addRelation('CcPlayoutHistoryTemplateTag', 'CcPlayoutHistoryTemplateTag', RelationMap::ONE_TO_MANY, array('id' => 'tag_id', ), 'CASCADE', null);
} // buildRelations()
} // CcTagTableMap

View file

@ -1,936 +0,0 @@
<?php
/**
* Base class that represents a row from the 'cc_file_tag' table.
*
*
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcFileTag extends BaseObject implements Persistent
{
/**
* Peer class name
*/
const PEER = 'CcFileTagPeer';
/**
* The Peer class.
* Instance provides a convenient way of calling static methods on a class
* that calling code may not be able to identify.
* @var CcFileTagPeer
*/
protected static $peer;
/**
* The value for the id field.
* @var int
*/
protected $id;
/**
* The value for the file_id field.
* @var int
*/
protected $file_id;
/**
* The value for the tag_id field.
* @var int
*/
protected $tag_id;
/**
* @var CcFiles
*/
protected $aCcFiles;
/**
* @var CcTag
*/
protected $aCcTag;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInSave = false;
/**
* Flag to prevent endless validation loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInValidation = false;
/**
* Get the [id] column value.
*
* @return int
*/
public function getDbId()
{
return $this->id;
}
/**
* Get the [file_id] column value.
*
* @return int
*/
public function getDbFileId()
{
return $this->file_id;
}
/**
* Get the [tag_id] column value.
*
* @return int
*/
public function getDbTagId()
{
return $this->tag_id;
}
/**
* Set the value of [id] column.
*
* @param int $v new value
* @return CcFileTag 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[] = CcFileTagPeer::ID;
}
return $this;
} // setDbId()
/**
* Set the value of [file_id] column.
*
* @param int $v new value
* @return CcFileTag 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[] = CcFileTagPeer::FILE_ID;
}
if ($this->aCcFiles !== null && $this->aCcFiles->getDbId() !== $v) {
$this->aCcFiles = null;
}
return $this;
} // setDbFileId()
/**
* Set the value of [tag_id] column.
*
* @param int $v new value
* @return CcFileTag The current object (for fluent API support)
*/
public function setDbTagId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->tag_id !== $v) {
$this->tag_id = $v;
$this->modifiedColumns[] = CcFileTagPeer::TAG_ID;
}
if ($this->aCcTag !== null && $this->aCcTag->getDbId() !== $v) {
$this->aCcTag = null;
}
return $this;
} // setDbTagId()
/**
* 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->file_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
$this->tag_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
$this->resetModified();
$this->setNew(false);
if ($rehydrate) {
$this->ensureConsistency();
}
return $startcol + 3; // 3 = CcFileTagPeer::NUM_COLUMNS - CcFileTagPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcFileTag 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->aCcFiles !== null && $this->file_id !== $this->aCcFiles->getDbId()) {
$this->aCcFiles = null;
}
if ($this->aCcTag !== null && $this->tag_id !== $this->aCcTag->getDbId()) {
$this->aCcTag = 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(CcFileTagPeer::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 = CcFileTagPeer::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->aCcTag = 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(CcFileTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$con->beginTransaction();
try {
$ret = $this->preDelete($con);
if ($ret) {
CcFileTagQuery::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(CcFileTagPeer::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);
CcFileTagPeer::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->aCcTag !== null) {
if ($this->aCcTag->isModified() || $this->aCcTag->isNew()) {
$affectedRows += $this->aCcTag->save($con);
}
$this->setCcTag($this->aCcTag);
}
if ($this->isNew() ) {
$this->modifiedColumns[] = CcFileTagPeer::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(CcFileTagPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcFileTagPeer::ID.')');
}
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows += 1;
$this->setDbId($pk); //[IMV] update autoincrement primary key
$this->setNew(false);
} else {
$affectedRows += CcFileTagPeer::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 <code>true</code> is returned; otherwise
* an aggreagated array of ValidationFailed objects will be returned.
*
* @param array $columns Array of column names to validate.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> 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->aCcTag !== null) {
if (!$this->aCcTag->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aCcTag->getValidationFailures());
}
}
if (($retval = CcFileTagPeer::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 = CcFileTagPeer::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->getDbFileId();
break;
case 2:
return $this->getDbTagId();
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 = CcFileTagPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getDbId(),
$keys[1] => $this->getDbFileId(),
$keys[2] => $this->getDbTagId(),
);
if ($includeForeignObjects) {
if (null !== $this->aCcFiles) {
$result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true);
}
if (null !== $this->aCcTag) {
$result['CcTag'] = $this->aCcTag->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 = CcFileTagPeer::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->setDbFileId($value);
break;
case 2:
$this->setDbTagId($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 = CcFileTagPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setDbFileId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDbTagId($arr[$keys[2]]);
}
/**
* 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(CcFileTagPeer::DATABASE_NAME);
if ($this->isColumnModified(CcFileTagPeer::ID)) $criteria->add(CcFileTagPeer::ID, $this->id);
if ($this->isColumnModified(CcFileTagPeer::FILE_ID)) $criteria->add(CcFileTagPeer::FILE_ID, $this->file_id);
if ($this->isColumnModified(CcFileTagPeer::TAG_ID)) $criteria->add(CcFileTagPeer::TAG_ID, $this->tag_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(CcFileTagPeer::DATABASE_NAME);
$criteria->add(CcFileTagPeer::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 CcFileTag (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->setDbFileId($this->file_id);
$copyObj->setDbTagId($this->tag_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 CcFileTag 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 CcFileTagPeer
*/
public function getPeer()
{
if (self::$peer === null) {
self::$peer = new CcFileTagPeer();
}
return self::$peer;
}
/**
* Declares an association between this object and a CcFiles object.
*
* @param CcFiles $v
* @return CcFileTag 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->addCcFileTag($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->addCcFileTags($this);
*/
}
return $this->aCcFiles;
}
/**
* Declares an association between this object and a CcTag object.
*
* @param CcTag $v
* @return CcFileTag The current object (for fluent API support)
* @throws PropelException
*/
public function setCcTag(CcTag $v = null)
{
if ($v === null) {
$this->setDbTagId(NULL);
} else {
$this->setDbTagId($v->getDbId());
}
$this->aCcTag = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the CcTag object, it will not be re-added.
if ($v !== null) {
$v->addCcFileTag($this);
}
return $this;
}
/**
* Get the associated CcTag object
*
* @param PropelPDO Optional Connection object.
* @return CcTag The associated CcTag object.
* @throws PropelException
*/
public function getCcTag(PropelPDO $con = null)
{
if ($this->aCcTag === null && ($this->tag_id !== null)) {
$this->aCcTag = CcTagQuery::create()->findPk($this->tag_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->aCcTag->addCcFileTags($this);
*/
}
return $this->aCcTag;
}
/**
* Clears the current object and sets all attributes to their default values
*/
public function clear()
{
$this->id = null;
$this->file_id = null;
$this->tag_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->aCcFiles = null;
$this->aCcTag = 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);
}
} // BaseCcFileTag

File diff suppressed because it is too large Load diff

View file

@ -1,371 +0,0 @@
<?php
/**
* Base class that represents a query for the 'cc_file_tag' table.
*
*
*
* @method CcFileTagQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcFileTagQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
* @method CcFileTagQuery orderByDbTagId($order = Criteria::ASC) Order by the tag_id column
*
* @method CcFileTagQuery groupByDbId() Group by the id column
* @method CcFileTagQuery groupByDbFileId() Group by the file_id column
* @method CcFileTagQuery groupByDbTagId() Group by the tag_id column
*
* @method CcFileTagQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcFileTagQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcFileTagQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcFileTagQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation
* @method CcFileTagQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
* @method CcFileTagQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
*
* @method CcFileTagQuery leftJoinCcTag($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcTag relation
* @method CcFileTagQuery rightJoinCcTag($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcTag relation
* @method CcFileTagQuery innerJoinCcTag($relationAlias = '') Adds a INNER JOIN clause to the query using the CcTag relation
*
* @method CcFileTag findOne(PropelPDO $con = null) Return the first CcFileTag matching the query
* @method CcFileTag findOneOrCreate(PropelPDO $con = null) Return the first CcFileTag matching the query, or a new CcFileTag object populated from the query conditions when no match is found
*
* @method CcFileTag findOneByDbId(int $id) Return the first CcFileTag filtered by the id column
* @method CcFileTag findOneByDbFileId(int $file_id) Return the first CcFileTag filtered by the file_id column
* @method CcFileTag findOneByDbTagId(int $tag_id) Return the first CcFileTag filtered by the tag_id column
*
* @method array findByDbId(int $id) Return CcFileTag objects filtered by the id column
* @method array findByDbFileId(int $file_id) Return CcFileTag objects filtered by the file_id column
* @method array findByDbTagId(int $tag_id) Return CcFileTag objects filtered by the tag_id column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcFileTagQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcFileTagQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'airtime', $modelName = 'CcFileTag', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CcFileTagQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return CcFileTagQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CcFileTagQuery) {
return $criteria;
}
$query = new CcFileTagQuery();
if (null !== $modelAlias) {
$query->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
* <code>
* $obj = $c->findPk(12, $con);
* </code>
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con an optional connection object
*
* @return CcFileTag|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcFileTagPeer::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
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @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 CcFileTagQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcFileTagPeer::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 CcFileTagQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcFileTagPeer::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 CcFileTagQuery 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(CcFileTagPeer::ID, $dbId, $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 CcFileTagQuery 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(CcFileTagPeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbFileId['max'])) {
$this->addUsingAlias(CcFileTagPeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcFileTagPeer::FILE_ID, $dbFileId, $comparison);
}
/**
* Filter the query on the tag_id column
*
* @param int|array $dbTagId 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 CcFileTagQuery The current query, for fluid interface
*/
public function filterByDbTagId($dbTagId = null, $comparison = null)
{
if (is_array($dbTagId)) {
$useMinMax = false;
if (isset($dbTagId['min'])) {
$this->addUsingAlias(CcFileTagPeer::TAG_ID, $dbTagId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbTagId['max'])) {
$this->addUsingAlias(CcFileTagPeer::TAG_ID, $dbTagId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcFileTagPeer::TAG_ID, $dbTagId, $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 CcFileTagQuery The current query, for fluid interface
*/
public function filterByCcFiles($ccFiles, $comparison = null)
{
return $this
->addUsingAlias(CcFileTagPeer::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 CcFileTagQuery The current query, for fluid interface
*/
public function joinCcFiles($relationAlias = '', $joinType = Criteria::INNER_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::INNER_JOIN)
{
return $this
->joinCcFiles($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
}
/**
* Filter the query by a related CcTag object
*
* @param CcTag $ccTag the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcFileTagQuery The current query, for fluid interface
*/
public function filterByCcTag($ccTag, $comparison = null)
{
return $this
->addUsingAlias(CcFileTagPeer::TAG_ID, $ccTag->getDbId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcTag relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcFileTagQuery The current query, for fluid interface
*/
public function joinCcTag($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcTag');
// 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, 'CcTag');
}
return $this;
}
/**
* Use the CcTag relation CcTag 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 CcTagQuery A secondary query class using the current class as primary query
*/
public function useCcTagQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcTag($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcTag', 'CcTagQuery');
}
/**
* Exclude object from result
*
* @param CcFileTag $ccFileTag Object to remove from the list of results
*
* @return CcFileTagQuery The current query, for fluid interface
*/
public function prune($ccFileTag = null)
{
if ($ccFileTag) {
$this->addUsingAlias(CcFileTagPeer::ID, $ccFileTag->getDbId(), Criteria::NOT_EQUAL);
}
return $this;
}
} // BaseCcFileTagQuery

View file

@ -493,11 +493,6 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
*/ */
protected $collCcSchedules; protected $collCcSchedules;
/**
* @var array CcPlayoutHistory[] Collection to store aggregation of CcPlayoutHistory objects.
*/
protected $collCcPlayoutHistorys;
/** /**
* Flag to prevent endless save loop, if this object is referenced * Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction. * by another object which falls in this transaction.
@ -3114,8 +3109,6 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
$this->collCcSchedules = null; $this->collCcSchedules = null;
$this->collCcPlayoutHistorys = null;
} // if (deep) } // if (deep)
} }
@ -3307,14 +3300,6 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
} }
} }
if ($this->collCcPlayoutHistorys !== null) {
foreach ($this->collCcPlayoutHistorys as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false; $this->alreadyInSave = false;
} }
@ -3442,14 +3427,6 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
} }
} }
if ($this->collCcPlayoutHistorys !== null) {
foreach ($this->collCcPlayoutHistorys as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
$this->alreadyInValidation = false; $this->alreadyInValidation = false;
} }
@ -4374,12 +4351,6 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
} }
} }
foreach ($this->getCcPlayoutHistorys() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCcPlayoutHistory($relObj->copy($deepCopy));
}
}
} // if ($deepCopy) } // if ($deepCopy)
@ -5183,140 +5154,6 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
return $this->getCcSchedules($query, $con); return $this->getCcSchedules($query, $con);
} }
/**
* Clears out the collCcPlayoutHistorys 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 addCcPlayoutHistorys()
*/
public function clearCcPlayoutHistorys()
{
$this->collCcPlayoutHistorys = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Initializes the collCcPlayoutHistorys collection.
*
* By default this just sets the collCcPlayoutHistorys collection to an empty array (like clearcollCcPlayoutHistorys());
* 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 initCcPlayoutHistorys()
{
$this->collCcPlayoutHistorys = new PropelObjectCollection();
$this->collCcPlayoutHistorys->setModel('CcPlayoutHistory');
}
/**
* Gets an array of CcPlayoutHistory 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 CcPlayoutHistory[] List of CcPlayoutHistory objects
* @throws PropelException
*/
public function getCcPlayoutHistorys($criteria = null, PropelPDO $con = null)
{
if(null === $this->collCcPlayoutHistorys || null !== $criteria) {
if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
// return empty collection
$this->initCcPlayoutHistorys();
} else {
$collCcPlayoutHistorys = CcPlayoutHistoryQuery::create(null, $criteria)
->filterByCcFiles($this)
->find($con);
if (null !== $criteria) {
return $collCcPlayoutHistorys;
}
$this->collCcPlayoutHistorys = $collCcPlayoutHistorys;
}
}
return $this->collCcPlayoutHistorys;
}
/**
* Returns the number of related CcPlayoutHistory objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
* @return int Count of related CcPlayoutHistory objects.
* @throws PropelException
*/
public function countCcPlayoutHistorys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
if(null === $this->collCcPlayoutHistorys || null !== $criteria) {
if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
return 0;
} else {
$query = CcPlayoutHistoryQuery::create(null, $criteria);
if($distinct) {
$query->distinct();
}
return $query
->filterByCcFiles($this)
->count($con);
}
} else {
return count($this->collCcPlayoutHistorys);
}
}
/**
* Method called to associate a CcPlayoutHistory object to this object
* through the CcPlayoutHistory foreign key attribute.
*
* @param CcPlayoutHistory $l CcPlayoutHistory
* @return void
* @throws PropelException
*/
public function addCcPlayoutHistory(CcPlayoutHistory $l)
{
if ($this->collCcPlayoutHistorys === null) {
$this->initCcPlayoutHistorys();
}
if (!$this->collCcPlayoutHistorys->contains($l)) { // only add it if the **same** object is not already associated
$this->collCcPlayoutHistorys[]= $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 CcPlayoutHistorys 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 CcPlayoutHistory[] List of CcPlayoutHistory objects
*/
public function getCcPlayoutHistorysJoinCcShowInstances($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = CcPlayoutHistoryQuery::create(null, $criteria);
$query->joinWith('CcShowInstances', $join_behavior);
return $this->getCcPlayoutHistorys($query, $con);
}
/** /**
* Clears the current object and sets all attributes to their default values * Clears the current object and sets all attributes to their default values
*/ */
@ -5433,18 +5270,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
} }
} }
if ($this->collCcPlayoutHistorys) {
foreach ((array) $this->collCcPlayoutHistorys as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep) } // if ($deep)
$this->collCcShowInstancess = null; $this->collCcShowInstancess = null;
$this->collCcPlaylistcontentss = null; $this->collCcPlaylistcontentss = null;
$this->collCcBlockcontentss = null; $this->collCcBlockcontentss = null;
$this->collCcSchedules = null; $this->collCcSchedules = null;
$this->collCcPlayoutHistorys = null;
$this->aFkOwner = null; $this->aFkOwner = null;
$this->aCcSubjsRelatedByDbEditedby = null; $this->aCcSubjsRelatedByDbEditedby = null;
$this->aCcMusicDirs = null; $this->aCcMusicDirs = null;

View file

@ -695,9 +695,6 @@ abstract class BaseCcFilesPeer {
// Invalidate objects in CcSchedulePeer instance pool, // Invalidate objects in CcSchedulePeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcSchedulePeer::clearInstancePool(); CcSchedulePeer::clearInstancePool();
// Invalidate objects in CcPlayoutHistoryPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcPlayoutHistoryPeer::clearInstancePool();
} }
/** /**

View file

@ -180,10 +180,6 @@
* @method CcFilesQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT 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 * @method CcFilesQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation
* *
* @method CcFilesQuery leftJoinCcPlayoutHistory($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistory relation
* @method CcFilesQuery rightJoinCcPlayoutHistory($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistory relation
* @method CcFilesQuery innerJoinCcPlayoutHistory($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistory relation
*
* @method CcFiles findOne(PropelPDO $con = null) Return the first CcFiles matching the query * @method CcFiles findOne(PropelPDO $con = null) Return the first CcFiles matching the query
* @method CcFiles findOneOrCreate(PropelPDO $con = null) Return the first CcFiles matching the query, or a new CcFiles object populated from the query conditions when no match is found * @method CcFiles findOneOrCreate(PropelPDO $con = null) Return the first CcFiles matching the query, or a new CcFiles object populated from the query conditions when no match is found
* *
@ -2539,70 +2535,6 @@ abstract class BaseCcFilesQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery'); ->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery');
} }
/**
* Filter the query by a related CcPlayoutHistory object
*
* @param CcPlayoutHistory $ccPlayoutHistory 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 filterByCcPlayoutHistory($ccPlayoutHistory, $comparison = null)
{
return $this
->addUsingAlias(CcFilesPeer::ID, $ccPlayoutHistory->getDbFileId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcPlayoutHistory 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 joinCcPlayoutHistory($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcPlayoutHistory');
// 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, 'CcPlayoutHistory');
}
return $this;
}
/**
* Use the CcPlayoutHistory relation CcPlayoutHistory 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 CcPlayoutHistoryQuery A secondary query class using the current class as primary query
*/
public function useCcPlayoutHistoryQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcPlayoutHistory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistory', 'CcPlayoutHistoryQuery');
}
/** /**
* Exclude object from result * Exclude object from result
* *

View file

@ -54,9 +54,9 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
protected $aCcTimestamp; protected $aCcTimestamp;
/** /**
* @var CcMountName * @var CcTimestamp
*/ */
protected $aCcMountName; protected $aCcTimestamp;
/** /**
* Flag to prevent endless save loop, if this object is referenced * Flag to prevent endless save loop, if this object is referenced
@ -173,8 +173,8 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$this->modifiedColumns[] = CcListenerCountPeer::MOUNT_NAME_ID; $this->modifiedColumns[] = CcListenerCountPeer::MOUNT_NAME_ID;
} }
if ($this->aCcMountName !== null && $this->aCcMountName->getDbId() !== $v) { if ($this->aCcTimestamp !== null && $this->aCcTimestamp->getDbId() !== $v) {
$this->aCcMountName = null; $this->aCcTimestamp = null;
} }
return $this; return $this;
@ -270,8 +270,8 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
if ($this->aCcTimestamp !== null && $this->timestamp_id !== $this->aCcTimestamp->getDbId()) { if ($this->aCcTimestamp !== null && $this->timestamp_id !== $this->aCcTimestamp->getDbId()) {
$this->aCcTimestamp = null; $this->aCcTimestamp = null;
} }
if ($this->aCcMountName !== null && $this->mount_name_id !== $this->aCcMountName->getDbId()) { if ($this->aCcTimestamp !== null && $this->mount_name_id !== $this->aCcTimestamp->getDbId()) {
$this->aCcMountName = null; $this->aCcTimestamp = null;
} }
} // ensureConsistency } // ensureConsistency
@ -313,7 +313,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects? if ($deep) { // also de-associate any related objects?
$this->aCcTimestamp = null; $this->aCcTimestamp = null;
$this->aCcMountName = null; $this->aCcTimestamp = null;
} // if (deep) } // if (deep)
} }
@ -436,11 +436,11 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$this->setCcTimestamp($this->aCcTimestamp); $this->setCcTimestamp($this->aCcTimestamp);
} }
if ($this->aCcMountName !== null) { if ($this->aCcTimestamp !== null) {
if ($this->aCcMountName->isModified() || $this->aCcMountName->isNew()) { if ($this->aCcTimestamp->isModified() || $this->aCcTimestamp->isNew()) {
$affectedRows += $this->aCcMountName->save($con); $affectedRows += $this->aCcTimestamp->save($con);
} }
$this->setCcMountName($this->aCcMountName); $this->setCcTimestamp($this->aCcTimestamp);
} }
if ($this->isNew() ) { if ($this->isNew() ) {
@ -543,9 +543,9 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
} }
} }
if ($this->aCcMountName !== null) { if ($this->aCcTimestamp !== null) {
if (!$this->aCcMountName->validate($columns)) { if (!$this->aCcTimestamp->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aCcMountName->getValidationFailures()); $failureMap = array_merge($failureMap, $this->aCcTimestamp->getValidationFailures());
} }
} }
@ -633,8 +633,8 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
if (null !== $this->aCcTimestamp) { if (null !== $this->aCcTimestamp) {
$result['CcTimestamp'] = $this->aCcTimestamp->toArray($keyType, $includeLazyLoadColumns, true); $result['CcTimestamp'] = $this->aCcTimestamp->toArray($keyType, $includeLazyLoadColumns, true);
} }
if (null !== $this->aCcMountName) { if (null !== $this->aCcTimestamp) {
$result['CcMountName'] = $this->aCcMountName->toArray($keyType, $includeLazyLoadColumns, true); $result['CcTimestamp'] = $this->aCcTimestamp->toArray($keyType, $includeLazyLoadColumns, true);
} }
} }
return $result; return $result;
@ -879,13 +879,13 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
} }
/** /**
* Declares an association between this object and a CcMountName object. * Declares an association between this object and a CcTimestamp object.
* *
* @param CcMountName $v * @param CcTimestamp $v
* @return CcListenerCount The current object (for fluent API support) * @return CcListenerCount The current object (for fluent API support)
* @throws PropelException * @throws PropelException
*/ */
public function setCcMountName(CcMountName $v = null) public function setCcTimestamp(CcTimestamp $v = null)
{ {
if ($v === null) { if ($v === null) {
$this->setDbMountNameId(NULL); $this->setDbMountNameId(NULL);
@ -893,10 +893,10 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$this->setDbMountNameId($v->getDbId()); $this->setDbMountNameId($v->getDbId());
} }
$this->aCcMountName = $v; $this->aCcTimestamp = $v;
// Add binding for other direction of this n:n relationship. // Add binding for other direction of this n:n relationship.
// If this object has already been added to the CcMountName object, it will not be re-added. // If this object has already been added to the CcTimestamp object, it will not be re-added.
if ($v !== null) { if ($v !== null) {
$v->addCcListenerCount($this); $v->addCcListenerCount($this);
} }
@ -906,25 +906,25 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
/** /**
* Get the associated CcMountName object * Get the associated CcTimestamp object
* *
* @param PropelPDO Optional Connection object. * @param PropelPDO Optional Connection object.
* @return CcMountName The associated CcMountName object. * @return CcTimestamp The associated CcTimestamp object.
* @throws PropelException * @throws PropelException
*/ */
public function getCcMountName(PropelPDO $con = null) public function getCcTimestamp(PropelPDO $con = null)
{ {
if ($this->aCcMountName === null && ($this->mount_name_id !== null)) { if ($this->aCcTimestamp === null && ($this->mount_name_id !== null)) {
$this->aCcMountName = CcMountNameQuery::create()->findPk($this->mount_name_id, $con); $this->aCcTimestamp = CcTimestampQuery::create()->findPk($this->mount_name_id, $con);
/* The following can be used additionally to /* The following can be used additionally to
guarantee the related object contains a reference guarantee the related object contains a reference
to this object. This level of coupling may, however, be to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection undesirable since it could result in an only partially populated collection
in the referenced object. in the referenced object.
$this->aCcMountName->addCcListenerCounts($this); $this->aCcTimestamp->addCcListenerCounts($this);
*/ */
} }
return $this->aCcMountName; return $this->aCcTimestamp;
} }
/** /**
@ -959,7 +959,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
} // if ($deep) } // if ($deep)
$this->aCcTimestamp = null; $this->aCcTimestamp = null;
$this->aCcMountName = null; $this->aCcTimestamp = null;
} }
/** /**

View file

@ -496,7 +496,7 @@ abstract class BaseCcListenerCountPeer {
/** /**
* Returns the number of rows matching criteria, joining the related CcMountName table * Returns the number of rows matching criteria, joining the related CcTimestamp table
* *
* @param Criteria $criteria * @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
@ -504,7 +504,7 @@ abstract class BaseCcListenerCountPeer {
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows. * @return int Number of matching rows.
*/ */
public static function doCountJoinCcMountName(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) public static function doCountJoinCcTimestamp(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{ {
// we're going to modify criteria, so copy it first // we're going to modify criteria, so copy it first
$criteria = clone $criteria; $criteria = clone $criteria;
@ -531,7 +531,7 @@ abstract class BaseCcListenerCountPeer {
$con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ); $con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
} }
$criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior); $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcTimestampPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con); $stmt = BasePeer::doCount($criteria, $con);
@ -612,7 +612,7 @@ abstract class BaseCcListenerCountPeer {
/** /**
* Selects a collection of CcListenerCount objects pre-filled with their CcMountName objects. * Selects a collection of CcListenerCount objects pre-filled with their CcTimestamp objects.
* @param Criteria $criteria * @param Criteria $criteria
* @param PropelPDO $con * @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
@ -620,7 +620,7 @@ abstract class BaseCcListenerCountPeer {
* @throws PropelException Any exceptions caught during processing will be * @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException. * rethrown wrapped into a PropelException.
*/ */
public static function doSelectJoinCcMountName(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) public static function doSelectJoinCcTimestamp(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{ {
$criteria = clone $criteria; $criteria = clone $criteria;
@ -631,9 +631,9 @@ abstract class BaseCcListenerCountPeer {
CcListenerCountPeer::addSelectColumns($criteria); CcListenerCountPeer::addSelectColumns($criteria);
$startcol = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS); $startcol = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS);
CcMountNamePeer::addSelectColumns($criteria); CcTimestampPeer::addSelectColumns($criteria);
$criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior); $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcTimestampPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con); $stmt = BasePeer::doSelect($criteria, $con);
$results = array(); $results = array();
@ -653,19 +653,19 @@ abstract class BaseCcListenerCountPeer {
CcListenerCountPeer::addInstanceToPool($obj1, $key1); CcListenerCountPeer::addInstanceToPool($obj1, $key1);
} // if $obj1 already loaded } // if $obj1 already loaded
$key2 = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol); $key2 = CcTimestampPeer::getPrimaryKeyHashFromRow($row, $startcol);
if ($key2 !== null) { if ($key2 !== null) {
$obj2 = CcMountNamePeer::getInstanceFromPool($key2); $obj2 = CcTimestampPeer::getInstanceFromPool($key2);
if (!$obj2) { if (!$obj2) {
$cls = CcMountNamePeer::getOMClass(false); $cls = CcTimestampPeer::getOMClass(false);
$obj2 = new $cls(); $obj2 = new $cls();
$obj2->hydrate($row, $startcol); $obj2->hydrate($row, $startcol);
CcMountNamePeer::addInstanceToPool($obj2, $key2); CcTimestampPeer::addInstanceToPool($obj2, $key2);
} // if obj2 already loaded } // if obj2 already loaded
// Add the $obj1 (CcListenerCount) to $obj2 (CcMountName) // Add the $obj1 (CcListenerCount) to $obj2 (CcTimestamp)
$obj2->addCcListenerCount($obj1); $obj2->addCcListenerCount($obj1);
} // if joined row was not null } // if joined row was not null
@ -715,7 +715,7 @@ abstract class BaseCcListenerCountPeer {
$criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior); $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
$criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior); $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcTimestampPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con); $stmt = BasePeer::doCount($criteria, $con);
@ -753,12 +753,12 @@ abstract class BaseCcListenerCountPeer {
CcTimestampPeer::addSelectColumns($criteria); CcTimestampPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcTimestampPeer::NUM_COLUMNS - CcTimestampPeer::NUM_LAZY_LOAD_COLUMNS); $startcol3 = $startcol2 + (CcTimestampPeer::NUM_COLUMNS - CcTimestampPeer::NUM_LAZY_LOAD_COLUMNS);
CcMountNamePeer::addSelectColumns($criteria); CcTimestampPeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + (CcMountNamePeer::NUM_COLUMNS - CcMountNamePeer::NUM_LAZY_LOAD_COLUMNS); $startcol4 = $startcol3 + (CcTimestampPeer::NUM_COLUMNS - CcTimestampPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior); $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
$criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior); $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcTimestampPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con); $stmt = BasePeer::doSelect($criteria, $con);
$results = array(); $results = array();
@ -795,21 +795,21 @@ abstract class BaseCcListenerCountPeer {
$obj2->addCcListenerCount($obj1); $obj2->addCcListenerCount($obj1);
} // if joined row not null } // if joined row not null
// Add objects for joined CcMountName rows // Add objects for joined CcTimestamp rows
$key3 = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol3); $key3 = CcTimestampPeer::getPrimaryKeyHashFromRow($row, $startcol3);
if ($key3 !== null) { if ($key3 !== null) {
$obj3 = CcMountNamePeer::getInstanceFromPool($key3); $obj3 = CcTimestampPeer::getInstanceFromPool($key3);
if (!$obj3) { if (!$obj3) {
$cls = CcMountNamePeer::getOMClass(false); $cls = CcTimestampPeer::getOMClass(false);
$obj3 = new $cls(); $obj3 = new $cls();
$obj3->hydrate($row, $startcol3); $obj3->hydrate($row, $startcol3);
CcMountNamePeer::addInstanceToPool($obj3, $key3); CcTimestampPeer::addInstanceToPool($obj3, $key3);
} // if obj3 loaded } // if obj3 loaded
// Add the $obj1 (CcListenerCount) to the collection in $obj3 (CcMountName) // Add the $obj1 (CcListenerCount) to the collection in $obj3 (CcTimestamp)
$obj3->addCcListenerCount($obj1); $obj3->addCcListenerCount($obj1);
} // if joined row not null } // if joined row not null
@ -856,8 +856,6 @@ abstract class BaseCcListenerCountPeer {
$con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ); $con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
} }
$criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con); $stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) { if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
@ -871,7 +869,7 @@ abstract class BaseCcListenerCountPeer {
/** /**
* Returns the number of rows matching criteria, joining the related CcMountName table * Returns the number of rows matching criteria, joining the related CcTimestamp table
* *
* @param Criteria $criteria * @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
@ -879,7 +877,7 @@ abstract class BaseCcListenerCountPeer {
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows. * @return int Number of matching rows.
*/ */
public static function doCountJoinAllExceptCcMountName(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) public static function doCountJoinAllExceptCcTimestamp(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{ {
// we're going to modify criteria, so copy it first // we're going to modify criteria, so copy it first
$criteria = clone $criteria; $criteria = clone $criteria;
@ -906,8 +904,6 @@ abstract class BaseCcListenerCountPeer {
$con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ); $con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
} }
$criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con); $stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) { if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
@ -944,11 +940,6 @@ abstract class BaseCcListenerCountPeer {
CcListenerCountPeer::addSelectColumns($criteria); CcListenerCountPeer::addSelectColumns($criteria);
$startcol2 = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS); $startcol2 = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS);
CcMountNamePeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcMountNamePeer::NUM_COLUMNS - CcMountNamePeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con); $stmt = BasePeer::doSelect($criteria, $con);
$results = array(); $results = array();
@ -967,25 +958,6 @@ abstract class BaseCcListenerCountPeer {
CcListenerCountPeer::addInstanceToPool($obj1, $key1); CcListenerCountPeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded } // if obj1 already loaded
// Add objects for joined CcMountName rows
$key2 = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = CcMountNamePeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcMountNamePeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
CcMountNamePeer::addInstanceToPool($obj2, $key2);
} // if $obj2 already loaded
// Add the $obj1 (CcListenerCount) to the collection in $obj2 (CcMountName)
$obj2->addCcListenerCount($obj1);
} // if joined row is not null
$results[] = $obj1; $results[] = $obj1;
} }
$stmt->closeCursor(); $stmt->closeCursor();
@ -994,7 +966,7 @@ abstract class BaseCcListenerCountPeer {
/** /**
* Selects a collection of CcListenerCount objects pre-filled with all related objects except CcMountName. * Selects a collection of CcListenerCount objects pre-filled with all related objects except CcTimestamp.
* *
* @param Criteria $criteria * @param Criteria $criteria
* @param PropelPDO $con * @param PropelPDO $con
@ -1003,7 +975,7 @@ abstract class BaseCcListenerCountPeer {
* @throws PropelException Any exceptions caught during processing will be * @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException. * rethrown wrapped into a PropelException.
*/ */
public static function doSelectJoinAllExceptCcMountName(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) public static function doSelectJoinAllExceptCcTimestamp(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{ {
$criteria = clone $criteria; $criteria = clone $criteria;
@ -1017,11 +989,6 @@ abstract class BaseCcListenerCountPeer {
CcListenerCountPeer::addSelectColumns($criteria); CcListenerCountPeer::addSelectColumns($criteria);
$startcol2 = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS); $startcol2 = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS);
CcTimestampPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcTimestampPeer::NUM_COLUMNS - CcTimestampPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con); $stmt = BasePeer::doSelect($criteria, $con);
$results = array(); $results = array();
@ -1040,25 +1007,6 @@ abstract class BaseCcListenerCountPeer {
CcListenerCountPeer::addInstanceToPool($obj1, $key1); CcListenerCountPeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded } // if obj1 already loaded
// Add objects for joined CcTimestamp rows
$key2 = CcTimestampPeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = CcTimestampPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcTimestampPeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
CcTimestampPeer::addInstanceToPool($obj2, $key2);
} // if $obj2 already loaded
// Add the $obj1 (CcListenerCount) to the collection in $obj2 (CcTimestamp)
$obj2->addCcListenerCount($obj1);
} // if joined row is not null
$results[] = $obj1; $results[] = $obj1;
} }
$stmt->closeCursor(); $stmt->closeCursor();

View file

@ -24,9 +24,9 @@
* @method CcListenerCountQuery rightJoinCcTimestamp($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcTimestamp relation * @method CcListenerCountQuery rightJoinCcTimestamp($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcTimestamp relation
* @method CcListenerCountQuery innerJoinCcTimestamp($relationAlias = '') Adds a INNER JOIN clause to the query using the CcTimestamp relation * @method CcListenerCountQuery innerJoinCcTimestamp($relationAlias = '') Adds a INNER JOIN clause to the query using the CcTimestamp relation
* *
* @method CcListenerCountQuery leftJoinCcMountName($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcMountName relation * @method CcListenerCountQuery leftJoinCcTimestamp($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcTimestamp relation
* @method CcListenerCountQuery rightJoinCcMountName($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcMountName relation * @method CcListenerCountQuery rightJoinCcTimestamp($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcTimestamp relation
* @method CcListenerCountQuery innerJoinCcMountName($relationAlias = '') Adds a INNER JOIN clause to the query using the CcMountName relation * @method CcListenerCountQuery innerJoinCcTimestamp($relationAlias = '') Adds a INNER JOIN clause to the query using the CcTimestamp relation
* *
* @method CcListenerCount findOne(PropelPDO $con = null) Return the first CcListenerCount matching the query * @method CcListenerCount findOne(PropelPDO $con = null) Return the first CcListenerCount matching the query
* @method CcListenerCount findOneOrCreate(PropelPDO $con = null) Return the first CcListenerCount matching the query, or a new CcListenerCount object populated from the query conditions when no match is found * @method CcListenerCount findOneOrCreate(PropelPDO $con = null) Return the first CcListenerCount matching the query, or a new CcListenerCount object populated from the query conditions when no match is found
@ -324,31 +324,31 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
} }
/** /**
* Filter the query by a related CcMountName object * Filter the query by a related CcTimestamp object
* *
* @param CcMountName $ccMountName the related object to use as filter * @param CcTimestamp $ccTimestamp the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return CcListenerCountQuery The current query, for fluid interface * @return CcListenerCountQuery The current query, for fluid interface
*/ */
public function filterByCcMountName($ccMountName, $comparison = null) public function filterByCcTimestamp($ccTimestamp, $comparison = null)
{ {
return $this return $this
->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $ccMountName->getDbId(), $comparison); ->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $ccTimestamp->getDbId(), $comparison);
} }
/** /**
* Adds a JOIN clause to the query using the CcMountName relation * Adds a JOIN clause to the query using the CcTimestamp relation
* *
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return CcListenerCountQuery The current query, for fluid interface * @return CcListenerCountQuery The current query, for fluid interface
*/ */
public function joinCcMountName($relationAlias = '', $joinType = Criteria::INNER_JOIN) public function joinCcTimestamp($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcMountName'); $relationMap = $tableMap->getRelation('CcTimestamp');
// create a ModelJoin object for this join // create a ModelJoin object for this join
$join = new ModelJoin(); $join = new ModelJoin();
@ -363,14 +363,14 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias); $this->addJoinObject($join, $relationAlias);
} else { } else {
$this->addJoinObject($join, 'CcMountName'); $this->addJoinObject($join, 'CcTimestamp');
} }
return $this; return $this;
} }
/** /**
* Use the CcMountName relation CcMountName object * Use the CcTimestamp relation CcTimestamp object
* *
* @see useQuery() * @see useQuery()
* *
@ -378,13 +378,13 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
* to be used as main alias in the secondary query * to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return CcMountNameQuery A secondary query class using the current class as primary query * @return CcTimestampQuery A secondary query class using the current class as primary query
*/ */
public function useCcMountNameQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) public function useCcTimestampQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinCcMountName($relationAlias, $joinType) ->joinCcTimestamp($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcMountName', 'CcMountNameQuery'); ->useQuery($relationAlias ? $relationAlias : 'CcTimestamp', 'CcTimestampQuery');
} }
/** /**

View file

@ -1,893 +0,0 @@
<?php
/**
* Base class that represents a row from the 'cc_mount_name' table.
*
*
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcMountName extends BaseObject implements Persistent
{
/**
* Peer class name
*/
const PEER = 'CcMountNamePeer';
/**
* The Peer class.
* Instance provides a convenient way of calling static methods on a class
* that calling code may not be able to identify.
* @var CcMountNamePeer
*/
protected static $peer;
/**
* The value for the id field.
* @var int
*/
protected $id;
/**
* The value for the mount_name field.
* @var string
*/
protected $mount_name;
/**
* @var array CcListenerCount[] Collection to store aggregation of CcListenerCount objects.
*/
protected $collCcListenerCounts;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInSave = false;
/**
* Flag to prevent endless validation loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInValidation = false;
/**
* Get the [id] column value.
*
* @return int
*/
public function getDbId()
{
return $this->id;
}
/**
* Get the [mount_name] column value.
*
* @return string
*/
public function getDbMountName()
{
return $this->mount_name;
}
/**
* Set the value of [id] column.
*
* @param int $v new value
* @return CcMountName 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[] = CcMountNamePeer::ID;
}
return $this;
} // setDbId()
/**
* Set the value of [mount_name] column.
*
* @param string $v new value
* @return CcMountName The current object (for fluent API support)
*/
public function setDbMountName($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->mount_name !== $v) {
$this->mount_name = $v;
$this->modifiedColumns[] = CcMountNamePeer::MOUNT_NAME;
}
return $this;
} // setDbMountName()
/**
* 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->mount_name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
$this->resetModified();
$this->setNew(false);
if ($rehydrate) {
$this->ensureConsistency();
}
return $startcol + 2; // 2 = CcMountNamePeer::NUM_COLUMNS - CcMountNamePeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcMountName 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()
{
} // 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(CcMountNamePeer::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 = CcMountNamePeer::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->collCcListenerCounts = 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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$con->beginTransaction();
try {
$ret = $this->preDelete($con);
if ($ret) {
CcMountNameQuery::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(CcMountNamePeer::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);
CcMountNamePeer::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;
if ($this->isNew() ) {
$this->modifiedColumns[] = CcMountNamePeer::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(CcMountNamePeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcMountNamePeer::ID.')');
}
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows = 1;
$this->setDbId($pk); //[IMV] update autoincrement primary key
$this->setNew(false);
} else {
$affectedRows = CcMountNamePeer::doUpdate($this, $con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
}
if ($this->collCcListenerCounts !== null) {
foreach ($this->collCcListenerCounts 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 <code>true</code> is returned; otherwise
* an aggreagated array of ValidationFailed objects will be returned.
*
* @param array $columns Array of column names to validate.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
*/
protected function doValidate($columns = null)
{
if (!$this->alreadyInValidation) {
$this->alreadyInValidation = true;
$retval = null;
$failureMap = array();
if (($retval = CcMountNamePeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval);
}
if ($this->collCcListenerCounts !== null) {
foreach ($this->collCcListenerCounts 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 = CcMountNamePeer::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->getDbMountName();
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.
*
* @return array an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
{
$keys = CcMountNamePeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getDbId(),
$keys[1] => $this->getDbMountName(),
);
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 = CcMountNamePeer::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->setDbMountName($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 = CcMountNamePeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setDbMountName($arr[$keys[1]]);
}
/**
* 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(CcMountNamePeer::DATABASE_NAME);
if ($this->isColumnModified(CcMountNamePeer::ID)) $criteria->add(CcMountNamePeer::ID, $this->id);
if ($this->isColumnModified(CcMountNamePeer::MOUNT_NAME)) $criteria->add(CcMountNamePeer::MOUNT_NAME, $this->mount_name);
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(CcMountNamePeer::DATABASE_NAME);
$criteria->add(CcMountNamePeer::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 CcMountName (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->setDbMountName($this->mount_name);
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->getCcListenerCounts() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCcListenerCount($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 CcMountName 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 CcMountNamePeer
*/
public function getPeer()
{
if (self::$peer === null) {
self::$peer = new CcMountNamePeer();
}
return self::$peer;
}
/**
* Clears out the collCcListenerCounts 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 addCcListenerCounts()
*/
public function clearCcListenerCounts()
{
$this->collCcListenerCounts = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Initializes the collCcListenerCounts collection.
*
* By default this just sets the collCcListenerCounts collection to an empty array (like clearcollCcListenerCounts());
* 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 initCcListenerCounts()
{
$this->collCcListenerCounts = new PropelObjectCollection();
$this->collCcListenerCounts->setModel('CcListenerCount');
}
/**
* Gets an array of CcListenerCount 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 CcMountName 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 CcListenerCount[] List of CcListenerCount objects
* @throws PropelException
*/
public function getCcListenerCounts($criteria = null, PropelPDO $con = null)
{
if(null === $this->collCcListenerCounts || null !== $criteria) {
if ($this->isNew() && null === $this->collCcListenerCounts) {
// return empty collection
$this->initCcListenerCounts();
} else {
$collCcListenerCounts = CcListenerCountQuery::create(null, $criteria)
->filterByCcMountName($this)
->find($con);
if (null !== $criteria) {
return $collCcListenerCounts;
}
$this->collCcListenerCounts = $collCcListenerCounts;
}
}
return $this->collCcListenerCounts;
}
/**
* Returns the number of related CcListenerCount objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
* @return int Count of related CcListenerCount objects.
* @throws PropelException
*/
public function countCcListenerCounts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
if(null === $this->collCcListenerCounts || null !== $criteria) {
if ($this->isNew() && null === $this->collCcListenerCounts) {
return 0;
} else {
$query = CcListenerCountQuery::create(null, $criteria);
if($distinct) {
$query->distinct();
}
return $query
->filterByCcMountName($this)
->count($con);
}
} else {
return count($this->collCcListenerCounts);
}
}
/**
* Method called to associate a CcListenerCount object to this object
* through the CcListenerCount foreign key attribute.
*
* @param CcListenerCount $l CcListenerCount
* @return void
* @throws PropelException
*/
public function addCcListenerCount(CcListenerCount $l)
{
if ($this->collCcListenerCounts === null) {
$this->initCcListenerCounts();
}
if (!$this->collCcListenerCounts->contains($l)) { // only add it if the **same** object is not already associated
$this->collCcListenerCounts[]= $l;
$l->setCcMountName($this);
}
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this CcMountName is new, it will return
* an empty collection; or if this CcMountName has previously
* been saved, it will retrieve related CcListenerCounts 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 CcMountName.
*
* @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 CcListenerCount[] List of CcListenerCount objects
*/
public function getCcListenerCountsJoinCcTimestamp($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = CcListenerCountQuery::create(null, $criteria);
$query->joinWith('CcTimestamp', $join_behavior);
return $this->getCcListenerCounts($query, $con);
}
/**
* Clears the current object and sets all attributes to their default values
*/
public function clear()
{
$this->id = null;
$this->mount_name = 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 ($this->collCcListenerCounts) {
foreach ((array) $this->collCcListenerCounts as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep)
$this->collCcListenerCounts = 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);
}
} // BaseCcMountName

View file

@ -1,742 +0,0 @@
<?php
/**
* Base static class for performing query and update operations on the 'cc_mount_name' table.
*
*
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcMountNamePeer {
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
/** the table name for this class */
const TABLE_NAME = 'cc_mount_name';
/** the related Propel class for this table */
const OM_CLASS = 'CcMountName';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcMountName';
/** the related TableMap class for this table */
const TM_CLASS = 'CcMountNameTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 2;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_mount_name.ID';
/** the column name for the MOUNT_NAME field */
const MOUNT_NAME = 'cc_mount_name.MOUNT_NAME';
/**
* An identiy map to hold any loaded instances of CcMountName objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcMountName[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbMountName', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbMountName', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::MOUNT_NAME, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'MOUNT_NAME', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'mount_name', ),
BasePeer::TYPE_NUM => array (0, 1, )
);
/**
* 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, 'DbMountName' => 1, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbMountName' => 1, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::MOUNT_NAME => 1, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'MOUNT_NAME' => 1, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'mount_name' => 1, ),
BasePeer::TYPE_NUM => array (0, 1, )
);
/**
* 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.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. CcMountNamePeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(CcMountNamePeer::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(CcMountNamePeer::ID);
$criteria->addSelectColumn(CcMountNamePeer::MOUNT_NAME);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.MOUNT_NAME');
}
}
/**
* 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(CcMountNamePeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcMountNamePeer::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(CcMountNamePeer::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 CcMountName
* @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 = CcMountNamePeer::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 CcMountNamePeer::populateObjects(CcMountNamePeer::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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
CcMountNamePeer::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 CcMountName $value A CcMountName object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcMountName $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 CcMountName object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof CcMountName) {
$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 CcMountName 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 CcMountName 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_mount_name
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in CcListenerCountPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcListenerCountPeer::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 = CcMountNamePeer::getOMClass(false);
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcMountNamePeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = CcMountNamePeer::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;
CcMountNamePeer::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 (CcMountName object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = CcMountNamePeer::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 + CcMountNamePeer::NUM_COLUMNS;
} else {
$cls = CcMountNamePeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcMountNamePeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* 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(BaseCcMountNamePeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcMountNamePeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcMountNameTableMap());
}
}
/**
* 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 ? CcMountNamePeer::CLASS_DEFAULT : CcMountNamePeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcMountName or Criteria object.
*
* @param mixed $values Criteria or CcMountName 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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from CcMountName object
}
if ($criteria->containsKey(CcMountNamePeer::ID) && $criteria->keyContainsValue(CcMountNamePeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcMountNamePeer::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 CcMountName or Criteria object.
*
* @param mixed $values Criteria or CcMountName 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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(CcMountNamePeer::ID);
$value = $criteria->remove(CcMountNamePeer::ID);
if ($value) {
$selectCriteria->add(CcMountNamePeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(CcMountNamePeer::TABLE_NAME);
}
} else { // $values is CcMountName 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_mount_name 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(CcMountNamePeer::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(CcMountNamePeer::TABLE_NAME, $con, CcMountNamePeer::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).
CcMountNamePeer::clearInstancePool();
CcMountNamePeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcMountName or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcMountName 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(CcMountNamePeer::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.
CcMountNamePeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof CcMountName) { // it's a model object
// invalidate the cache for this single object
CcMountNamePeer::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(CcMountNamePeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
CcMountNamePeer::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);
CcMountNamePeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given CcMountName 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 CcMountName $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(CcMountName $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(CcMountNamePeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(CcMountNamePeer::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(CcMountNamePeer::DATABASE_NAME, CcMountNamePeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return CcMountName
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = CcMountNamePeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(CcMountNamePeer::DATABASE_NAME);
$criteria->add(CcMountNamePeer::ID, $pk);
$v = CcMountNamePeer::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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(CcMountNamePeer::DATABASE_NAME);
$criteria->add(CcMountNamePeer::ID, $pks, Criteria::IN);
$objs = CcMountNamePeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseCcMountNamePeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseCcMountNamePeer::buildTableMap();

View file

@ -1,259 +0,0 @@
<?php
/**
* Base class that represents a query for the 'cc_mount_name' table.
*
*
*
* @method CcMountNameQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcMountNameQuery orderByDbMountName($order = Criteria::ASC) Order by the mount_name column
*
* @method CcMountNameQuery groupByDbId() Group by the id column
* @method CcMountNameQuery groupByDbMountName() Group by the mount_name column
*
* @method CcMountNameQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcMountNameQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcMountNameQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcMountNameQuery leftJoinCcListenerCount($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcListenerCount relation
* @method CcMountNameQuery rightJoinCcListenerCount($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcListenerCount relation
* @method CcMountNameQuery innerJoinCcListenerCount($relationAlias = '') Adds a INNER JOIN clause to the query using the CcListenerCount relation
*
* @method CcMountName findOne(PropelPDO $con = null) Return the first CcMountName matching the query
* @method CcMountName findOneOrCreate(PropelPDO $con = null) Return the first CcMountName matching the query, or a new CcMountName object populated from the query conditions when no match is found
*
* @method CcMountName findOneByDbId(int $id) Return the first CcMountName filtered by the id column
* @method CcMountName findOneByDbMountName(string $mount_name) Return the first CcMountName filtered by the mount_name column
*
* @method array findByDbId(int $id) Return CcMountName objects filtered by the id column
* @method array findByDbMountName(string $mount_name) Return CcMountName objects filtered by the mount_name column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcMountNameQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcMountNameQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'airtime', $modelName = 'CcMountName', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CcMountNameQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return CcMountNameQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CcMountNameQuery) {
return $criteria;
}
$query = new CcMountNameQuery();
if (null !== $modelAlias) {
$query->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
* <code>
* $obj = $c->findPk(12, $con);
* </code>
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con an optional connection object
*
* @return CcMountName|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcMountNamePeer::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
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @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 CcMountNameQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcMountNamePeer::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 CcMountNameQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcMountNamePeer::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 CcMountNameQuery 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(CcMountNamePeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the mount_name column
*
* @param string $dbMountName 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 CcMountNameQuery The current query, for fluid interface
*/
public function filterByDbMountName($dbMountName = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($dbMountName)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbMountName)) {
$dbMountName = str_replace('*', '%', $dbMountName);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcMountNamePeer::MOUNT_NAME, $dbMountName, $comparison);
}
/**
* Filter the query by a related CcListenerCount object
*
* @param CcListenerCount $ccListenerCount the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcMountNameQuery The current query, for fluid interface
*/
public function filterByCcListenerCount($ccListenerCount, $comparison = null)
{
return $this
->addUsingAlias(CcMountNamePeer::ID, $ccListenerCount->getDbMountNameId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcListenerCount relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcMountNameQuery The current query, for fluid interface
*/
public function joinCcListenerCount($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcListenerCount');
// 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, 'CcListenerCount');
}
return $this;
}
/**
* Use the CcListenerCount relation CcListenerCount 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 CcListenerCountQuery A secondary query class using the current class as primary query
*/
public function useCcListenerCountQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcListenerCount($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcListenerCount', 'CcListenerCountQuery');
}
/**
* Exclude object from result
*
* @param CcMountName $ccMountName Object to remove from the list of results
*
* @return CcMountNameQuery The current query, for fluid interface
*/
public function prune($ccMountName = null)
{
if ($ccMountName) {
$this->addUsingAlias(CcMountNamePeer::ID, $ccMountName->getDbId(), Criteria::NOT_EQUAL);
}
return $this;
}
} // BaseCcMountNameQuery

View file

@ -1,905 +0,0 @@
<?php
/**
* Base class that represents a row from the 'cc_playout_history_metadata' table.
*
*
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persistent
{
/**
* Peer class name
*/
const PEER = 'CcPlayoutHistoryMetaDataPeer';
/**
* The Peer class.
* Instance provides a convenient way of calling static methods on a class
* that calling code may not be able to identify.
* @var CcPlayoutHistoryMetaDataPeer
*/
protected static $peer;
/**
* The value for the id field.
* @var int
*/
protected $id;
/**
* The value for the history_id field.
* @var int
*/
protected $history_id;
/**
* The value for the key field.
* @var string
*/
protected $key;
/**
* The value for the value field.
* @var string
*/
protected $value;
/**
* @var CcPlayoutHistory
*/
protected $aCcPlayoutHistory;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInSave = false;
/**
* Flag to prevent endless validation loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInValidation = false;
/**
* Get the [id] column value.
*
* @return int
*/
public function getDbId()
{
return $this->id;
}
/**
* Get the [history_id] column value.
*
* @return int
*/
public function getDbHistoryId()
{
return $this->history_id;
}
/**
* Get the [key] column value.
*
* @return string
*/
public function getDbKey()
{
return $this->key;
}
/**
* Get the [value] column value.
*
* @return string
*/
public function getDbValue()
{
return $this->value;
}
/**
* Set the value of [id] column.
*
* @param int $v new value
* @return CcPlayoutHistoryMetaData 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[] = CcPlayoutHistoryMetaDataPeer::ID;
}
return $this;
} // setDbId()
/**
* Set the value of [history_id] column.
*
* @param int $v new value
* @return CcPlayoutHistoryMetaData The current object (for fluent API support)
*/
public function setDbHistoryId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->history_id !== $v) {
$this->history_id = $v;
$this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::HISTORY_ID;
}
if ($this->aCcPlayoutHistory !== null && $this->aCcPlayoutHistory->getDbId() !== $v) {
$this->aCcPlayoutHistory = null;
}
return $this;
} // setDbHistoryId()
/**
* Set the value of [key] column.
*
* @param string $v new value
* @return CcPlayoutHistoryMetaData The current object (for fluent API support)
*/
public function setDbKey($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->key !== $v) {
$this->key = $v;
$this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::KEY;
}
return $this;
} // setDbKey()
/**
* Set the value of [value] column.
*
* @param string $v new value
* @return CcPlayoutHistoryMetaData 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[] = CcPlayoutHistoryMetaDataPeer::VALUE;
}
return $this;
} // setDbValue()
/**
* 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->history_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
$this->key = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->value = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->resetModified();
$this->setNew(false);
if ($rehydrate) {
$this->ensureConsistency();
}
return $startcol + 4; // 4 = CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS - CcPlayoutHistoryMetaDataPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcPlayoutHistoryMetaData 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->aCcPlayoutHistory !== null && $this->history_id !== $this->aCcPlayoutHistory->getDbId()) {
$this->aCcPlayoutHistory = 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(CcPlayoutHistoryMetaDataPeer::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 = CcPlayoutHistoryMetaDataPeer::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->aCcPlayoutHistory = 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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$con->beginTransaction();
try {
$ret = $this->preDelete($con);
if ($ret) {
CcPlayoutHistoryMetaDataQuery::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(CcPlayoutHistoryMetaDataPeer::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);
CcPlayoutHistoryMetaDataPeer::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->aCcPlayoutHistory !== null) {
if ($this->aCcPlayoutHistory->isModified() || $this->aCcPlayoutHistory->isNew()) {
$affectedRows += $this->aCcPlayoutHistory->save($con);
}
$this->setCcPlayoutHistory($this->aCcPlayoutHistory);
}
if ($this->isNew() ) {
$this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryMetaDataPeer::ID.')');
}
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows += 1;
$this->setDbId($pk); //[IMV] update autoincrement primary key
$this->setNew(false);
} else {
$affectedRows += CcPlayoutHistoryMetaDataPeer::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 <code>true</code> is returned; otherwise
* an aggreagated array of ValidationFailed objects will be returned.
*
* @param array $columns Array of column names to validate.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> 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->aCcPlayoutHistory !== null) {
if (!$this->aCcPlayoutHistory->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aCcPlayoutHistory->getValidationFailures());
}
}
if (($retval = CcPlayoutHistoryMetaDataPeer::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 = CcPlayoutHistoryMetaDataPeer::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->getDbHistoryId();
break;
case 2:
return $this->getDbKey();
break;
case 3:
return $this->getDbValue();
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 = CcPlayoutHistoryMetaDataPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getDbId(),
$keys[1] => $this->getDbHistoryId(),
$keys[2] => $this->getDbKey(),
$keys[3] => $this->getDbValue(),
);
if ($includeForeignObjects) {
if (null !== $this->aCcPlayoutHistory) {
$result['CcPlayoutHistory'] = $this->aCcPlayoutHistory->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 = CcPlayoutHistoryMetaDataPeer::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->setDbHistoryId($value);
break;
case 2:
$this->setDbKey($value);
break;
case 3:
$this->setDbValue($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 = CcPlayoutHistoryMetaDataPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setDbHistoryId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDbKey($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDbValue($arr[$keys[3]]);
}
/**
* 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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::ID)) $criteria->add(CcPlayoutHistoryMetaDataPeer::ID, $this->id);
if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::HISTORY_ID)) $criteria->add(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $this->history_id);
if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::KEY)) $criteria->add(CcPlayoutHistoryMetaDataPeer::KEY, $this->key);
if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::VALUE)) $criteria->add(CcPlayoutHistoryMetaDataPeer::VALUE, $this->value);
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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
$criteria->add(CcPlayoutHistoryMetaDataPeer::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 CcPlayoutHistoryMetaData (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->setDbHistoryId($this->history_id);
$copyObj->setDbKey($this->key);
$copyObj->setDbValue($this->value);
$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 CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaDataPeer
*/
public function getPeer()
{
if (self::$peer === null) {
self::$peer = new CcPlayoutHistoryMetaDataPeer();
}
return self::$peer;
}
/**
* Declares an association between this object and a CcPlayoutHistory object.
*
* @param CcPlayoutHistory $v
* @return CcPlayoutHistoryMetaData The current object (for fluent API support)
* @throws PropelException
*/
public function setCcPlayoutHistory(CcPlayoutHistory $v = null)
{
if ($v === null) {
$this->setDbHistoryId(NULL);
} else {
$this->setDbHistoryId($v->getDbId());
}
$this->aCcPlayoutHistory = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the CcPlayoutHistory object, it will not be re-added.
if ($v !== null) {
$v->addCcPlayoutHistoryMetaData($this);
}
return $this;
}
/**
* Get the associated CcPlayoutHistory object
*
* @param PropelPDO Optional Connection object.
* @return CcPlayoutHistory The associated CcPlayoutHistory object.
* @throws PropelException
*/
public function getCcPlayoutHistory(PropelPDO $con = null)
{
if ($this->aCcPlayoutHistory === null && ($this->history_id !== null)) {
$this->aCcPlayoutHistory = CcPlayoutHistoryQuery::create()->findPk($this->history_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->aCcPlayoutHistory->addCcPlayoutHistoryMetaDatas($this);
*/
}
return $this->aCcPlayoutHistory;
}
/**
* Clears the current object and sets all attributes to their default values
*/
public function clear()
{
$this->id = null;
$this->history_id = null;
$this->key = null;
$this->value = 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->aCcPlayoutHistory = 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);
}
} // BaseCcPlayoutHistoryMetaData

View file

@ -1,983 +0,0 @@
<?php
/**
* Base static class for performing query and update operations on the 'cc_playout_history_metadata' table.
*
*
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryMetaDataPeer {
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
/** the table name for this class */
const TABLE_NAME = 'cc_playout_history_metadata';
/** the related Propel class for this table */
const OM_CLASS = 'CcPlayoutHistoryMetaData';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcPlayoutHistoryMetaData';
/** the related TableMap class for this table */
const TM_CLASS = 'CcPlayoutHistoryMetaDataTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 4;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_playout_history_metadata.ID';
/** the column name for the HISTORY_ID field */
const HISTORY_ID = 'cc_playout_history_metadata.HISTORY_ID';
/** the column name for the KEY field */
const KEY = 'cc_playout_history_metadata.KEY';
/** the column name for the VALUE field */
const VALUE = 'cc_playout_history_metadata.VALUE';
/**
* An identiy map to hold any loaded instances of CcPlayoutHistoryMetaData objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcPlayoutHistoryMetaData[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbHistoryId', 'DbKey', 'DbValue', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbHistoryId', 'dbKey', 'dbValue', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::HISTORY_ID, self::KEY, self::VALUE, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'HISTORY_ID', 'KEY', 'VALUE', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'history_id', 'key', 'value', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
* 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, 'DbHistoryId' => 1, 'DbKey' => 2, 'DbValue' => 3, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbHistoryId' => 1, 'dbKey' => 2, 'dbValue' => 3, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::HISTORY_ID => 1, self::KEY => 2, self::VALUE => 3, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'HISTORY_ID' => 1, 'KEY' => 2, 'VALUE' => 3, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'history_id' => 1, 'key' => 2, 'value' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
* 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.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. CcPlayoutHistoryMetaDataPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::ID);
$criteria->addSelectColumn(CcPlayoutHistoryMetaDataPeer::HISTORY_ID);
$criteria->addSelectColumn(CcPlayoutHistoryMetaDataPeer::KEY);
$criteria->addSelectColumn(CcPlayoutHistoryMetaDataPeer::VALUE);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.HISTORY_ID');
$criteria->addSelectColumn($alias . '.KEY');
$criteria->addSelectColumn($alias . '.VALUE');
}
}
/**
* 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(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::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 CcPlayoutHistoryMetaData
* @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 = CcPlayoutHistoryMetaDataPeer::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 CcPlayoutHistoryMetaDataPeer::populateObjects(CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
CcPlayoutHistoryMetaDataPeer::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 CcPlayoutHistoryMetaData $value A CcPlayoutHistoryMetaData object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcPlayoutHistoryMetaData $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 CcPlayoutHistoryMetaData object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof CcPlayoutHistoryMetaData) {
$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 CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaData 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_playout_history_metadata
* 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 = CcPlayoutHistoryMetaDataPeer::getOMClass(false);
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = CcPlayoutHistoryMetaDataPeer::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;
CcPlayoutHistoryMetaDataPeer::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 (CcPlayoutHistoryMetaData object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = CcPlayoutHistoryMetaDataPeer::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 + CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS;
} else {
$cls = CcPlayoutHistoryMetaDataPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcPlayoutHistoryMetaDataPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the number of rows matching criteria, joining the related CcPlayoutHistory 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 doCountJoinCcPlayoutHistory(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(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::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 CcPlayoutHistoryMetaData objects pre-filled with their CcPlayoutHistory 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 CcPlayoutHistoryMetaData objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinCcPlayoutHistory(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);
}
CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
$startcol = (CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS - CcPlayoutHistoryMetaDataPeer::NUM_LAZY_LOAD_COLUMNS);
CcPlayoutHistoryPeer::addSelectColumns($criteria);
$criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcPlayoutHistoryMetaDataPeer::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 = CcPlayoutHistoryMetaDataPeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcPlayoutHistoryMetaDataPeer::addInstanceToPool($obj1, $key1);
} // if $obj1 already loaded
$key2 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, $startcol);
if ($key2 !== null) {
$obj2 = CcPlayoutHistoryPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcPlayoutHistoryPeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
CcPlayoutHistoryPeer::addInstanceToPool($obj2, $key2);
} // if obj2 already loaded
// Add the $obj1 (CcPlayoutHistoryMetaData) to $obj2 (CcPlayoutHistory)
$obj2->addCcPlayoutHistoryMetaData($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(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::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 CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaData 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);
}
CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
$startcol2 = (CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS - CcPlayoutHistoryMetaDataPeer::NUM_LAZY_LOAD_COLUMNS);
CcPlayoutHistoryPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcPlayoutHistoryMetaDataPeer::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 = CcPlayoutHistoryMetaDataPeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcPlayoutHistoryMetaDataPeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded
// Add objects for joined CcPlayoutHistory rows
$key2 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = CcPlayoutHistoryPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcPlayoutHistoryPeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
CcPlayoutHistoryPeer::addInstanceToPool($obj2, $key2);
} // if obj2 loaded
// Add the $obj1 (CcPlayoutHistoryMetaData) to the collection in $obj2 (CcPlayoutHistory)
$obj2->addCcPlayoutHistoryMetaData($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(BaseCcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcPlayoutHistoryMetaDataPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcPlayoutHistoryMetaDataTableMap());
}
}
/**
* 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 ? CcPlayoutHistoryMetaDataPeer::CLASS_DEFAULT : CcPlayoutHistoryMetaDataPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcPlayoutHistoryMetaData or Criteria object.
*
* @param mixed $values Criteria or CcPlayoutHistoryMetaData 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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistoryMetaData object
}
if ($criteria->containsKey(CcPlayoutHistoryMetaDataPeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryMetaDataPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryMetaDataPeer::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 CcPlayoutHistoryMetaData or Criteria object.
*
* @param mixed $values Criteria or CcPlayoutHistoryMetaData 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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(CcPlayoutHistoryMetaDataPeer::ID);
$value = $criteria->remove(CcPlayoutHistoryMetaDataPeer::ID);
if ($value) {
$selectCriteria->add(CcPlayoutHistoryMetaDataPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
}
} else { // $values is CcPlayoutHistoryMetaData 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_playout_history_metadata 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(CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::TABLE_NAME, $con, CcPlayoutHistoryMetaDataPeer::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).
CcPlayoutHistoryMetaDataPeer::clearInstancePool();
CcPlayoutHistoryMetaDataPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcPlayoutHistoryMetaData or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcPlayoutHistoryMetaData 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(CcPlayoutHistoryMetaDataPeer::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.
CcPlayoutHistoryMetaDataPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof CcPlayoutHistoryMetaData) { // it's a model object
// invalidate the cache for this single object
CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
CcPlayoutHistoryMetaDataPeer::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);
CcPlayoutHistoryMetaDataPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaData $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(CcPlayoutHistoryMetaData $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, CcPlayoutHistoryMetaDataPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return CcPlayoutHistoryMetaData
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = CcPlayoutHistoryMetaDataPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
$criteria->add(CcPlayoutHistoryMetaDataPeer::ID, $pk);
$v = CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
$criteria->add(CcPlayoutHistoryMetaDataPeer::ID, $pks, Criteria::IN);
$objs = CcPlayoutHistoryMetaDataPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseCcPlayoutHistoryMetaDataPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseCcPlayoutHistoryMetaDataPeer::buildTableMap();

View file

@ -1,320 +0,0 @@
<?php
/**
* Base class that represents a query for the 'cc_playout_history_metadata' table.
*
*
*
* @method CcPlayoutHistoryMetaDataQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcPlayoutHistoryMetaDataQuery orderByDbHistoryId($order = Criteria::ASC) Order by the history_id column
* @method CcPlayoutHistoryMetaDataQuery orderByDbKey($order = Criteria::ASC) Order by the key column
* @method CcPlayoutHistoryMetaDataQuery orderByDbValue($order = Criteria::ASC) Order by the value column
*
* @method CcPlayoutHistoryMetaDataQuery groupByDbId() Group by the id column
* @method CcPlayoutHistoryMetaDataQuery groupByDbHistoryId() Group by the history_id column
* @method CcPlayoutHistoryMetaDataQuery groupByDbKey() Group by the key column
* @method CcPlayoutHistoryMetaDataQuery groupByDbValue() Group by the value column
*
* @method CcPlayoutHistoryMetaDataQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcPlayoutHistoryMetaDataQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcPlayoutHistoryMetaDataQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcPlayoutHistoryMetaDataQuery leftJoinCcPlayoutHistory($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistory relation
* @method CcPlayoutHistoryMetaDataQuery rightJoinCcPlayoutHistory($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistory relation
* @method CcPlayoutHistoryMetaDataQuery innerJoinCcPlayoutHistory($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistory relation
*
* @method CcPlayoutHistoryMetaData findOne(PropelPDO $con = null) Return the first CcPlayoutHistoryMetaData matching the query
* @method CcPlayoutHistoryMetaData findOneOrCreate(PropelPDO $con = null) Return the first CcPlayoutHistoryMetaData matching the query, or a new CcPlayoutHistoryMetaData object populated from the query conditions when no match is found
*
* @method CcPlayoutHistoryMetaData findOneByDbId(int $id) Return the first CcPlayoutHistoryMetaData filtered by the id column
* @method CcPlayoutHistoryMetaData findOneByDbHistoryId(int $history_id) Return the first CcPlayoutHistoryMetaData filtered by the history_id column
* @method CcPlayoutHistoryMetaData findOneByDbKey(string $key) Return the first CcPlayoutHistoryMetaData filtered by the key column
* @method CcPlayoutHistoryMetaData findOneByDbValue(string $value) Return the first CcPlayoutHistoryMetaData filtered by the value column
*
* @method array findByDbId(int $id) Return CcPlayoutHistoryMetaData objects filtered by the id column
* @method array findByDbHistoryId(int $history_id) Return CcPlayoutHistoryMetaData objects filtered by the history_id column
* @method array findByDbKey(string $key) Return CcPlayoutHistoryMetaData objects filtered by the key column
* @method array findByDbValue(string $value) Return CcPlayoutHistoryMetaData objects filtered by the value column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryMetaDataQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcPlayoutHistoryMetaDataQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'airtime', $modelName = 'CcPlayoutHistoryMetaData', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CcPlayoutHistoryMetaDataQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return CcPlayoutHistoryMetaDataQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CcPlayoutHistoryMetaDataQuery) {
return $criteria;
}
$query = new CcPlayoutHistoryMetaDataQuery();
if (null !== $modelAlias) {
$query->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
* <code>
* $obj = $c->findPk(12, $con);
* </code>
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con an optional connection object
*
* @return CcPlayoutHistoryMetaData|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcPlayoutHistoryMetaDataPeer::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
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @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 CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::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 CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::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 CcPlayoutHistoryMetaDataQuery 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(CcPlayoutHistoryMetaDataPeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the history_id column
*
* @param int|array $dbHistoryId 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 CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
*/
public function filterByDbHistoryId($dbHistoryId = null, $comparison = null)
{
if (is_array($dbHistoryId)) {
$useMinMax = false;
if (isset($dbHistoryId['min'])) {
$this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $dbHistoryId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbHistoryId['max'])) {
$this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $dbHistoryId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $dbHistoryId, $comparison);
}
/**
* Filter the query on the key column
*
* @param string $dbKey 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 CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
*/
public function filterByDbKey($dbKey = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($dbKey)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbKey)) {
$dbKey = str_replace('*', '%', $dbKey);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::KEY, $dbKey, $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 CcPlayoutHistoryMetaDataQuery 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(CcPlayoutHistoryMetaDataPeer::VALUE, $dbValue, $comparison);
}
/**
* Filter the query by a related CcPlayoutHistory object
*
* @param CcPlayoutHistory $ccPlayoutHistory the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
*/
public function filterByCcPlayoutHistory($ccPlayoutHistory, $comparison = null)
{
return $this
->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $ccPlayoutHistory->getDbId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcPlayoutHistory relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
*/
public function joinCcPlayoutHistory($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcPlayoutHistory');
// 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, 'CcPlayoutHistory');
}
return $this;
}
/**
* Use the CcPlayoutHistory relation CcPlayoutHistory 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 CcPlayoutHistoryQuery A secondary query class using the current class as primary query
*/
public function useCcPlayoutHistoryQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcPlayoutHistory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistory', 'CcPlayoutHistoryQuery');
}
/**
* Exclude object from result
*
* @param CcPlayoutHistoryMetaData $ccPlayoutHistoryMetaData Object to remove from the list of results
*
* @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
*/
public function prune($ccPlayoutHistoryMetaData = null)
{
if ($ccPlayoutHistoryMetaData) {
$this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::ID, $ccPlayoutHistoryMetaData->getDbId(), Criteria::NOT_EQUAL);
}
return $this;
}
} // BaseCcPlayoutHistoryMetaDataQuery

View file

@ -1,509 +0,0 @@
<?php
/**
* Base class that represents a query for the 'cc_playout_history' table.
*
*
*
* @method CcPlayoutHistoryQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcPlayoutHistoryQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
* @method CcPlayoutHistoryQuery orderByDbStarts($order = Criteria::ASC) Order by the starts column
* @method CcPlayoutHistoryQuery orderByDbEnds($order = Criteria::ASC) Order by the ends column
* @method CcPlayoutHistoryQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
*
* @method CcPlayoutHistoryQuery groupByDbId() Group by the id column
* @method CcPlayoutHistoryQuery groupByDbFileId() Group by the file_id column
* @method CcPlayoutHistoryQuery groupByDbStarts() Group by the starts column
* @method CcPlayoutHistoryQuery groupByDbEnds() Group by the ends column
* @method CcPlayoutHistoryQuery groupByDbInstanceId() Group by the instance_id column
*
* @method CcPlayoutHistoryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcPlayoutHistoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcPlayoutHistoryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcPlayoutHistoryQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation
* @method CcPlayoutHistoryQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
* @method CcPlayoutHistoryQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
*
* @method CcPlayoutHistoryQuery leftJoinCcShowInstances($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowInstances relation
* @method CcPlayoutHistoryQuery rightJoinCcShowInstances($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
* @method CcPlayoutHistoryQuery innerJoinCcShowInstances($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstances relation
*
* @method CcPlayoutHistoryQuery leftJoinCcPlayoutHistoryMetaData($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistoryMetaData relation
* @method CcPlayoutHistoryQuery rightJoinCcPlayoutHistoryMetaData($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistoryMetaData relation
* @method CcPlayoutHistoryQuery innerJoinCcPlayoutHistoryMetaData($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistoryMetaData relation
*
* @method CcPlayoutHistory findOne(PropelPDO $con = null) Return the first CcPlayoutHistory matching the query
* @method CcPlayoutHistory findOneOrCreate(PropelPDO $con = null) Return the first CcPlayoutHistory matching the query, or a new CcPlayoutHistory object populated from the query conditions when no match is found
*
* @method CcPlayoutHistory findOneByDbId(int $id) Return the first CcPlayoutHistory filtered by the id column
* @method CcPlayoutHistory findOneByDbFileId(int $file_id) Return the first CcPlayoutHistory filtered by the file_id column
* @method CcPlayoutHistory findOneByDbStarts(string $starts) Return the first CcPlayoutHistory filtered by the starts column
* @method CcPlayoutHistory findOneByDbEnds(string $ends) Return the first CcPlayoutHistory filtered by the ends column
* @method CcPlayoutHistory findOneByDbInstanceId(int $instance_id) Return the first CcPlayoutHistory filtered by the instance_id column
*
* @method array findByDbId(int $id) Return CcPlayoutHistory objects filtered by the id column
* @method array findByDbFileId(int $file_id) Return CcPlayoutHistory objects filtered by the file_id column
* @method array findByDbStarts(string $starts) Return CcPlayoutHistory objects filtered by the starts column
* @method array findByDbEnds(string $ends) Return CcPlayoutHistory objects filtered by the ends column
* @method array findByDbInstanceId(int $instance_id) Return CcPlayoutHistory objects filtered by the instance_id column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcPlayoutHistoryQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'airtime', $modelName = 'CcPlayoutHistory', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CcPlayoutHistoryQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return CcPlayoutHistoryQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CcPlayoutHistoryQuery) {
return $criteria;
}
$query = new CcPlayoutHistoryQuery();
if (null !== $modelAlias) {
$query->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
* <code>
* $obj = $c->findPk(12, $con);
* </code>
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con an optional connection object
*
* @return CcPlayoutHistory|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcPlayoutHistoryPeer::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
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @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 CcPlayoutHistoryQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcPlayoutHistoryPeer::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 CcPlayoutHistoryQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcPlayoutHistoryPeer::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 CcPlayoutHistoryQuery 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(CcPlayoutHistoryPeer::ID, $dbId, $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 CcPlayoutHistoryQuery 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(CcPlayoutHistoryPeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbFileId['max'])) {
$this->addUsingAlias(CcPlayoutHistoryPeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlayoutHistoryPeer::FILE_ID, $dbFileId, $comparison);
}
/**
* Filter the query on the starts column
*
* @param string|array $dbStarts 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 CcPlayoutHistoryQuery The current query, for fluid interface
*/
public function filterByDbStarts($dbStarts = null, $comparison = null)
{
if (is_array($dbStarts)) {
$useMinMax = false;
if (isset($dbStarts['min'])) {
$this->addUsingAlias(CcPlayoutHistoryPeer::STARTS, $dbStarts['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbStarts['max'])) {
$this->addUsingAlias(CcPlayoutHistoryPeer::STARTS, $dbStarts['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlayoutHistoryPeer::STARTS, $dbStarts, $comparison);
}
/**
* Filter the query on the ends column
*
* @param string|array $dbEnds 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 CcPlayoutHistoryQuery The current query, for fluid interface
*/
public function filterByDbEnds($dbEnds = null, $comparison = null)
{
if (is_array($dbEnds)) {
$useMinMax = false;
if (isset($dbEnds['min'])) {
$this->addUsingAlias(CcPlayoutHistoryPeer::ENDS, $dbEnds['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbEnds['max'])) {
$this->addUsingAlias(CcPlayoutHistoryPeer::ENDS, $dbEnds['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlayoutHistoryPeer::ENDS, $dbEnds, $comparison);
}
/**
* Filter the query on the instance_id column
*
* @param int|array $dbInstanceId 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 CcPlayoutHistoryQuery The current query, for fluid interface
*/
public function filterByDbInstanceId($dbInstanceId = null, $comparison = null)
{
if (is_array($dbInstanceId)) {
$useMinMax = false;
if (isset($dbInstanceId['min'])) {
$this->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbInstanceId['max'])) {
$this->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId, $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 CcPlayoutHistoryQuery The current query, for fluid interface
*/
public function filterByCcFiles($ccFiles, $comparison = null)
{
return $this
->addUsingAlias(CcPlayoutHistoryPeer::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 CcPlayoutHistoryQuery 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 CcShowInstances object
*
* @param CcShowInstances $ccShowInstances the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlayoutHistoryQuery The current query, for fluid interface
*/
public function filterByCcShowInstances($ccShowInstances, $comparison = null)
{
return $this
->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $ccShowInstances->getDbId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcShowInstances relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcPlayoutHistoryQuery The current query, for fluid interface
*/
public function joinCcShowInstances($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcShowInstances');
// 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, 'CcShowInstances');
}
return $this;
}
/**
* Use the CcShowInstances relation CcShowInstances 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 CcShowInstancesQuery A secondary query class using the current class as primary query
*/
public function useCcShowInstancesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcShowInstances($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery');
}
/**
* Filter the query by a related CcPlayoutHistoryMetaData object
*
* @param CcPlayoutHistoryMetaData $ccPlayoutHistoryMetaData the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlayoutHistoryQuery The current query, for fluid interface
*/
public function filterByCcPlayoutHistoryMetaData($ccPlayoutHistoryMetaData, $comparison = null)
{
return $this
->addUsingAlias(CcPlayoutHistoryPeer::ID, $ccPlayoutHistoryMetaData->getDbHistoryId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcPlayoutHistoryMetaData relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcPlayoutHistoryQuery The current query, for fluid interface
*/
public function joinCcPlayoutHistoryMetaData($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcPlayoutHistoryMetaData');
// 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, 'CcPlayoutHistoryMetaData');
}
return $this;
}
/**
* Use the CcPlayoutHistoryMetaData relation CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaDataQuery A secondary query class using the current class as primary query
*/
public function useCcPlayoutHistoryMetaDataQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcPlayoutHistoryMetaData($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaDataQuery');
}
/**
* Exclude object from result
*
* @param CcPlayoutHistory $ccPlayoutHistory Object to remove from the list of results
*
* @return CcPlayoutHistoryQuery The current query, for fluid interface
*/
public function prune($ccPlayoutHistory = null)
{
if ($ccPlayoutHistory) {
$this->addUsingAlias(CcPlayoutHistoryPeer::ID, $ccPlayoutHistory->getDbId(), Criteria::NOT_EQUAL);
}
return $this;
}
} // BaseCcPlayoutHistoryQuery

View file

@ -1,916 +0,0 @@
<?php
/**
* Base class that represents a row from the 'cc_playout_history_template' table.
*
*
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persistent
{
/**
* Peer class name
*/
const PEER = 'CcPlayoutHistoryTemplatePeer';
/**
* The Peer class.
* Instance provides a convenient way of calling static methods on a class
* that calling code may not be able to identify.
* @var CcPlayoutHistoryTemplatePeer
*/
protected static $peer;
/**
* The value for the id field.
* @var int
*/
protected $id;
/**
* The value for the name field.
* @var string
*/
protected $name;
/**
* The value for the type field.
* @var string
*/
protected $type;
/**
* @var array CcPlayoutHistoryTemplateField[] Collection to store aggregation of CcPlayoutHistoryTemplateField objects.
*/
protected $collCcPlayoutHistoryTemplateFields;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInSave = false;
/**
* Flag to prevent endless validation loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInValidation = false;
/**
* 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 [type] column value.
*
* @return string
*/
public function getDbType()
{
return $this->type;
}
/**
* Set the value of [id] column.
*
* @param int $v new value
* @return CcPlayoutHistoryTemplate 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[] = CcPlayoutHistoryTemplatePeer::ID;
}
return $this;
} // setDbId()
/**
* Set the value of [name] column.
*
* @param string $v new value
* @return CcPlayoutHistoryTemplate The current object (for fluent API support)
*/
public function setDbName($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->name !== $v) {
$this->name = $v;
$this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::NAME;
}
return $this;
} // setDbName()
/**
* Set the value of [type] column.
*
* @param string $v new value
* @return CcPlayoutHistoryTemplate The current object (for fluent API support)
*/
public function setDbType($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->type !== $v) {
$this->type = $v;
$this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::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()
{
// 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->type = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->resetModified();
$this->setNew(false);
if ($rehydrate) {
$this->ensureConsistency();
}
return $startcol + 3; // 3 = CcPlayoutHistoryTemplatePeer::NUM_COLUMNS - CcPlayoutHistoryTemplatePeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcPlayoutHistoryTemplate 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()
{
} // 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(CcPlayoutHistoryTemplatePeer::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 = CcPlayoutHistoryTemplatePeer::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->collCcPlayoutHistoryTemplateFields = 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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$con->beginTransaction();
try {
$ret = $this->preDelete($con);
if ($ret) {
CcPlayoutHistoryTemplateQuery::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(CcPlayoutHistoryTemplatePeer::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);
CcPlayoutHistoryTemplatePeer::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;
if ($this->isNew() ) {
$this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplatePeer::ID.')');
}
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows = 1;
$this->setDbId($pk); //[IMV] update autoincrement primary key
$this->setNew(false);
} else {
$affectedRows = CcPlayoutHistoryTemplatePeer::doUpdate($this, $con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
}
if ($this->collCcPlayoutHistoryTemplateFields !== null) {
foreach ($this->collCcPlayoutHistoryTemplateFields 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 <code>true</code> is returned; otherwise
* an aggreagated array of ValidationFailed objects will be returned.
*
* @param array $columns Array of column names to validate.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
*/
protected function doValidate($columns = null)
{
if (!$this->alreadyInValidation) {
$this->alreadyInValidation = true;
$retval = null;
$failureMap = array();
if (($retval = CcPlayoutHistoryTemplatePeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval);
}
if ($this->collCcPlayoutHistoryTemplateFields !== null) {
foreach ($this->collCcPlayoutHistoryTemplateFields 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 = CcPlayoutHistoryTemplatePeer::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->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.
*
* @return array an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
{
$keys = CcPlayoutHistoryTemplatePeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getDbId(),
$keys[1] => $this->getDbName(),
$keys[2] => $this->getDbType(),
);
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 = CcPlayoutHistoryTemplatePeer::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->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 = CcPlayoutHistoryTemplatePeer::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->setDbType($arr[$keys[2]]);
}
/**
* 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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::ID)) $criteria->add(CcPlayoutHistoryTemplatePeer::ID, $this->id);
if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::NAME)) $criteria->add(CcPlayoutHistoryTemplatePeer::NAME, $this->name);
if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::TYPE)) $criteria->add(CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
$criteria->add(CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplate (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->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->getCcPlayoutHistoryTemplateFields() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCcPlayoutHistoryTemplateField($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 CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplatePeer
*/
public function getPeer()
{
if (self::$peer === null) {
self::$peer = new CcPlayoutHistoryTemplatePeer();
}
return self::$peer;
}
/**
* Clears out the collCcPlayoutHistoryTemplateFields 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 addCcPlayoutHistoryTemplateFields()
*/
public function clearCcPlayoutHistoryTemplateFields()
{
$this->collCcPlayoutHistoryTemplateFields = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Initializes the collCcPlayoutHistoryTemplateFields collection.
*
* By default this just sets the collCcPlayoutHistoryTemplateFields collection to an empty array (like clearcollCcPlayoutHistoryTemplateFields());
* 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 initCcPlayoutHistoryTemplateFields()
{
$this->collCcPlayoutHistoryTemplateFields = new PropelObjectCollection();
$this->collCcPlayoutHistoryTemplateFields->setModel('CcPlayoutHistoryTemplateField');
}
/**
* Gets an array of CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplateField[] List of CcPlayoutHistoryTemplateField objects
* @throws PropelException
*/
public function getCcPlayoutHistoryTemplateFields($criteria = null, PropelPDO $con = null)
{
if(null === $this->collCcPlayoutHistoryTemplateFields || null !== $criteria) {
if ($this->isNew() && null === $this->collCcPlayoutHistoryTemplateFields) {
// return empty collection
$this->initCcPlayoutHistoryTemplateFields();
} else {
$collCcPlayoutHistoryTemplateFields = CcPlayoutHistoryTemplateFieldQuery::create(null, $criteria)
->filterByCcPlayoutHistoryTemplate($this)
->find($con);
if (null !== $criteria) {
return $collCcPlayoutHistoryTemplateFields;
}
$this->collCcPlayoutHistoryTemplateFields = $collCcPlayoutHistoryTemplateFields;
}
}
return $this->collCcPlayoutHistoryTemplateFields;
}
/**
* Returns the number of related CcPlayoutHistoryTemplateField objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
* @return int Count of related CcPlayoutHistoryTemplateField objects.
* @throws PropelException
*/
public function countCcPlayoutHistoryTemplateFields(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
if(null === $this->collCcPlayoutHistoryTemplateFields || null !== $criteria) {
if ($this->isNew() && null === $this->collCcPlayoutHistoryTemplateFields) {
return 0;
} else {
$query = CcPlayoutHistoryTemplateFieldQuery::create(null, $criteria);
if($distinct) {
$query->distinct();
}
return $query
->filterByCcPlayoutHistoryTemplate($this)
->count($con);
}
} else {
return count($this->collCcPlayoutHistoryTemplateFields);
}
}
/**
* Method called to associate a CcPlayoutHistoryTemplateField object to this object
* through the CcPlayoutHistoryTemplateField foreign key attribute.
*
* @param CcPlayoutHistoryTemplateField $l CcPlayoutHistoryTemplateField
* @return void
* @throws PropelException
*/
public function addCcPlayoutHistoryTemplateField(CcPlayoutHistoryTemplateField $l)
{
if ($this->collCcPlayoutHistoryTemplateFields === null) {
$this->initCcPlayoutHistoryTemplateFields();
}
if (!$this->collCcPlayoutHistoryTemplateFields->contains($l)) { // only add it if the **same** object is not already associated
$this->collCcPlayoutHistoryTemplateFields[]= $l;
$l->setCcPlayoutHistoryTemplate($this);
}
}
/**
* Clears the current object and sets all attributes to their default values
*/
public function clear()
{
$this->id = null;
$this->name = null;
$this->type = 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 ($this->collCcPlayoutHistoryTemplateFields) {
foreach ((array) $this->collCcPlayoutHistoryTemplateFields as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep)
$this->collCcPlayoutHistoryTemplateFields = 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);
}
} // BaseCcPlayoutHistoryTemplate

View file

@ -1,998 +0,0 @@
<?php
/**
* Base static class for performing query and update operations on the 'cc_playout_history_template_field' table.
*
*
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryTemplateFieldPeer {
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
/** the table name for this class */
const TABLE_NAME = 'cc_playout_history_template_field';
/** the related Propel class for this table */
const OM_CLASS = 'CcPlayoutHistoryTemplateField';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcPlayoutHistoryTemplateField';
/** the related TableMap class for this table */
const TM_CLASS = 'CcPlayoutHistoryTemplateFieldTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 7;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_playout_history_template_field.ID';
/** the column name for the TEMPLATE_ID field */
const TEMPLATE_ID = 'cc_playout_history_template_field.TEMPLATE_ID';
/** the column name for the NAME field */
const NAME = 'cc_playout_history_template_field.NAME';
/** the column name for the LABEL field */
const LABEL = 'cc_playout_history_template_field.LABEL';
/** the column name for the TYPE field */
const TYPE = 'cc_playout_history_template_field.TYPE';
/** the column name for the IS_FILE_MD field */
const IS_FILE_MD = 'cc_playout_history_template_field.IS_FILE_MD';
/** the column name for the POSITION field */
const POSITION = 'cc_playout_history_template_field.POSITION';
/**
* An identiy map to hold any loaded instances of CcPlayoutHistoryTemplateField objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcPlayoutHistoryTemplateField[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTemplateId', 'DbName', 'DbLabel', 'DbType', 'DbIsFileMD', 'DbPosition', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTemplateId', 'dbName', 'dbLabel', 'dbType', 'dbIsFileMD', 'dbPosition', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::TEMPLATE_ID, self::NAME, self::LABEL, self::TYPE, self::IS_FILE_MD, self::POSITION, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TEMPLATE_ID', 'NAME', 'LABEL', 'TYPE', 'IS_FILE_MD', 'POSITION', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'template_id', 'name', 'label', 'type', 'is_file_md', 'position', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
);
/**
* 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, 'DbTemplateId' => 1, 'DbName' => 2, 'DbLabel' => 3, 'DbType' => 4, 'DbIsFileMD' => 5, 'DbPosition' => 6, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTemplateId' => 1, 'dbName' => 2, 'dbLabel' => 3, 'dbType' => 4, 'dbIsFileMD' => 5, 'dbPosition' => 6, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TEMPLATE_ID => 1, self::NAME => 2, self::LABEL => 3, self::TYPE => 4, self::IS_FILE_MD => 5, self::POSITION => 6, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TEMPLATE_ID' => 1, 'NAME' => 2, 'LABEL' => 3, 'TYPE' => 4, 'IS_FILE_MD' => 5, 'POSITION' => 6, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'template_id' => 1, 'name' => 2, 'label' => 3, 'type' => 4, 'is_file_md' => 5, 'position' => 6, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
);
/**
* 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.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. CcPlayoutHistoryTemplateFieldPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::ID);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::NAME);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::LABEL);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::TYPE);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::POSITION);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.TEMPLATE_ID');
$criteria->addSelectColumn($alias . '.NAME');
$criteria->addSelectColumn($alias . '.LABEL');
$criteria->addSelectColumn($alias . '.TYPE');
$criteria->addSelectColumn($alias . '.IS_FILE_MD');
$criteria->addSelectColumn($alias . '.POSITION');
}
}
/**
* 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(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::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 CcPlayoutHistoryTemplateField
* @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 = CcPlayoutHistoryTemplateFieldPeer::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 CcPlayoutHistoryTemplateFieldPeer::populateObjects(CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
CcPlayoutHistoryTemplateFieldPeer::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 CcPlayoutHistoryTemplateField $value A CcPlayoutHistoryTemplateField object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcPlayoutHistoryTemplateField $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 CcPlayoutHistoryTemplateField object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof CcPlayoutHistoryTemplateField) {
$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 CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplateField 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_playout_history_template_field
* 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 = CcPlayoutHistoryTemplateFieldPeer::getOMClass(false);
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::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;
CcPlayoutHistoryTemplateFieldPeer::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 (CcPlayoutHistoryTemplateField object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::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 + CcPlayoutHistoryTemplateFieldPeer::NUM_COLUMNS;
} else {
$cls = CcPlayoutHistoryTemplateFieldPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the number of rows matching criteria, joining the related CcPlayoutHistoryTemplate 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 doCountJoinCcPlayoutHistoryTemplate(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(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplateField objects pre-filled with their CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplateField objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinCcPlayoutHistoryTemplate(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);
}
CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
$startcol = (CcPlayoutHistoryTemplateFieldPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateFieldPeer::NUM_LAZY_LOAD_COLUMNS);
CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
$criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcPlayoutHistoryTemplateFieldPeer::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 = CcPlayoutHistoryTemplateFieldPeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($obj1, $key1);
} // if $obj1 already loaded
$key2 = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol);
if ($key2 !== null) {
$obj2 = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcPlayoutHistoryTemplatePeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj2, $key2);
} // if obj2 already loaded
// Add the $obj1 (CcPlayoutHistoryTemplateField) to $obj2 (CcPlayoutHistoryTemplate)
$obj2->addCcPlayoutHistoryTemplateField($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(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplateField 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);
}
CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
$startcol2 = (CcPlayoutHistoryTemplateFieldPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateFieldPeer::NUM_LAZY_LOAD_COLUMNS);
CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcPlayoutHistoryTemplatePeer::NUM_COLUMNS - CcPlayoutHistoryTemplatePeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcPlayoutHistoryTemplateFieldPeer::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 = CcPlayoutHistoryTemplateFieldPeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded
// Add objects for joined CcPlayoutHistoryTemplate rows
$key2 = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcPlayoutHistoryTemplatePeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj2, $key2);
} // if obj2 loaded
// Add the $obj1 (CcPlayoutHistoryTemplateField) to the collection in $obj2 (CcPlayoutHistoryTemplate)
$obj2->addCcPlayoutHistoryTemplateField($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(BaseCcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcPlayoutHistoryTemplateFieldPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcPlayoutHistoryTemplateFieldTableMap());
}
}
/**
* 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 ? CcPlayoutHistoryTemplateFieldPeer::CLASS_DEFAULT : CcPlayoutHistoryTemplateFieldPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcPlayoutHistoryTemplateField or Criteria object.
*
* @param mixed $values Criteria or CcPlayoutHistoryTemplateField 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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistoryTemplateField object
}
if ($criteria->containsKey(CcPlayoutHistoryTemplateFieldPeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryTemplateFieldPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplateFieldPeer::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 CcPlayoutHistoryTemplateField or Criteria object.
*
* @param mixed $values Criteria or CcPlayoutHistoryTemplateField 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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(CcPlayoutHistoryTemplateFieldPeer::ID);
$value = $criteria->remove(CcPlayoutHistoryTemplateFieldPeer::ID);
if ($value) {
$selectCriteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
}
} else { // $values is CcPlayoutHistoryTemplateField 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_playout_history_template_field 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(CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME, $con, CcPlayoutHistoryTemplateFieldPeer::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).
CcPlayoutHistoryTemplateFieldPeer::clearInstancePool();
CcPlayoutHistoryTemplateFieldPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcPlayoutHistoryTemplateField or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcPlayoutHistoryTemplateField 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(CcPlayoutHistoryTemplateFieldPeer::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.
CcPlayoutHistoryTemplateFieldPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof CcPlayoutHistoryTemplateField) { // it's a model object
// invalidate the cache for this single object
CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
CcPlayoutHistoryTemplateFieldPeer::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);
CcPlayoutHistoryTemplateFieldPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplateField $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(CcPlayoutHistoryTemplateField $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return CcPlayoutHistoryTemplateField
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
$criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $pk);
$v = CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
$criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $pks, Criteria::IN);
$objs = CcPlayoutHistoryTemplateFieldPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseCcPlayoutHistoryTemplateFieldPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseCcPlayoutHistoryTemplateFieldPeer::buildTableMap();

View file

@ -1,402 +0,0 @@
<?php
/**
* Base class that represents a query for the 'cc_playout_history_template_field' table.
*
*
*
* @method CcPlayoutHistoryTemplateFieldQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcPlayoutHistoryTemplateFieldQuery orderByDbTemplateId($order = Criteria::ASC) Order by the template_id column
* @method CcPlayoutHistoryTemplateFieldQuery orderByDbName($order = Criteria::ASC) Order by the name column
* @method CcPlayoutHistoryTemplateFieldQuery orderByDbLabel($order = Criteria::ASC) Order by the label column
* @method CcPlayoutHistoryTemplateFieldQuery orderByDbType($order = Criteria::ASC) Order by the type column
* @method CcPlayoutHistoryTemplateFieldQuery orderByDbIsFileMD($order = Criteria::ASC) Order by the is_file_md column
* @method CcPlayoutHistoryTemplateFieldQuery orderByDbPosition($order = Criteria::ASC) Order by the position column
*
* @method CcPlayoutHistoryTemplateFieldQuery groupByDbId() Group by the id column
* @method CcPlayoutHistoryTemplateFieldQuery groupByDbTemplateId() Group by the template_id column
* @method CcPlayoutHistoryTemplateFieldQuery groupByDbName() Group by the name column
* @method CcPlayoutHistoryTemplateFieldQuery groupByDbLabel() Group by the label column
* @method CcPlayoutHistoryTemplateFieldQuery groupByDbType() Group by the type column
* @method CcPlayoutHistoryTemplateFieldQuery groupByDbIsFileMD() Group by the is_file_md column
* @method CcPlayoutHistoryTemplateFieldQuery groupByDbPosition() Group by the position column
*
* @method CcPlayoutHistoryTemplateFieldQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcPlayoutHistoryTemplateFieldQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcPlayoutHistoryTemplateFieldQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcPlayoutHistoryTemplateFieldQuery leftJoinCcPlayoutHistoryTemplate($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistoryTemplate relation
* @method CcPlayoutHistoryTemplateFieldQuery rightJoinCcPlayoutHistoryTemplate($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistoryTemplate relation
* @method CcPlayoutHistoryTemplateFieldQuery innerJoinCcPlayoutHistoryTemplate($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistoryTemplate relation
*
* @method CcPlayoutHistoryTemplateField findOne(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplateField matching the query
* @method CcPlayoutHistoryTemplateField findOneOrCreate(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplateField matching the query, or a new CcPlayoutHistoryTemplateField object populated from the query conditions when no match is found
*
* @method CcPlayoutHistoryTemplateField findOneByDbId(int $id) Return the first CcPlayoutHistoryTemplateField filtered by the id column
* @method CcPlayoutHistoryTemplateField findOneByDbTemplateId(int $template_id) Return the first CcPlayoutHistoryTemplateField filtered by the template_id column
* @method CcPlayoutHistoryTemplateField findOneByDbName(string $name) Return the first CcPlayoutHistoryTemplateField filtered by the name column
* @method CcPlayoutHistoryTemplateField findOneByDbLabel(string $label) Return the first CcPlayoutHistoryTemplateField filtered by the label column
* @method CcPlayoutHistoryTemplateField findOneByDbType(string $type) Return the first CcPlayoutHistoryTemplateField filtered by the type column
* @method CcPlayoutHistoryTemplateField findOneByDbIsFileMD(boolean $is_file_md) Return the first CcPlayoutHistoryTemplateField filtered by the is_file_md column
* @method CcPlayoutHistoryTemplateField findOneByDbPosition(int $position) Return the first CcPlayoutHistoryTemplateField filtered by the position column
*
* @method array findByDbId(int $id) Return CcPlayoutHistoryTemplateField objects filtered by the id column
* @method array findByDbTemplateId(int $template_id) Return CcPlayoutHistoryTemplateField objects filtered by the template_id column
* @method array findByDbName(string $name) Return CcPlayoutHistoryTemplateField objects filtered by the name column
* @method array findByDbLabel(string $label) Return CcPlayoutHistoryTemplateField objects filtered by the label column
* @method array findByDbType(string $type) Return CcPlayoutHistoryTemplateField objects filtered by the type column
* @method array findByDbIsFileMD(boolean $is_file_md) Return CcPlayoutHistoryTemplateField objects filtered by the is_file_md column
* @method array findByDbPosition(int $position) Return CcPlayoutHistoryTemplateField objects filtered by the position column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryTemplateFieldQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcPlayoutHistoryTemplateFieldQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'airtime', $modelName = 'CcPlayoutHistoryTemplateField', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CcPlayoutHistoryTemplateFieldQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return CcPlayoutHistoryTemplateFieldQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CcPlayoutHistoryTemplateFieldQuery) {
return $criteria;
}
$query = new CcPlayoutHistoryTemplateFieldQuery();
if (null !== $modelAlias) {
$query->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
* <code>
* $obj = $c->findPk(12, $con);
* </code>
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con an optional connection object
*
* @return CcPlayoutHistoryTemplateField|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::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
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @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 CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::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 CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::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 CcPlayoutHistoryTemplateFieldQuery 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(CcPlayoutHistoryTemplateFieldPeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the template_id column
*
* @param int|array $dbTemplateId 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 CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
*/
public function filterByDbTemplateId($dbTemplateId = null, $comparison = null)
{
if (is_array($dbTemplateId)) {
$useMinMax = false;
if (isset($dbTemplateId['min'])) {
$this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $dbTemplateId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbTemplateId['max'])) {
$this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $dbTemplateId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $dbTemplateId, $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 CcPlayoutHistoryTemplateFieldQuery 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(CcPlayoutHistoryTemplateFieldPeer::NAME, $dbName, $comparison);
}
/**
* Filter the query on the label column
*
* @param string $dbLabel 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 CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
*/
public function filterByDbLabel($dbLabel = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($dbLabel)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbLabel)) {
$dbLabel = str_replace('*', '%', $dbLabel);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::LABEL, $dbLabel, $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 CcPlayoutHistoryTemplateFieldQuery 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(CcPlayoutHistoryTemplateFieldPeer::TYPE, $dbType, $comparison);
}
/**
* Filter the query on the is_file_md column
*
* @param boolean|string $dbIsFileMD The value to use as filter.
* Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
*/
public function filterByDbIsFileMD($dbIsFileMD = null, $comparison = null)
{
if (is_string($dbIsFileMD)) {
$is_file_md = in_array(strtolower($dbIsFileMD), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
}
return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD, $dbIsFileMD, $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 CcPlayoutHistoryTemplateFieldQuery 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(CcPlayoutHistoryTemplateFieldPeer::POSITION, $dbPosition['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbPosition['max'])) {
$this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::POSITION, $dbPosition['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::POSITION, $dbPosition, $comparison);
}
/**
* Filter the query by a related CcPlayoutHistoryTemplate object
*
* @param CcPlayoutHistoryTemplate $ccPlayoutHistoryTemplate the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
*/
public function filterByCcPlayoutHistoryTemplate($ccPlayoutHistoryTemplate, $comparison = null)
{
return $this
->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $ccPlayoutHistoryTemplate->getDbId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcPlayoutHistoryTemplate relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
*/
public function joinCcPlayoutHistoryTemplate($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcPlayoutHistoryTemplate');
// 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, 'CcPlayoutHistoryTemplate');
}
return $this;
}
/**
* Use the CcPlayoutHistoryTemplate relation CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplateQuery A secondary query class using the current class as primary query
*/
public function useCcPlayoutHistoryTemplateQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcPlayoutHistoryTemplate($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryTemplate', 'CcPlayoutHistoryTemplateQuery');
}
/**
* Exclude object from result
*
* @param CcPlayoutHistoryTemplateField $ccPlayoutHistoryTemplateField Object to remove from the list of results
*
* @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
*/
public function prune($ccPlayoutHistoryTemplateField = null)
{
if ($ccPlayoutHistoryTemplateField) {
$this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::ID, $ccPlayoutHistoryTemplateField->getDbId(), Criteria::NOT_EQUAL);
}
return $this;
}
} // BaseCcPlayoutHistoryTemplateFieldQuery

View file

@ -1,747 +0,0 @@
<?php
/**
* Base static class for performing query and update operations on the 'cc_playout_history_template' table.
*
*
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryTemplatePeer {
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
/** the table name for this class */
const TABLE_NAME = 'cc_playout_history_template';
/** the related Propel class for this table */
const OM_CLASS = 'CcPlayoutHistoryTemplate';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcPlayoutHistoryTemplate';
/** the related TableMap class for this table */
const TM_CLASS = 'CcPlayoutHistoryTemplateTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 3;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_playout_history_template.ID';
/** the column name for the NAME field */
const NAME = 'cc_playout_history_template.NAME';
/** the column name for the TYPE field */
const TYPE = 'cc_playout_history_template.TYPE';
/**
* An identiy map to hold any loaded instances of CcPlayoutHistoryTemplate objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcPlayoutHistoryTemplate[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbType', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbType', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::TYPE, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'TYPE', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'type', ),
BasePeer::TYPE_NUM => array (0, 1, 2, )
);
/**
* 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, 'DbType' => 2, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbType' => 2, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::TYPE => 2, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'TYPE' => 2, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'type' => 2, ),
BasePeer::TYPE_NUM => array (0, 1, 2, )
);
/**
* 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.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. CcPlayoutHistoryTemplatePeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::ID);
$criteria->addSelectColumn(CcPlayoutHistoryTemplatePeer::NAME);
$criteria->addSelectColumn(CcPlayoutHistoryTemplatePeer::TYPE);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.NAME');
$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(CcPlayoutHistoryTemplatePeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplate
* @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 = CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplatePeer::populateObjects(CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplate $value A CcPlayoutHistoryTemplate object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcPlayoutHistoryTemplate $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 CcPlayoutHistoryTemplate object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof CcPlayoutHistoryTemplate) {
$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 CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplate 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_playout_history_template
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in CcPlayoutHistoryTemplateFieldPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcPlayoutHistoryTemplateFieldPeer::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 = CcPlayoutHistoryTemplatePeer::getOMClass(false);
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = CcPlayoutHistoryTemplatePeer::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;
CcPlayoutHistoryTemplatePeer::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 (CcPlayoutHistoryTemplate object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = CcPlayoutHistoryTemplatePeer::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 + CcPlayoutHistoryTemplatePeer::NUM_COLUMNS;
} else {
$cls = CcPlayoutHistoryTemplatePeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* 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(BaseCcPlayoutHistoryTemplatePeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcPlayoutHistoryTemplatePeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcPlayoutHistoryTemplateTableMap());
}
}
/**
* 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 ? CcPlayoutHistoryTemplatePeer::CLASS_DEFAULT : CcPlayoutHistoryTemplatePeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcPlayoutHistoryTemplate or Criteria object.
*
* @param mixed $values Criteria or CcPlayoutHistoryTemplate 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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistoryTemplate object
}
if ($criteria->containsKey(CcPlayoutHistoryTemplatePeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryTemplatePeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplate or Criteria object.
*
* @param mixed $values Criteria or CcPlayoutHistoryTemplate 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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(CcPlayoutHistoryTemplatePeer::ID);
$value = $criteria->remove(CcPlayoutHistoryTemplatePeer::ID);
if ($value) {
$selectCriteria->add(CcPlayoutHistoryTemplatePeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(CcPlayoutHistoryTemplatePeer::TABLE_NAME);
}
} else { // $values is CcPlayoutHistoryTemplate 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_playout_history_template 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(CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::TABLE_NAME, $con, CcPlayoutHistoryTemplatePeer::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).
CcPlayoutHistoryTemplatePeer::clearInstancePool();
CcPlayoutHistoryTemplatePeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcPlayoutHistoryTemplate or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcPlayoutHistoryTemplate 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(CcPlayoutHistoryTemplatePeer::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.
CcPlayoutHistoryTemplatePeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof CcPlayoutHistoryTemplate) { // it's a model object
// invalidate the cache for this single object
CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
CcPlayoutHistoryTemplatePeer::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);
CcPlayoutHistoryTemplatePeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplate $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(CcPlayoutHistoryTemplate $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, CcPlayoutHistoryTemplatePeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return CcPlayoutHistoryTemplate
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = CcPlayoutHistoryTemplatePeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
$criteria->add(CcPlayoutHistoryTemplatePeer::ID, $pk);
$v = CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
$criteria->add(CcPlayoutHistoryTemplatePeer::ID, $pks, Criteria::IN);
$objs = CcPlayoutHistoryTemplatePeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseCcPlayoutHistoryTemplatePeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseCcPlayoutHistoryTemplatePeer::buildTableMap();

View file

@ -1,285 +0,0 @@
<?php
/**
* Base class that represents a query for the 'cc_playout_history_template' table.
*
*
*
* @method CcPlayoutHistoryTemplateQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcPlayoutHistoryTemplateQuery orderByDbName($order = Criteria::ASC) Order by the name column
* @method CcPlayoutHistoryTemplateQuery orderByDbType($order = Criteria::ASC) Order by the type column
*
* @method CcPlayoutHistoryTemplateQuery groupByDbId() Group by the id column
* @method CcPlayoutHistoryTemplateQuery groupByDbName() Group by the name column
* @method CcPlayoutHistoryTemplateQuery groupByDbType() Group by the type column
*
* @method CcPlayoutHistoryTemplateQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcPlayoutHistoryTemplateQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcPlayoutHistoryTemplateQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcPlayoutHistoryTemplateQuery leftJoinCcPlayoutHistoryTemplateField($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistoryTemplateField relation
* @method CcPlayoutHistoryTemplateQuery rightJoinCcPlayoutHistoryTemplateField($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistoryTemplateField relation
* @method CcPlayoutHistoryTemplateQuery innerJoinCcPlayoutHistoryTemplateField($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistoryTemplateField relation
*
* @method CcPlayoutHistoryTemplate findOne(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplate matching the query
* @method CcPlayoutHistoryTemplate findOneOrCreate(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplate matching the query, or a new CcPlayoutHistoryTemplate object populated from the query conditions when no match is found
*
* @method CcPlayoutHistoryTemplate findOneByDbId(int $id) Return the first CcPlayoutHistoryTemplate filtered by the id column
* @method CcPlayoutHistoryTemplate findOneByDbName(string $name) Return the first CcPlayoutHistoryTemplate filtered by the name column
* @method CcPlayoutHistoryTemplate findOneByDbType(string $type) Return the first CcPlayoutHistoryTemplate filtered by the type column
*
* @method array findByDbId(int $id) Return CcPlayoutHistoryTemplate objects filtered by the id column
* @method array findByDbName(string $name) Return CcPlayoutHistoryTemplate objects filtered by the name column
* @method array findByDbType(string $type) Return CcPlayoutHistoryTemplate objects filtered by the type column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryTemplateQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcPlayoutHistoryTemplateQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'airtime', $modelName = 'CcPlayoutHistoryTemplate', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CcPlayoutHistoryTemplateQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return CcPlayoutHistoryTemplateQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CcPlayoutHistoryTemplateQuery) {
return $criteria;
}
$query = new CcPlayoutHistoryTemplateQuery();
if (null !== $modelAlias) {
$query->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
* <code>
* $obj = $c->findPk(12, $con);
* </code>
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con an optional connection object
*
* @return CcPlayoutHistoryTemplate|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcPlayoutHistoryTemplatePeer::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
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @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 CcPlayoutHistoryTemplateQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplateQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplateQuery 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(CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplateQuery 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(CcPlayoutHistoryTemplatePeer::NAME, $dbName, $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 CcPlayoutHistoryTemplateQuery 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(CcPlayoutHistoryTemplatePeer::TYPE, $dbType, $comparison);
}
/**
* Filter the query by a related CcPlayoutHistoryTemplateField object
*
* @param CcPlayoutHistoryTemplateField $ccPlayoutHistoryTemplateField the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
*/
public function filterByCcPlayoutHistoryTemplateField($ccPlayoutHistoryTemplateField, $comparison = null)
{
return $this
->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $ccPlayoutHistoryTemplateField->getDbTemplateId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcPlayoutHistoryTemplateField relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
*/
public function joinCcPlayoutHistoryTemplateField($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcPlayoutHistoryTemplateField');
// 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, 'CcPlayoutHistoryTemplateField');
}
return $this;
}
/**
* Use the CcPlayoutHistoryTemplateField relation CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplateFieldQuery A secondary query class using the current class as primary query
*/
public function useCcPlayoutHistoryTemplateFieldQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcPlayoutHistoryTemplateField($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryTemplateField', 'CcPlayoutHistoryTemplateFieldQuery');
}
/**
* Exclude object from result
*
* @param CcPlayoutHistoryTemplate $ccPlayoutHistoryTemplate Object to remove from the list of results
*
* @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
*/
public function prune($ccPlayoutHistoryTemplate = null)
{
if ($ccPlayoutHistoryTemplate) {
$this->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $ccPlayoutHistoryTemplate->getDbId(), Criteria::NOT_EQUAL);
}
return $this;
}
} // BaseCcPlayoutHistoryTemplateQuery

View file

@ -1,993 +0,0 @@
<?php
/**
* Base static class for performing query and update operations on the 'cc_playout_history_template_field' table.
*
*
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryTemplateTagPeer {
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
/** the table name for this class */
const TABLE_NAME = 'cc_playout_history_template_field';
/** the related Propel class for this table */
const OM_CLASS = 'CcPlayoutHistoryTemplateTag';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcPlayoutHistoryTemplateTag';
/** the related TableMap class for this table */
const TM_CLASS = 'CcPlayoutHistoryTemplateTagTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 6;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_playout_history_template_field.ID';
/** the column name for the TEMPLATE_ID field */
const TEMPLATE_ID = 'cc_playout_history_template_field.TEMPLATE_ID';
/** the column name for the NAME field */
const NAME = 'cc_playout_history_template_field.NAME';
/** the column name for the TYPE field */
const TYPE = 'cc_playout_history_template_field.TYPE';
/** the column name for the IS_FILE_MD field */
const IS_FILE_MD = 'cc_playout_history_template_field.IS_FILE_MD';
/** the column name for the POSITION field */
const POSITION = 'cc_playout_history_template_field.POSITION';
/**
* An identiy map to hold any loaded instances of CcPlayoutHistoryTemplateTag objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcPlayoutHistoryTemplateTag[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTemplateId', 'DbName', 'DbType', 'DbIsFileMD', 'DbTagPosition', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTemplateId', 'dbName', 'dbType', 'dbIsFileMD', 'dbTagPosition', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::TEMPLATE_ID, self::NAME, self::TYPE, self::IS_FILE_MD, self::POSITION, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TEMPLATE_ID', 'NAME', 'TYPE', 'IS_FILE_MD', 'POSITION', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'template_id', 'name', 'type', 'is_file_md', 'position', ),
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, 'DbTemplateId' => 1, 'DbName' => 2, 'DbType' => 3, 'DbIsFileMD' => 4, 'DbTagPosition' => 5, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTemplateId' => 1, 'dbName' => 2, 'dbType' => 3, 'dbIsFileMD' => 4, 'dbTagPosition' => 5, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TEMPLATE_ID => 1, self::NAME => 2, self::TYPE => 3, self::IS_FILE_MD => 4, self::POSITION => 5, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TEMPLATE_ID' => 1, 'NAME' => 2, 'TYPE' => 3, 'IS_FILE_MD' => 4, 'POSITION' => 5, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'template_id' => 1, 'name' => 2, 'type' => 3, 'is_file_md' => 4, 'position' => 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.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. CcPlayoutHistoryTemplateTagPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(CcPlayoutHistoryTemplateTagPeer::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(CcPlayoutHistoryTemplateTagPeer::ID);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateTagPeer::NAME);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateTagPeer::TYPE);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateTagPeer::IS_FILE_MD);
$criteria->addSelectColumn(CcPlayoutHistoryTemplateTagPeer::POSITION);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.TEMPLATE_ID');
$criteria->addSelectColumn($alias . '.NAME');
$criteria->addSelectColumn($alias . '.TYPE');
$criteria->addSelectColumn($alias . '.IS_FILE_MD');
$criteria->addSelectColumn($alias . '.POSITION');
}
}
/**
* 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(CcPlayoutHistoryTemplateTagPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcPlayoutHistoryTemplateTagPeer::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(CcPlayoutHistoryTemplateTagPeer::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 CcPlayoutHistoryTemplateTag
* @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 = CcPlayoutHistoryTemplateTagPeer::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 CcPlayoutHistoryTemplateTagPeer::populateObjects(CcPlayoutHistoryTemplateTagPeer::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(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
CcPlayoutHistoryTemplateTagPeer::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 CcPlayoutHistoryTemplateTag $value A CcPlayoutHistoryTemplateTag object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcPlayoutHistoryTemplateTag $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 CcPlayoutHistoryTemplateTag object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof CcPlayoutHistoryTemplateTag) {
$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 CcPlayoutHistoryTemplateTag 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 CcPlayoutHistoryTemplateTag 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_playout_history_template_field
* 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 = CcPlayoutHistoryTemplateTagPeer::getOMClass(false);
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcPlayoutHistoryTemplateTagPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = CcPlayoutHistoryTemplateTagPeer::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;
CcPlayoutHistoryTemplateTagPeer::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 (CcPlayoutHistoryTemplateTag object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = CcPlayoutHistoryTemplateTagPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = CcPlayoutHistoryTemplateTagPeer::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 + CcPlayoutHistoryTemplateTagPeer::NUM_COLUMNS;
} else {
$cls = CcPlayoutHistoryTemplateTagPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcPlayoutHistoryTemplateTagPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the number of rows matching criteria, joining the related CcPlayoutHistoryTemplate 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 doCountJoinCcPlayoutHistoryTemplate(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(CcPlayoutHistoryTemplateTagPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcPlayoutHistoryTemplateTagPeer::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(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplateTag objects pre-filled with their CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplateTag objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinCcPlayoutHistoryTemplate(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);
}
CcPlayoutHistoryTemplateTagPeer::addSelectColumns($criteria);
$startcol = (CcPlayoutHistoryTemplateTagPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateTagPeer::NUM_LAZY_LOAD_COLUMNS);
CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
$criteria->addJoin(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcPlayoutHistoryTemplateTagPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcPlayoutHistoryTemplateTagPeer::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 = CcPlayoutHistoryTemplateTagPeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcPlayoutHistoryTemplateTagPeer::addInstanceToPool($obj1, $key1);
} // if $obj1 already loaded
$key2 = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol);
if ($key2 !== null) {
$obj2 = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcPlayoutHistoryTemplatePeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj2, $key2);
} // if obj2 already loaded
// Add the $obj1 (CcPlayoutHistoryTemplateTag) to $obj2 (CcPlayoutHistoryTemplate)
$obj2->addCcPlayoutHistoryTemplateTag($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(CcPlayoutHistoryTemplateTagPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcPlayoutHistoryTemplateTagPeer::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(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplateTag 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 CcPlayoutHistoryTemplateTag 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);
}
CcPlayoutHistoryTemplateTagPeer::addSelectColumns($criteria);
$startcol2 = (CcPlayoutHistoryTemplateTagPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateTagPeer::NUM_LAZY_LOAD_COLUMNS);
CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcPlayoutHistoryTemplatePeer::NUM_COLUMNS - CcPlayoutHistoryTemplatePeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcPlayoutHistoryTemplateTagPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcPlayoutHistoryTemplateTagPeer::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 = CcPlayoutHistoryTemplateTagPeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcPlayoutHistoryTemplateTagPeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded
// Add objects for joined CcPlayoutHistoryTemplate rows
$key2 = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcPlayoutHistoryTemplatePeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj2, $key2);
} // if obj2 loaded
// Add the $obj1 (CcPlayoutHistoryTemplateTag) to the collection in $obj2 (CcPlayoutHistoryTemplate)
$obj2->addCcPlayoutHistoryTemplateTag($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(BaseCcPlayoutHistoryTemplateTagPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcPlayoutHistoryTemplateTagPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcPlayoutHistoryTemplateTagTableMap());
}
}
/**
* 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 ? CcPlayoutHistoryTemplateTagPeer::CLASS_DEFAULT : CcPlayoutHistoryTemplateTagPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcPlayoutHistoryTemplateTag or Criteria object.
*
* @param mixed $values Criteria or CcPlayoutHistoryTemplateTag 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(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistoryTemplateTag object
}
if ($criteria->containsKey(CcPlayoutHistoryTemplateTagPeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryTemplateTagPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplateTagPeer::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 CcPlayoutHistoryTemplateTag or Criteria object.
*
* @param mixed $values Criteria or CcPlayoutHistoryTemplateTag 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(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(CcPlayoutHistoryTemplateTagPeer::ID);
$value = $criteria->remove(CcPlayoutHistoryTemplateTagPeer::ID);
if ($value) {
$selectCriteria->add(CcPlayoutHistoryTemplateTagPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(CcPlayoutHistoryTemplateTagPeer::TABLE_NAME);
}
} else { // $values is CcPlayoutHistoryTemplateTag 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_playout_history_template_field 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(CcPlayoutHistoryTemplateTagPeer::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(CcPlayoutHistoryTemplateTagPeer::TABLE_NAME, $con, CcPlayoutHistoryTemplateTagPeer::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).
CcPlayoutHistoryTemplateTagPeer::clearInstancePool();
CcPlayoutHistoryTemplateTagPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcPlayoutHistoryTemplateTag or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcPlayoutHistoryTemplateTag 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(CcPlayoutHistoryTemplateTagPeer::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.
CcPlayoutHistoryTemplateTagPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof CcPlayoutHistoryTemplateTag) { // it's a model object
// invalidate the cache for this single object
CcPlayoutHistoryTemplateTagPeer::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(CcPlayoutHistoryTemplateTagPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
CcPlayoutHistoryTemplateTagPeer::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);
CcPlayoutHistoryTemplateTagPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given CcPlayoutHistoryTemplateTag 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 CcPlayoutHistoryTemplateTag $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(CcPlayoutHistoryTemplateTag $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(CcPlayoutHistoryTemplateTagPeer::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(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, CcPlayoutHistoryTemplateTagPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return CcPlayoutHistoryTemplateTag
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = CcPlayoutHistoryTemplateTagPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME);
$criteria->add(CcPlayoutHistoryTemplateTagPeer::ID, $pk);
$v = CcPlayoutHistoryTemplateTagPeer::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(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME);
$criteria->add(CcPlayoutHistoryTemplateTagPeer::ID, $pks, Criteria::IN);
$objs = CcPlayoutHistoryTemplateTagPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseCcPlayoutHistoryTemplateTagPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseCcPlayoutHistoryTemplateTagPeer::buildTableMap();

View file

@ -1,376 +0,0 @@
<?php
/**
* Base class that represents a query for the 'cc_playout_history_template_field' table.
*
*
*
* @method CcPlayoutHistoryTemplateTagQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcPlayoutHistoryTemplateTagQuery orderByDbTemplateId($order = Criteria::ASC) Order by the template_id column
* @method CcPlayoutHistoryTemplateTagQuery orderByDbName($order = Criteria::ASC) Order by the name column
* @method CcPlayoutHistoryTemplateTagQuery orderByDbType($order = Criteria::ASC) Order by the type column
* @method CcPlayoutHistoryTemplateTagQuery orderByDbIsFileMD($order = Criteria::ASC) Order by the is_file_md column
* @method CcPlayoutHistoryTemplateTagQuery orderByDbTagPosition($order = Criteria::ASC) Order by the position column
*
* @method CcPlayoutHistoryTemplateTagQuery groupByDbId() Group by the id column
* @method CcPlayoutHistoryTemplateTagQuery groupByDbTemplateId() Group by the template_id column
* @method CcPlayoutHistoryTemplateTagQuery groupByDbName() Group by the name column
* @method CcPlayoutHistoryTemplateTagQuery groupByDbType() Group by the type column
* @method CcPlayoutHistoryTemplateTagQuery groupByDbIsFileMD() Group by the is_file_md column
* @method CcPlayoutHistoryTemplateTagQuery groupByDbTagPosition() Group by the position column
*
* @method CcPlayoutHistoryTemplateTagQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcPlayoutHistoryTemplateTagQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcPlayoutHistoryTemplateTagQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcPlayoutHistoryTemplateTagQuery leftJoinCcPlayoutHistoryTemplate($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistoryTemplate relation
* @method CcPlayoutHistoryTemplateTagQuery rightJoinCcPlayoutHistoryTemplate($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistoryTemplate relation
* @method CcPlayoutHistoryTemplateTagQuery innerJoinCcPlayoutHistoryTemplate($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistoryTemplate relation
*
* @method CcPlayoutHistoryTemplateTag findOne(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplateTag matching the query
* @method CcPlayoutHistoryTemplateTag findOneOrCreate(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplateTag matching the query, or a new CcPlayoutHistoryTemplateTag object populated from the query conditions when no match is found
*
* @method CcPlayoutHistoryTemplateTag findOneByDbId(int $id) Return the first CcPlayoutHistoryTemplateTag filtered by the id column
* @method CcPlayoutHistoryTemplateTag findOneByDbTemplateId(int $template_id) Return the first CcPlayoutHistoryTemplateTag filtered by the template_id column
* @method CcPlayoutHistoryTemplateTag findOneByDbName(string $name) Return the first CcPlayoutHistoryTemplateTag filtered by the name column
* @method CcPlayoutHistoryTemplateTag findOneByDbType(string $type) Return the first CcPlayoutHistoryTemplateTag filtered by the type column
* @method CcPlayoutHistoryTemplateTag findOneByDbIsFileMD(boolean $is_file_md) Return the first CcPlayoutHistoryTemplateTag filtered by the is_file_md column
* @method CcPlayoutHistoryTemplateTag findOneByDbTagPosition(int $position) Return the first CcPlayoutHistoryTemplateTag filtered by the position column
*
* @method array findByDbId(int $id) Return CcPlayoutHistoryTemplateTag objects filtered by the id column
* @method array findByDbTemplateId(int $template_id) Return CcPlayoutHistoryTemplateTag objects filtered by the template_id column
* @method array findByDbName(string $name) Return CcPlayoutHistoryTemplateTag objects filtered by the name column
* @method array findByDbType(string $type) Return CcPlayoutHistoryTemplateTag objects filtered by the type column
* @method array findByDbIsFileMD(boolean $is_file_md) Return CcPlayoutHistoryTemplateTag objects filtered by the is_file_md column
* @method array findByDbTagPosition(int $position) Return CcPlayoutHistoryTemplateTag objects filtered by the position column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryTemplateTagQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcPlayoutHistoryTemplateTagQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'airtime', $modelName = 'CcPlayoutHistoryTemplateTag', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CcPlayoutHistoryTemplateTagQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return CcPlayoutHistoryTemplateTagQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CcPlayoutHistoryTemplateTagQuery) {
return $criteria;
}
$query = new CcPlayoutHistoryTemplateTagQuery();
if (null !== $modelAlias) {
$query->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
* <code>
* $obj = $c->findPk(12, $con);
* </code>
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con an optional connection object
*
* @return CcPlayoutHistoryTemplateTag|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcPlayoutHistoryTemplateTagPeer::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
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @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 CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::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 CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::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 CcPlayoutHistoryTemplateTagQuery 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(CcPlayoutHistoryTemplateTagPeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the template_id column
*
* @param int|array $dbTemplateId 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 CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
*/
public function filterByDbTemplateId($dbTemplateId = null, $comparison = null)
{
if (is_array($dbTemplateId)) {
$useMinMax = false;
if (isset($dbTemplateId['min'])) {
$this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, $dbTemplateId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbTemplateId['max'])) {
$this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, $dbTemplateId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, $dbTemplateId, $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 CcPlayoutHistoryTemplateTagQuery 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(CcPlayoutHistoryTemplateTagPeer::NAME, $dbName, $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 CcPlayoutHistoryTemplateTagQuery 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(CcPlayoutHistoryTemplateTagPeer::TYPE, $dbType, $comparison);
}
/**
* Filter the query on the is_file_md column
*
* @param boolean|string $dbIsFileMD The value to use as filter.
* Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
*/
public function filterByDbIsFileMD($dbIsFileMD = null, $comparison = null)
{
if (is_string($dbIsFileMD)) {
$is_file_md = in_array(strtolower($dbIsFileMD), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
}
return $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::IS_FILE_MD, $dbIsFileMD, $comparison);
}
/**
* Filter the query on the position column
*
* @param int|array $dbTagPosition 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 CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
*/
public function filterByDbTagPosition($dbTagPosition = null, $comparison = null)
{
if (is_array($dbTagPosition)) {
$useMinMax = false;
if (isset($dbTagPosition['min'])) {
$this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::POSITION, $dbTagPosition['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbTagPosition['max'])) {
$this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::POSITION, $dbTagPosition['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::POSITION, $dbTagPosition, $comparison);
}
/**
* Filter the query by a related CcPlayoutHistoryTemplate object
*
* @param CcPlayoutHistoryTemplate $ccPlayoutHistoryTemplate the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
*/
public function filterByCcPlayoutHistoryTemplate($ccPlayoutHistoryTemplate, $comparison = null)
{
return $this
->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, $ccPlayoutHistoryTemplate->getDbId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcPlayoutHistoryTemplate relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
*/
public function joinCcPlayoutHistoryTemplate($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcPlayoutHistoryTemplate');
// 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, 'CcPlayoutHistoryTemplate');
}
return $this;
}
/**
* Use the CcPlayoutHistoryTemplate relation CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplateQuery A secondary query class using the current class as primary query
*/
public function useCcPlayoutHistoryTemplateQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcPlayoutHistoryTemplate($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryTemplate', 'CcPlayoutHistoryTemplateQuery');
}
/**
* Exclude object from result
*
* @param CcPlayoutHistoryTemplateTag $ccPlayoutHistoryTemplateTag Object to remove from the list of results
*
* @return CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
*/
public function prune($ccPlayoutHistoryTemplateTag = null)
{
if ($ccPlayoutHistoryTemplateTag) {
$this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::ID, $ccPlayoutHistoryTemplateTag->getDbId(), Criteria::NOT_EQUAL);
}
return $this;
}
} // BaseCcPlayoutHistoryTemplateTagQuery

View file

@ -125,11 +125,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
*/ */
protected $collCcSchedules; protected $collCcSchedules;
/**
* @var array CcPlayoutHistory[] Collection to store aggregation of CcPlayoutHistory objects.
*/
protected $collCcPlayoutHistorys;
/** /**
* Flag to prevent endless save loop, if this object is referenced * Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction. * by another object which falls in this transaction.
@ -894,8 +889,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$this->collCcSchedules = null; $this->collCcSchedules = null;
$this->collCcPlayoutHistorys = null;
} // if (deep) } // if (deep)
} }
@ -1071,14 +1064,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
} }
} }
if ($this->collCcPlayoutHistorys !== null) {
foreach ($this->collCcPlayoutHistorys as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false; $this->alreadyInSave = false;
} }
@ -1190,14 +1175,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
} }
} }
if ($this->collCcPlayoutHistorys !== null) {
foreach ($this->collCcPlayoutHistorys as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
$this->alreadyInValidation = false; $this->alreadyInValidation = false;
} }
@ -1530,12 +1507,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
} }
} }
foreach ($this->getCcPlayoutHistorys() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCcPlayoutHistory($relObj->copy($deepCopy));
}
}
} // if ($deepCopy) } // if ($deepCopy)
@ -2046,140 +2017,6 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
return $this->getCcSchedules($query, $con); return $this->getCcSchedules($query, $con);
} }
/**
* Clears out the collCcPlayoutHistorys 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 addCcPlayoutHistorys()
*/
public function clearCcPlayoutHistorys()
{
$this->collCcPlayoutHistorys = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Initializes the collCcPlayoutHistorys collection.
*
* By default this just sets the collCcPlayoutHistorys collection to an empty array (like clearcollCcPlayoutHistorys());
* 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 initCcPlayoutHistorys()
{
$this->collCcPlayoutHistorys = new PropelObjectCollection();
$this->collCcPlayoutHistorys->setModel('CcPlayoutHistory');
}
/**
* Gets an array of CcPlayoutHistory objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this CcShowInstances is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @return PropelCollection|array CcPlayoutHistory[] List of CcPlayoutHistory objects
* @throws PropelException
*/
public function getCcPlayoutHistorys($criteria = null, PropelPDO $con = null)
{
if(null === $this->collCcPlayoutHistorys || null !== $criteria) {
if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
// return empty collection
$this->initCcPlayoutHistorys();
} else {
$collCcPlayoutHistorys = CcPlayoutHistoryQuery::create(null, $criteria)
->filterByCcShowInstances($this)
->find($con);
if (null !== $criteria) {
return $collCcPlayoutHistorys;
}
$this->collCcPlayoutHistorys = $collCcPlayoutHistorys;
}
}
return $this->collCcPlayoutHistorys;
}
/**
* Returns the number of related CcPlayoutHistory objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
* @return int Count of related CcPlayoutHistory objects.
* @throws PropelException
*/
public function countCcPlayoutHistorys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
if(null === $this->collCcPlayoutHistorys || null !== $criteria) {
if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
return 0;
} else {
$query = CcPlayoutHistoryQuery::create(null, $criteria);
if($distinct) {
$query->distinct();
}
return $query
->filterByCcShowInstances($this)
->count($con);
}
} else {
return count($this->collCcPlayoutHistorys);
}
}
/**
* Method called to associate a CcPlayoutHistory object to this object
* through the CcPlayoutHistory foreign key attribute.
*
* @param CcPlayoutHistory $l CcPlayoutHistory
* @return void
* @throws PropelException
*/
public function addCcPlayoutHistory(CcPlayoutHistory $l)
{
if ($this->collCcPlayoutHistorys === null) {
$this->initCcPlayoutHistorys();
}
if (!$this->collCcPlayoutHistorys->contains($l)) { // only add it if the **same** object is not already associated
$this->collCcPlayoutHistorys[]= $l;
$l->setCcShowInstances($this);
}
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this CcShowInstances is new, it will return
* an empty collection; or if this CcShowInstances has previously
* been saved, it will retrieve related CcPlayoutHistorys from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in CcShowInstances.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return PropelCollection|array CcPlayoutHistory[] List of CcPlayoutHistory objects
*/
public function getCcPlayoutHistorysJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = CcPlayoutHistoryQuery::create(null, $criteria);
$query->joinWith('CcFiles', $join_behavior);
return $this->getCcPlayoutHistorys($query, $con);
}
/** /**
* Clears the current object and sets all attributes to their default values * Clears the current object and sets all attributes to their default values
*/ */
@ -2228,16 +2065,10 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
} }
} }
if ($this->collCcPlayoutHistorys) {
foreach ((array) $this->collCcPlayoutHistorys as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep) } // if ($deep)
$this->collCcShowInstancessRelatedByDbId = null; $this->collCcShowInstancessRelatedByDbId = null;
$this->collCcSchedules = null; $this->collCcSchedules = null;
$this->collCcPlayoutHistorys = null;
$this->aCcShow = null; $this->aCcShow = null;
$this->aCcShowInstancesRelatedByDbOriginalShow = null; $this->aCcShowInstancesRelatedByDbOriginalShow = null;
$this->aCcFiles = null; $this->aCcFiles = null;

View file

@ -399,9 +399,6 @@ abstract class BaseCcShowInstancesPeer {
// Invalidate objects in CcSchedulePeer instance pool, // Invalidate objects in CcSchedulePeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcSchedulePeer::clearInstancePool(); CcSchedulePeer::clearInstancePool();
// Invalidate objects in CcPlayoutHistoryPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcPlayoutHistoryPeer::clearInstancePool();
} }
/** /**

View file

@ -56,10 +56,6 @@
* @method CcShowInstancesQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSchedule relation * @method CcShowInstancesQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSchedule relation
* @method CcShowInstancesQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation * @method CcShowInstancesQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation
* *
* @method CcShowInstancesQuery leftJoinCcPlayoutHistory($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistory relation
* @method CcShowInstancesQuery rightJoinCcPlayoutHistory($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistory relation
* @method CcShowInstancesQuery innerJoinCcPlayoutHistory($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistory relation
*
* @method CcShowInstances findOne(PropelPDO $con = null) Return the first CcShowInstances matching the query * @method CcShowInstances findOne(PropelPDO $con = null) Return the first CcShowInstances matching the query
* @method CcShowInstances findOneOrCreate(PropelPDO $con = null) Return the first CcShowInstances matching the query, or a new CcShowInstances object populated from the query conditions when no match is found * @method CcShowInstances findOneOrCreate(PropelPDO $con = null) Return the first CcShowInstances matching the query, or a new CcShowInstances object populated from the query conditions when no match is found
* *
@ -852,70 +848,6 @@ abstract class BaseCcShowInstancesQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery'); ->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery');
} }
/**
* Filter the query by a related CcPlayoutHistory object
*
* @param CcPlayoutHistory $ccPlayoutHistory the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowInstancesQuery The current query, for fluid interface
*/
public function filterByCcPlayoutHistory($ccPlayoutHistory, $comparison = null)
{
return $this
->addUsingAlias(CcShowInstancesPeer::ID, $ccPlayoutHistory->getDbInstanceId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcPlayoutHistory relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowInstancesQuery The current query, for fluid interface
*/
public function joinCcPlayoutHistory($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcPlayoutHistory');
// 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, 'CcPlayoutHistory');
}
return $this;
}
/**
* Use the CcPlayoutHistory relation CcPlayoutHistory 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 CcPlayoutHistoryQuery A secondary query class using the current class as primary query
*/
public function useCcPlayoutHistoryQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcPlayoutHistory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistory', 'CcPlayoutHistoryQuery');
}
/** /**
* Exclude object from result * Exclude object from result
* *

File diff suppressed because it is too large Load diff

View file

@ -1,753 +0,0 @@
<?php
/**
* Base static class for performing query and update operations on the 'cc_tag' table.
*
*
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcTagPeer {
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
/** the table name for this class */
const TABLE_NAME = 'cc_tag';
/** the related Propel class for this table */
const OM_CLASS = 'CcTag';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcTag';
/** the related TableMap class for this table */
const TM_CLASS = 'CcTagTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 3;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_tag.ID';
/** the column name for the TAG_NAME field */
const TAG_NAME = 'cc_tag.TAG_NAME';
/** the column name for the TAG_TYPE field */
const TAG_TYPE = 'cc_tag.TAG_TYPE';
/**
* An identiy map to hold any loaded instances of CcTag objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcTag[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTagName', 'DbTagType', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTagName', 'dbTagType', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::TAG_NAME, self::TAG_TYPE, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TAG_NAME', 'TAG_TYPE', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'tag_name', 'tag_type', ),
BasePeer::TYPE_NUM => array (0, 1, 2, )
);
/**
* 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, 'DbTagName' => 1, 'DbTagType' => 2, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTagName' => 1, 'dbTagType' => 2, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TAG_NAME => 1, self::TAG_TYPE => 2, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TAG_NAME' => 1, 'TAG_TYPE' => 2, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'tag_name' => 1, 'tag_type' => 2, ),
BasePeer::TYPE_NUM => array (0, 1, 2, )
);
/**
* 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.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. CcTagPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(CcTagPeer::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(CcTagPeer::ID);
$criteria->addSelectColumn(CcTagPeer::TAG_NAME);
$criteria->addSelectColumn(CcTagPeer::TAG_TYPE);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.TAG_NAME');
$criteria->addSelectColumn($alias . '.TAG_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(CcTagPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcTagPeer::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(CcTagPeer::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 CcTag
* @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 = CcTagPeer::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 CcTagPeer::populateObjects(CcTagPeer::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(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
CcTagPeer::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 CcTag $value A CcTag object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcTag $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 CcTag object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof CcTag) {
$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 CcTag 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 CcTag 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_tag
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in CcFileTagPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcFileTagPeer::clearInstancePool();
// Invalidate objects in CcPlayoutHistoryMetaDataPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcPlayoutHistoryMetaDataPeer::clearInstancePool();
// Invalidate objects in CcPlayoutHistoryTemplateTagPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcPlayoutHistoryTemplateTagPeer::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 = CcTagPeer::getOMClass(false);
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcTagPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = CcTagPeer::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;
CcTagPeer::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 (CcTag object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = CcTagPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = CcTagPeer::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 + CcTagPeer::NUM_COLUMNS;
} else {
$cls = CcTagPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcTagPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* 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(BaseCcTagPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcTagPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcTagTableMap());
}
}
/**
* 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 ? CcTagPeer::CLASS_DEFAULT : CcTagPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcTag or Criteria object.
*
* @param mixed $values Criteria or CcTag 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(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from CcTag object
}
if ($criteria->containsKey(CcTagPeer::ID) && $criteria->keyContainsValue(CcTagPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcTagPeer::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 CcTag or Criteria object.
*
* @param mixed $values Criteria or CcTag 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(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(CcTagPeer::ID);
$value = $criteria->remove(CcTagPeer::ID);
if ($value) {
$selectCriteria->add(CcTagPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(CcTagPeer::TABLE_NAME);
}
} else { // $values is CcTag 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_tag 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(CcTagPeer::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(CcTagPeer::TABLE_NAME, $con, CcTagPeer::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).
CcTagPeer::clearInstancePool();
CcTagPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcTag or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcTag 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(CcTagPeer::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.
CcTagPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof CcTag) { // it's a model object
// invalidate the cache for this single object
CcTagPeer::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(CcTagPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
CcTagPeer::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);
CcTagPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given CcTag 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 CcTag $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(CcTag $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(CcTagPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(CcTagPeer::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(CcTagPeer::DATABASE_NAME, CcTagPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return CcTag
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = CcTagPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(CcTagPeer::DATABASE_NAME);
$criteria->add(CcTagPeer::ID, $pk);
$v = CcTagPeer::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(CcTagPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(CcTagPeer::DATABASE_NAME);
$criteria->add(CcTagPeer::ID, $pks, Criteria::IN);
$objs = CcTagPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseCcTagPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseCcTagPeer::buildTableMap();

View file

@ -1,421 +0,0 @@
<?php
/**
* Base class that represents a query for the 'cc_tag' table.
*
*
*
* @method CcTagQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcTagQuery orderByDbTagName($order = Criteria::ASC) Order by the tag_name column
* @method CcTagQuery orderByDbTagType($order = Criteria::ASC) Order by the tag_type column
*
* @method CcTagQuery groupByDbId() Group by the id column
* @method CcTagQuery groupByDbTagName() Group by the tag_name column
* @method CcTagQuery groupByDbTagType() Group by the tag_type column
*
* @method CcTagQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcTagQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcTagQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcTagQuery leftJoinCcFileTag($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFileTag relation
* @method CcTagQuery rightJoinCcFileTag($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFileTag relation
* @method CcTagQuery innerJoinCcFileTag($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFileTag relation
*
* @method CcTagQuery leftJoinCcPlayoutHistoryMetaData($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistoryMetaData relation
* @method CcTagQuery rightJoinCcPlayoutHistoryMetaData($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistoryMetaData relation
* @method CcTagQuery innerJoinCcPlayoutHistoryMetaData($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistoryMetaData relation
*
* @method CcTagQuery leftJoinCcPlayoutHistoryTemplateTag($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistoryTemplateTag relation
* @method CcTagQuery rightJoinCcPlayoutHistoryTemplateTag($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistoryTemplateTag relation
* @method CcTagQuery innerJoinCcPlayoutHistoryTemplateTag($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistoryTemplateTag relation
*
* @method CcTag findOne(PropelPDO $con = null) Return the first CcTag matching the query
* @method CcTag findOneOrCreate(PropelPDO $con = null) Return the first CcTag matching the query, or a new CcTag object populated from the query conditions when no match is found
*
* @method CcTag findOneByDbId(int $id) Return the first CcTag filtered by the id column
* @method CcTag findOneByDbTagName(string $tag_name) Return the first CcTag filtered by the tag_name column
* @method CcTag findOneByDbTagType(string $tag_type) Return the first CcTag filtered by the tag_type column
*
* @method array findByDbId(int $id) Return CcTag objects filtered by the id column
* @method array findByDbTagName(string $tag_name) Return CcTag objects filtered by the tag_name column
* @method array findByDbTagType(string $tag_type) Return CcTag objects filtered by the tag_type column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcTagQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcTagQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'airtime', $modelName = 'CcTag', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CcTagQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return CcTagQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CcTagQuery) {
return $criteria;
}
$query = new CcTagQuery();
if (null !== $modelAlias) {
$query->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
* <code>
* $obj = $c->findPk(12, $con);
* </code>
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con an optional connection object
*
* @return CcTag|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcTagPeer::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
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @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 CcTagQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcTagPeer::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 CcTagQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcTagPeer::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 CcTagQuery 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(CcTagPeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the tag_name column
*
* @param string $dbTagName 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 CcTagQuery The current query, for fluid interface
*/
public function filterByDbTagName($dbTagName = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($dbTagName)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbTagName)) {
$dbTagName = str_replace('*', '%', $dbTagName);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcTagPeer::TAG_NAME, $dbTagName, $comparison);
}
/**
* Filter the query on the tag_type column
*
* @param string $dbTagType 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 CcTagQuery The current query, for fluid interface
*/
public function filterByDbTagType($dbTagType = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($dbTagType)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbTagType)) {
$dbTagType = str_replace('*', '%', $dbTagType);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcTagPeer::TAG_TYPE, $dbTagType, $comparison);
}
/**
* Filter the query by a related CcFileTag object
*
* @param CcFileTag $ccFileTag the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcTagQuery The current query, for fluid interface
*/
public function filterByCcFileTag($ccFileTag, $comparison = null)
{
return $this
->addUsingAlias(CcTagPeer::ID, $ccFileTag->getDbTagId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcFileTag relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcTagQuery The current query, for fluid interface
*/
public function joinCcFileTag($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcFileTag');
// 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, 'CcFileTag');
}
return $this;
}
/**
* Use the CcFileTag relation CcFileTag 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 CcFileTagQuery A secondary query class using the current class as primary query
*/
public function useCcFileTagQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcFileTag($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcFileTag', 'CcFileTagQuery');
}
/**
* Filter the query by a related CcPlayoutHistoryMetaData object
*
* @param CcPlayoutHistoryMetaData $ccPlayoutHistoryMetaData the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcTagQuery The current query, for fluid interface
*/
public function filterByCcPlayoutHistoryMetaData($ccPlayoutHistoryMetaData, $comparison = null)
{
return $this
->addUsingAlias(CcTagPeer::ID, $ccPlayoutHistoryMetaData->getDbTagId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcPlayoutHistoryMetaData relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcTagQuery The current query, for fluid interface
*/
public function joinCcPlayoutHistoryMetaData($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcPlayoutHistoryMetaData');
// 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, 'CcPlayoutHistoryMetaData');
}
return $this;
}
/**
* Use the CcPlayoutHistoryMetaData relation CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaDataQuery A secondary query class using the current class as primary query
*/
public function useCcPlayoutHistoryMetaDataQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcPlayoutHistoryMetaData($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaDataQuery');
}
/**
* Filter the query by a related CcPlayoutHistoryTemplateTag object
*
* @param CcPlayoutHistoryTemplateTag $ccPlayoutHistoryTemplateTag the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcTagQuery The current query, for fluid interface
*/
public function filterByCcPlayoutHistoryTemplateTag($ccPlayoutHistoryTemplateTag, $comparison = null)
{
return $this
->addUsingAlias(CcTagPeer::ID, $ccPlayoutHistoryTemplateTag->getDbTagId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcPlayoutHistoryTemplateTag relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcTagQuery The current query, for fluid interface
*/
public function joinCcPlayoutHistoryTemplateTag($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcPlayoutHistoryTemplateTag');
// 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, 'CcPlayoutHistoryTemplateTag');
}
return $this;
}
/**
* Use the CcPlayoutHistoryTemplateTag relation CcPlayoutHistoryTemplateTag 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 CcPlayoutHistoryTemplateTagQuery A secondary query class using the current class as primary query
*/
public function useCcPlayoutHistoryTemplateTagQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcPlayoutHistoryTemplateTag($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryTemplateTag', 'CcPlayoutHistoryTemplateTagQuery');
}
/**
* Exclude object from result
*
* @param CcTag $ccTag Object to remove from the list of results
*
* @return CcTagQuery The current query, for fluid interface
*/
public function prune($ccTag = null)
{
if ($ccTag) {
$this->addUsingAlias(CcTagPeer::ID, $ccTag->getDbId(), Criteria::NOT_EQUAL);
}
return $this;
}
} // BaseCcTagQuery

View file

@ -861,31 +861,6 @@ abstract class BaseCcTimestamp extends BaseObject implements Persistent
} }
} }
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this CcTimestamp is new, it will return
* an empty collection; or if this CcTimestamp has previously
* been saved, it will retrieve related CcListenerCounts 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 CcTimestamp.
*
* @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 CcListenerCount[] List of CcListenerCount objects
*/
public function getCcListenerCountsJoinCcMountName($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = CcListenerCountQuery::create(null, $criteria);
$query->joinWith('CcMountName', $join_behavior);
return $this->getCcListenerCounts($query, $con);
}
/** /**
* Clears the current object and sets all attributes to their default values * Clears the current object and sets all attributes to their default values
*/ */

View file

@ -45,16 +45,11 @@ class Application_Service_CalendarService
if ($this->ccShowInstance->isRecorded()) { if ($this->ccShowInstance->isRecorded()) {
$ccFile = $this->ccShowInstance->getCcFiles(); $ccFile = $this->ccShowInstance->getCcFiles();
if (!isset($ccFile)) {
$menu["error when recording"] = array ( $menu["view_recorded"] = array(
"name" => _("Record file doesn't exist"), "name" => _("View Recorded File Metadata"),
"icon" => "error"); "icon" => "overview",
}else { "url" => $baseUrl."library/edit-file-md/id/".$ccFile->getDbId());
$menu["view_recorded"] = array(
"name" => _("View Recorded File Metadata"),
"icon" => "overview",
"url" => $baseUrl."library/edit-file-md/id/".$ccFile->getDbId());
}
//recorded show can be uploaded to soundcloud //recorded show can be uploaded to soundcloud
if (Application_Model_Preference::GetUploadToSoundcloudOption()) { if (Application_Model_Preference::GetUploadToSoundcloudOption()) {
@ -80,10 +75,10 @@ class Application_Service_CalendarService
} }
} else { } else {
//Show content can be modified from the calendar if: //Show content can be modified from the calendar if:
// the show has not started, // the show has not ended,
// the user is admin or hosting the show, // the user is admin or hosting the show,
// the show is not recorded // the show is not recorded
if ($now < $start && ($isAdminOrPM || $isHostOfShow) && if ($now < $end && ($isAdminOrPM || $isHostOfShow) &&
!$this->ccShowInstance->isRecorded() ) { !$this->ccShowInstance->isRecorded() ) {
$menu["schedule"] = array( $menu["schedule"] = array(
@ -333,4 +328,4 @@ class Application_Service_CalendarService
} }
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -248,24 +248,22 @@ class Application_Service_SchedulerService
} }
} //foreach linked instance } //foreach linked instance
if (!empty($values)) { $insert_sql = "INSERT INTO cc_schedule (starts, ends, ".
$insert_sql = "INSERT INTO cc_schedule (starts, ends, ". "clip_length, fade_in, fade_out, cue_in, cue_out, ".
"clip_length, fade_in, fade_out, cue_in, cue_out, ". "file_id, stream_id, instance_id, position) VALUES ".
"file_id, stream_id, instance_id, position) VALUES ". implode($values, ",");
implode($values, ",");
Application_Common_Database::prepareAndExecute( Application_Common_Database::prepareAndExecute(
$insert_sql, array(), Application_Common_Database::EXECUTE); $insert_sql, array(), Application_Common_Database::EXECUTE);
//update time_filled in cc_show_instances //update time_filled in cc_show_instances
$now = gmdate("Y-m-d H:i:s"); $now = gmdate("Y-m-d H:i:s");
$update_sql = "UPDATE cc_show_instances SET ". $update_sql = "UPDATE cc_show_instances SET ".
"time_filled = '{$timeFilled}', ". "time_filled = '{$timeFilled}', ".
"last_scheduled = '{$now}' ". "last_scheduled = '{$now}' ".
"WHERE show_id = {$ccShow->getDbId()}"; "WHERE show_id = {$ccShow->getDbId()}";
Application_Common_Database::prepareAndExecute( Application_Common_Database::prepareAndExecute(
$update_sql, array(), Application_Common_Database::EXECUTE); $update_sql, array(), Application_Common_Database::EXECUTE);
}
} //if at least one linked instance has content } //if at least one linked instance has content
} }

View file

@ -441,7 +441,7 @@ class Application_Service_ShowFormService
$rebroadcast = true; $rebroadcast = true;
$absRebroadcast = true; $absRebroadcast = true;
if (isset($formData["add_show_rebroadcast"]) && $formData["add_show_rebroadcast"]) { if ($formData["add_show_rebroadcast"]) {
$formData["add_show_duration"] = Application_Service_ShowService::formatShowDuration( $formData["add_show_duration"] = Application_Service_ShowService::formatShowDuration(
$formData["add_show_duration"]); $formData["add_show_duration"]);
$absRebroadcast = $forms["abs_rebroadcast"]->isValid($formData); $absRebroadcast = $forms["abs_rebroadcast"]->isValid($formData);

View file

@ -169,8 +169,8 @@ class Application_Service_ShowService
} }
/** /**
* *
* Receives a cc_show id and determines whether to create a * Receives a cc_show id and determines whether to create a
* single show instance or repeating show instances * single show instance or repeating show instances
*/ */
public function delegateInstanceCreation($daysAdded=null, $end=null, $fillInstances=false) public function delegateInstanceCreation($daysAdded=null, $end=null, $fillInstances=false)
@ -179,6 +179,9 @@ class Application_Service_ShowService
if (is_null($this->ccShow)) { if (is_null($this->ccShow)) {
$ccShowDays = $this->getShowDaysInRange($populateUntil, $end); $ccShowDays = $this->getShowDaysInRange($populateUntil, $end);
if (count($ccShowDays) > 0) {
$this->ccShow = $ccShowDays[0]->getCcShow();
}
} else { } else {
$ccShowDays = $this->ccShow->getCcShowDays(); $ccShowDays = $this->ccShow->getCcShowDays();
} }
@ -187,22 +190,7 @@ class Application_Service_ShowService
$populateUntil = $end; $populateUntil = $end;
} }
/* In case the user is moving forward in the calendar and there are
* linked shows in the schedule we need to keep track of each cc_show
* so we know which shows need to be filled with content
*/
$ccShows = array();
foreach ($ccShowDays as $day) { foreach ($ccShowDays as $day) {
$this->ccShow = $day->getCcShow();
$this->isRecorded = isset($this->isRecorded) ? $this->isRecorded : $this->ccShow->isRecorded();
$this->isRebroadcast = isset($this->isRebroadcast) ? $this->isRebroadcast : $this->ccShow->isRebroadcast();
if (!isset($ccShows[$day->getDbShowId()])) {
$ccShows[$day->getDbShowId()] = $day->getccShow();
}
switch ($day->getDbRepeatType()) { switch ($day->getDbRepeatType()) {
case NO_REPEAT: case NO_REPEAT:
$this->createNonRepeatingInstance($day, $populateUntil); $this->createNonRepeatingInstance($day, $populateUntil);
@ -224,10 +212,9 @@ class Application_Service_ShowService
} }
} }
foreach ($ccShows as $ccShow) { if (isset($this->ccShow) && ($this->isUpdate || $fillInstances) &&
if (($this->isUpdate || $fillInstances) && $ccShow->isLinked()) { $this->ccShow->isLinked()) {
Application_Service_SchedulerService::fillNewLinkedInstances($ccShow); Application_Service_SchedulerService::fillNewLinkedInstances($this->ccShow);
}
} }
if (isset($this->linkedShowContent)) { if (isset($this->linkedShowContent)) {
@ -277,7 +264,7 @@ class Application_Service_ShowService
} }
/** /**
* *
* Deletes all the cc_show_days entries for a specific show * Deletes all the cc_show_days entries for a specific show
* that is currently being edited. They will get recreated with * that is currently being edited. They will get recreated with
* the new show day specs * the new show day specs
@ -302,12 +289,12 @@ SQL;
/** /**
* TODO: This function is messy. Needs refactoring * TODO: This function is messy. Needs refactoring
* *
* When editing a show we may need to perform some actions to reflect the new specs: * When editing a show we may need to perform some actions to reflect the new specs:
* - Delete some show instances * - Delete some show instances
* - Update duration * - Update duration
* - Update start and end time * - Update start and end time
* *
* @param $showData edit show form values in raw form * @param $showData edit show form values in raw form
* @param $isRecorded value computed from the edit show form * @param $isRecorded value computed from the edit show form
* @param $repeatType value computed from the edit show form * @param $repeatType value computed from the edit show form
@ -346,7 +333,7 @@ SQL;
//if the start date changes, these are the repeat types //if the start date changes, these are the repeat types
//that require show instance deletion //that require show instance deletion
$deleteRepeatTypes = array(REPEAT_BI_WEEKLY, REPEAT_MONTHLY_MONTHLY, $deleteRepeatTypes = array(REPEAT_BI_WEEKLY, REPEAT_MONTHLY_MONTHLY,
REPEAT_MONTHLY_WEEKLY); REPEAT_MONTHLY_WEEKLY);
if (in_array($this->repeatType, $deleteRepeatTypes) && if (in_array($this->repeatType, $deleteRepeatTypes) &&
@ -410,7 +397,7 @@ SQL;
$this->deleteInstancesBeforeDate($showData['add_show_start_date'], $showId); $this->deleteInstancesBeforeDate($showData['add_show_start_date'], $showId);
} }
} }
} }
@ -500,7 +487,7 @@ SQL;
} }
/** /**
* *
* Enter description here ... * Enter description here ...
* @param $daysRemoved array of days (days of the week) removed * @param $daysRemoved array of days (days of the week) removed
* (days of the week are represented numerically * (days of the week are represented numerically
@ -631,45 +618,29 @@ SQL;
->filterByDbShowId($showId) ->filterByDbShowId($showId)
->filterByDbModifiedInstance(false) ->filterByDbModifiedInstance(false)
->filterByDbRebroadcast(0) ->filterByDbRebroadcast(0)
->orderByDbStarts()
->find(); ->find();
if ($ccShowInstances->isEmpty()) { if ($ccShowInstances->isEmpty()) {
return true; return true;
} }
/* We need to update the last_show in cc_show_days so the instances //only 1 show instance left of the show, make it non repeating.
* don't get recreated as the user moves forward in the calendar else if (count($ccShowInstances) === 1) {
*/ $ccShowInstance = $ccShowInstances[0];
else if (count($ccShowInstances) >= 1) {
$lastShowDays = array();
/* Creates an array where the key is the day of the week (monday,
* tuesday, etc.) and the value is the last show date for each
* day of the week. We will use this array to update the last_show
* for each cc_show_days entry of a cc_show
*/
foreach ($ccShowInstances as $instance) {
$instanceStartDT = new DateTime($instance->getDbStarts(),
new DateTimeZone("UTC"));
$lastShowDays[$instanceStartDT->format("w")] = $instanceStartDT;
}
foreach ($lastShowDays as $dayOfWeek => $lastShowStartDT) { $ccShowDay = CcShowDaysQuery::create()
$ccShowDay = CcShowDaysQuery::create() ->filterByDbShowId($showId)
->filterByDbShowId($showId) ->findOne();
->filterByDbDay($dayOfWeek) $tz = $ccShowDay->getDbTimezone();
->findOne();
if (isset($ccShowDay)) { $startDate = new DateTime($ccShowInstance->getDbStarts(), new DateTimeZone("UTC"));
$lastShowStartDT->setTimeZone(new DateTimeZone( $startDate->setTimeZone(new DateTimeZone($tz));
$ccShowDay->getDbTimezone())); $endDate = Application_Service_CalendarService::addDeltas($startDate, 1, 0);
$lastShowEndDT = Application_Service_CalendarService::addDeltas(
$lastShowStartDT, 1, 0);
$ccShowDay $ccShowDay->setDbFirstShow($startDate->format("Y-m-d"));
->setDbLastShow($lastShowEndDT->format("Y-m-d")) $ccShowDay->setDbLastShow($endDate->format("Y-m-d"));
->save(); $ccShowDay->setDbStartTime($startDate->format("H:i:s"));
} $ccShowDay->setDbRepeatType(-1);
} $ccShowDay->save();
//remove the old repeating deleted instances. //remove the old repeating deleted instances.
CcShowInstancesQuery::create() CcShowInstancesQuery::create()
@ -712,10 +683,10 @@ SQL;
} }
/** /**
* *
* Determines what the show end date should be based on * Determines what the show end date should be based on
* the form data * the form data
* *
* @param $showData add/edit show form data * @param $showData add/edit show form data
* @return DateTime object in user's local timezone * @return DateTime object in user's local timezone
*/ */
@ -758,10 +729,10 @@ SQL;
} }
/** /**
* *
* Returns the difference in seconds between a show's new and * Returns the difference in seconds between a show's new and
* old start time * old start time
* *
* @param $newStartDateTime DateTime object * @param $newStartDateTime DateTime object
* @param $oldStartDateTime DateTime object * @param $oldStartDateTime DateTime object
*/ */
@ -771,9 +742,9 @@ SQL;
} }
/** /**
* *
* Updates the start and end time for cc_show_instances * Updates the start and end time for cc_show_instances
* *
* @param $showData edit show form data * @param $showData edit show form data
*/ */
private function updateInstanceStartEndTime($diff) private function updateInstanceStartEndTime($diff)
@ -787,13 +758,13 @@ WHERE show_id = :showId
SQL; SQL;
Application_Common_Database::prepareAndExecute($sql, Application_Common_Database::prepareAndExecute($sql,
array(':diff1' => $diff, ':diff2' => $diff, array(':diff1' => $diff, ':diff2' => $diff,
':showId' => $this->ccShow->getDbId(), ':timestamp' => gmdate("Y-m-d H:i:s")), ':showId' => $this->ccShow->getDbId(), ':timestamp' => gmdate("Y-m-d H:i:s")),
'execute'); 'execute');
} }
/** /**
* *
* Enter description here ... * Enter description here ...
* @param ccShowDays $showDay * @param ccShowDays $showDay
* @param DateTime $showStartDate user's local time * @param DateTime $showStartDate user's local time
@ -830,7 +801,7 @@ SQL;
} }
/** /**
* *
* Sets a single cc_show_instance table row * Sets a single cc_show_instance table row
* @param $showDay * @param $showDay
* @param $populateUntil * @param $populateUntil
@ -867,7 +838,7 @@ SQL;
} }
/** /**
* *
* Sets multiple cc_show_instances table rows * Sets multiple cc_show_instances table rows
* @param unknown_type $showDay * @param unknown_type $showDay
* @param unknown_type $populateUntil * @param unknown_type $populateUntil
@ -877,7 +848,6 @@ SQL;
private function createWeeklyRepeatInstances($showDay, $populateUntil, private function createWeeklyRepeatInstances($showDay, $populateUntil,
$repeatType, $repeatInterval, $daysAdded=null) $repeatType, $repeatInterval, $daysAdded=null)
{ {
$show_id = $showDay->getDbShowId(); $show_id = $showDay->getDbShowId();
$first_show = $showDay->getDbFirstShow(); //non-UTC $first_show = $showDay->getDbFirstShow(); //non-UTC
$last_show = $showDay->getDbLastShow(); //non-UTC $last_show = $showDay->getDbLastShow(); //non-UTC
@ -900,15 +870,16 @@ SQL;
$utcLastShowDateTime = $last_show ? $utcLastShowDateTime = $last_show ?
Application_Common_DateHelper::ConvertToUtcDateTime($last_show, $timezone) : null; Application_Common_DateHelper::ConvertToUtcDateTime($last_show, $timezone) : null;
$utcStartDateTime = new DateTime("now");
$previousDate = clone $start; $previousDate = clone $start;
foreach ($datePeriod as $date) { foreach ($datePeriod as $date) {
list($utcStartDateTime, $utcEndDateTime) = $this->createUTCStartEndDateTime( list($utcStartDateTime, $utcEndDateTime) = $this->createUTCStartEndDateTime(
$date, $duration); $date, $duration);
/* /*
* Make sure start date is less than populate until date AND * Make sure start date is less than populate until date AND
* last show date is null OR start date is less than last show date * last show date is null OR start date is less than last show date
* *
* (NOTE: We cannot call getTimestamp() to compare the dates because of * (NOTE: We cannot call getTimestamp() to compare the dates because of
* a PHP 5.3.3 bug with DatePeriod objects - See CC-5159 for more details) * a PHP 5.3.3 bug with DatePeriod objects - See CC-5159 for more details)
*/ */
@ -916,7 +887,6 @@ SQL;
( is_null($utcLastShowDateTime) || ( is_null($utcLastShowDateTime) ||
$utcStartDateTime->format("Y-m-d H:i:s") < $utcLastShowDateTime->format("Y-m-d H:i:s")) ) { $utcStartDateTime->format("Y-m-d H:i:s") < $utcLastShowDateTime->format("Y-m-d H:i:s")) ) {
$lastCreatedShow = clone $utcStartDateTime;
/* There may not always be an instance when editing a show /* There may not always be an instance when editing a show
* This will be the case when we are adding a new show day to * This will be the case when we are adding a new show day to
* a repeating show * a repeating show
@ -960,20 +930,12 @@ SQL;
$previousDate = clone $date; $previousDate = clone $date;
} }
/* We need to set the next populate date for repeat shows so when a user /* Set UTC to local time before setting the next repeat date. If we don't
* moves forward in the calendar we know when to start generating new * the next repeat date might be scheduled for the following day
* show instances.
* If $utcStartDateTime is not set then we know zero new shows were
* created and we shouldn't update the next populate date.
*/ */
if (isset($lastCreatedShow)) { $utcStartDateTime->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone()));
/* Set UTC to local time before setting the next repeat date. If we don't $nextDate = $utcStartDateTime->add($repeatInterval);
* the next repeat date might be scheduled for the following day $this->setNextRepeatingShowDate($nextDate->format("Y-m-d"), $day, $show_id);
* THIS MUST BE IN THE TIMEZONE THE SHOW WAS CREATED IN */
$lastCreatedShow->setTimezone(new DateTimeZone($timezone));
$nextDate = $lastCreatedShow->add($repeatInterval);
$this->setNextRepeatingShowDate($nextDate->format("Y-m-d"), $day, $show_id);
}
} }
private function createMonthlyRepeatInstances($showDay, $populateUntil) private function createMonthlyRepeatInstances($showDay, $populateUntil)
@ -1015,7 +977,6 @@ SQL;
( is_null($utcLastShowDateTime) || ( is_null($utcLastShowDateTime) ||
$utcStartDateTime->getTimestamp() < $utcLastShowDateTime->getTimestamp()) ) { $utcStartDateTime->getTimestamp() < $utcLastShowDateTime->getTimestamp()) ) {
$lastCreatedShow = clone $utcStartDateTime;
/* There may not always be an instance when editing a show /* There may not always be an instance when editing a show
* This will be the case when we are adding a new show day to * This will be the case when we are adding a new show day to
* a repeating show * a repeating show
@ -1069,10 +1030,10 @@ SQL;
} }
/** /**
* *
* i.e. last thursday of each month * i.e. last thursday of each month
* i.e. second monday of each month * i.e. second monday of each month
* *
* @param string $showStart * @param string $showStart
* @param string $timezone user's local timezone * @param string $timezone user's local timezone
*/ */
@ -1117,7 +1078,7 @@ SQL;
} }
/** /**
* *
* Enter description here ... * Enter description here ...
* @param $start user's local time * @param $start user's local time
*/ */
@ -1187,7 +1148,7 @@ SQL;
} }
/** /**
* *
* Create a DatePeriod object in the user's local time * Create a DatePeriod object in the user's local time
* It will get converted to UTC before the show instance gets created * It will get converted to UTC before the show instance gets created
*/ */
@ -1208,11 +1169,11 @@ SQL;
} }
/** /**
* *
* Attempts to retrieve the cc_show_instance belonging to a cc_show * Attempts to retrieve the cc_show_instance belonging to a cc_show
* that starts at $starts. We have to pass in the start * that starts at $starts. We have to pass in the start
* time in case the show is repeating * time in case the show is repeating
* *
* Returns the instance if one was found (one that is not a recording * Returns the instance if one was found (one that is not a recording
* and modified instance is false (has not been deleted)) * and modified instance is false (has not been deleted))
*/ */
@ -1255,7 +1216,7 @@ SQL;
} }
/** /**
* *
* Sets the fields for a cc_show table row * Sets the fields for a cc_show table row
* @param $ccShow * @param $ccShow
* @param $showData * @param $showData
@ -1290,7 +1251,7 @@ SQL;
} }
/** /**
* *
* Sets the fields for a cc_show_days table row * Sets the fields for a cc_show_days table row
* @param $showData * @param $showData
* @param $showId * @param $showId
@ -1372,7 +1333,7 @@ SQL;
} }
/** /**
* *
* Deletes all the cc_show_rebroadcast entries for a specific show * Deletes all the cc_show_rebroadcast entries for a specific show
* that is currently being edited. They will get recreated with * that is currently being edited. They will get recreated with
* the new show specs * the new show specs
@ -1383,7 +1344,7 @@ SQL;
} }
/** /**
* *
* Sets the fields for a cc_show_rebroadcast table row * Sets the fields for a cc_show_rebroadcast table row
* @param $showData * @param $showData
* @param $showId * @param $showId
@ -1422,7 +1383,7 @@ SQL;
} }
/** /**
* *
* Deletes all the cc_show_hosts entries for a specific show * Deletes all the cc_show_hosts entries for a specific show
* that is currently being edited. They will get recreated with * that is currently being edited. They will get recreated with
* the new show specs * the new show specs
@ -1433,7 +1394,7 @@ SQL;
} }
/** /**
* *
* Sets the fields for a cc_show_hosts table row * Sets the fields for a cc_show_hosts table row
* @param $showData * @param $showData
* @param $showId * @param $showId
@ -1451,10 +1412,10 @@ SQL;
} }
/** /**
* *
* Gets the date and time shows (particularly repeating shows) * Gets the date and time shows (particularly repeating shows)
* can be populated until. * can be populated until.
* *
* @return DateTime object * @return DateTime object
*/ */
private static function getPopulateShowUntilDateTIme() private static function getPopulateShowUntilDateTIme()
@ -1469,13 +1430,13 @@ SQL;
} }
/** /**
* *
* Enter description here ... * Enter description here ...
* @param DateTime $showStart user's local time * @param DateTime $showStart user's local time
* @param string $duration time interval (h)h:(m)m(:ss) * @param string $duration time interval (h)h:(m)m(:ss)
* @param string $timezone "Europe/Prague" * @param string $timezone "Europe/Prague"
* @param array $offset (days, hours, mins) used for rebroadcast shows * @param array $offset (days, hours, mins) used for rebroadcast shows
* *
* @return array of 2 DateTime objects, start/end time of the show in UTC * @return array of 2 DateTime objects, start/end time of the show in UTC
*/ */
private function createUTCStartEndDateTime($showStart, $duration, $offset=null) private function createUTCStartEndDateTime($showStart, $duration, $offset=null)
@ -1501,12 +1462,12 @@ SQL;
} }
/** /**
* *
* Show instances for repeating shows only get created up * Show instances for repeating shows only get created up
* until what is visible on the calendar. We need to set the * until what is visible on the calendar. We need to set the
* date for when the next repeating show instance should be created * date for when the next repeating show instance should be created
* as the user browses the calendar further. * as the user browses the calendar further.
* *
* @param $nextDate * @param $nextDate
* @param $showId * @param $showId
* @param $day * @param $day
@ -1523,4 +1484,4 @@ SQL;
$repeatInfo->setDbNextPopDate($nextInfo[0]) $repeatInfo->setDbNextPopDate($nextInfo[0])
->save(); ->save();
} }
} }

Some files were not shown because too many files have changed in this diff Show more