IM-733 Create Development timetable for Airtime Development
IM-777 Database structure for new History Feature
This commit is contained in:
parent
163b4a0aa5
commit
328c1f3cac
|
@ -204,4 +204,46 @@ return array (
|
|||
'BaseCcLocalePeer' => 'airtime/om/BaseCcLocalePeer.php',
|
||||
'BaseCcLocale' => 'airtime/om/BaseCcLocale.php',
|
||||
'BaseCcLocaleQuery' => 'airtime/om/BaseCcLocaleQuery.php',
|
||||
'CcTagTableMap' => 'airtime/map/CcTagTableMap.php',
|
||||
'CcTagPeer' => 'airtime/CcTagPeer.php',
|
||||
'CcTag' => 'airtime/CcTag.php',
|
||||
'CcTagQuery' => 'airtime/CcTagQuery.php',
|
||||
'BaseCcTagPeer' => 'airtime/om/BaseCcTagPeer.php',
|
||||
'BaseCcTag' => 'airtime/om/BaseCcTag.php',
|
||||
'BaseCcTagQuery' => 'airtime/om/BaseCcTagQuery.php',
|
||||
'CcFileTagTableMap' => 'airtime/map/CcFileTagTableMap.php',
|
||||
'CcFileTagPeer' => 'airtime/CcFileTagPeer.php',
|
||||
'CcFileTag' => 'airtime/CcFileTag.php',
|
||||
'CcFileTagQuery' => 'airtime/CcFileTagQuery.php',
|
||||
'BaseCcFileTagPeer' => 'airtime/om/BaseCcFileTagPeer.php',
|
||||
'BaseCcFileTag' => 'airtime/om/BaseCcFileTag.php',
|
||||
'BaseCcFileTagQuery' => 'airtime/om/BaseCcFileTagQuery.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',
|
||||
'CcPlayoutHistoryTemplateTagTableMap' => 'airtime/map/CcPlayoutHistoryTemplateTagTableMap.php',
|
||||
'CcPlayoutHistoryTemplateTagPeer' => 'airtime/CcPlayoutHistoryTemplateTagPeer.php',
|
||||
'CcPlayoutHistoryTemplateTag' => 'airtime/CcPlayoutHistoryTemplateTag.php',
|
||||
'CcPlayoutHistoryTemplateTagQuery' => 'airtime/CcPlayoutHistoryTemplateTagQuery.php',
|
||||
'BaseCcPlayoutHistoryTemplateTagPeer' => 'airtime/om/BaseCcPlayoutHistoryTemplateTagPeer.php',
|
||||
'BaseCcPlayoutHistoryTemplateTag' => 'airtime/om/BaseCcPlayoutHistoryTemplateTag.php',
|
||||
'BaseCcPlayoutHistoryTemplateTagQuery' => 'airtime/om/BaseCcPlayoutHistoryTemplateTagQuery.php',
|
||||
);
|
|
@ -363,6 +363,9 @@ class ApiController extends Zend_Controller_Action
|
|||
$media_id = $this->_getParam("media_id");
|
||||
Logging::debug("Received notification of new media item start: $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
|
||||
//needed for smart blocks
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'cc_playout_history_template_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 CcPlayoutHistoryTemplateTag extends BaseCcPlayoutHistoryTemplateTag {
|
||||
|
||||
} // CcPlayoutHistoryTemplateTag
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'cc_playout_history_template_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 CcPlayoutHistoryTemplateTagPeer extends BaseCcPlayoutHistoryTemplateTagPeer {
|
||||
|
||||
} // CcPlayoutHistoryTemplateTagPeer
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'cc_playout_history_template_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 CcPlayoutHistoryTemplateTagQuery extends BaseCcPlayoutHistoryTemplateTagQuery {
|
||||
|
||||
} // CcPlayoutHistoryTemplateTagQuery
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,18 @@
|
|||
<?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
|
|
@ -0,0 +1,56 @@
|
|||
<?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
|
|
@ -123,6 +123,8 @@ class CcFilesTableMap extends TableMap {
|
|||
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcFileTag', 'CcFileTag', 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()
|
||||
|
||||
} // CcFilesTableMap
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
<?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
|
|
@ -0,0 +1,57 @@
|
|||
<?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);
|
||||
// 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('CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaData', RelationMap::ONE_TO_MANY, array('id' => 'history_id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // CcPlayoutHistoryTableMap
|
|
@ -0,0 +1,54 @@
|
|||
<?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('TEMPLATE_NAME', 'DbTemplateName', 'VARCHAR', true, 128, null);
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CcPlayoutHistoryTemplateTag', 'CcPlayoutHistoryTemplateTag', RelationMap::ONE_TO_MANY, array('id' => 'template_id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // CcPlayoutHistoryTemplateTableMap
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This class defines the structure of the 'cc_playout_history_template_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 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_tag');
|
||||
$this->setPhpName('CcPlayoutHistoryTemplateTag');
|
||||
$this->setClassname('CcPlayoutHistoryTemplateTag');
|
||||
$this->setPackage('airtime');
|
||||
$this->setUseIdGenerator(true);
|
||||
$this->setPrimaryKeyMethodInfo('cc_playout_history_template_tag_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->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('CcPlayoutHistoryTemplate', 'CcPlayoutHistoryTemplate', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcTag', 'CcTag', RelationMap::MANY_TO_ONE, array('tag_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // CcPlayoutHistoryTemplateTagTableMap
|
|
@ -0,0 +1,55 @@
|
|||
<?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);
|
||||
// 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('CcPlayoutHistoryTemplateTag', 'CcPlayoutHistoryTemplateTag', RelationMap::ONE_TO_MANY, array('id' => 'tag_id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // CcTagTableMap
|
|
@ -0,0 +1,936 @@
|
|||
<?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
|
@ -0,0 +1,371 @@
|
|||
<?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
|
|
@ -493,6 +493,16 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $collCcSchedules;
|
||||
|
||||
/**
|
||||
* @var array CcFileTag[] Collection to store aggregation of CcFileTag objects.
|
||||
*/
|
||||
protected $collCcFileTags;
|
||||
|
||||
/**
|
||||
* @var array CcPlayoutHistory[] Collection to store aggregation of CcPlayoutHistory objects.
|
||||
*/
|
||||
protected $collCcPlayoutHistorys;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
|
@ -3109,6 +3119,10 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
|
||||
$this->collCcSchedules = null;
|
||||
|
||||
$this->collCcFileTags = null;
|
||||
|
||||
$this->collCcPlayoutHistorys = null;
|
||||
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
|
@ -3300,6 +3314,22 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
}
|
||||
}
|
||||
|
||||
if ($this->collCcFileTags !== null) {
|
||||
foreach ($this->collCcFileTags as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted()) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collCcPlayoutHistorys !== null) {
|
||||
foreach ($this->collCcPlayoutHistorys as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted()) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
|
@ -3427,6 +3457,22 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
}
|
||||
}
|
||||
|
||||
if ($this->collCcFileTags !== null) {
|
||||
foreach ($this->collCcFileTags as $referrerFK) {
|
||||
if (!$referrerFK->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collCcPlayoutHistorys !== null) {
|
||||
foreach ($this->collCcPlayoutHistorys as $referrerFK) {
|
||||
if (!$referrerFK->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
|
@ -4351,6 +4397,18 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
}
|
||||
}
|
||||
|
||||
foreach ($this->getCcFileTags() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addCcFileTag($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
|
||||
|
@ -5154,6 +5212,249 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
return $this->getCcSchedules($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCcFileTags 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 addCcFileTags()
|
||||
*/
|
||||
public function clearCcFileTags()
|
||||
{
|
||||
$this->collCcFileTags = null; // important to set this to NULL since that means it is uninitialized
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collCcFileTags collection.
|
||||
*
|
||||
* By default this just sets the collCcFileTags collection to an empty array (like clearcollCcFileTags());
|
||||
* 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 initCcFileTags()
|
||||
{
|
||||
$this->collCcFileTags = new PropelObjectCollection();
|
||||
$this->collCcFileTags->setModel('CcFileTag');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of CcFileTag 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 CcFileTag[] List of CcFileTag objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCcFileTags($criteria = null, PropelPDO $con = null)
|
||||
{
|
||||
if(null === $this->collCcFileTags || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCcFileTags) {
|
||||
// return empty collection
|
||||
$this->initCcFileTags();
|
||||
} else {
|
||||
$collCcFileTags = CcFileTagQuery::create(null, $criteria)
|
||||
->filterByCcFiles($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
return $collCcFileTags;
|
||||
}
|
||||
$this->collCcFileTags = $collCcFileTags;
|
||||
}
|
||||
}
|
||||
return $this->collCcFileTags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related CcFileTag objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param PropelPDO $con
|
||||
* @return int Count of related CcFileTag objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countCcFileTags(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
|
||||
{
|
||||
if(null === $this->collCcFileTags || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCcFileTags) {
|
||||
return 0;
|
||||
} else {
|
||||
$query = CcFileTagQuery::create(null, $criteria);
|
||||
if($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
return $query
|
||||
->filterByCcFiles($this)
|
||||
->count($con);
|
||||
}
|
||||
} else {
|
||||
return count($this->collCcFileTags);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a CcFileTag object to this object
|
||||
* through the CcFileTag foreign key attribute.
|
||||
*
|
||||
* @param CcFileTag $l CcFileTag
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function addCcFileTag(CcFileTag $l)
|
||||
{
|
||||
if ($this->collCcFileTags === null) {
|
||||
$this->initCcFileTags();
|
||||
}
|
||||
if (!$this->collCcFileTags->contains($l)) { // only add it if the **same** object is not already associated
|
||||
$this->collCcFileTags[]= $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 CcFileTags 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 CcFileTag[] List of CcFileTag objects
|
||||
*/
|
||||
public function getCcFileTagsJoinCcTag($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = CcFileTagQuery::create(null, $criteria);
|
||||
$query->joinWith('CcTag', $join_behavior);
|
||||
|
||||
return $this->getCcFileTags($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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
|
@ -5270,12 +5571,24 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collCcFileTags) {
|
||||
foreach ((array) $this->collCcFileTags as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collCcPlayoutHistorys) {
|
||||
foreach ((array) $this->collCcPlayoutHistorys as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
$this->collCcShowInstancess = null;
|
||||
$this->collCcPlaylistcontentss = null;
|
||||
$this->collCcBlockcontentss = null;
|
||||
$this->collCcSchedules = null;
|
||||
$this->collCcFileTags = null;
|
||||
$this->collCcPlayoutHistorys = null;
|
||||
$this->aFkOwner = null;
|
||||
$this->aCcSubjsRelatedByDbEditedby = null;
|
||||
$this->aCcMusicDirs = null;
|
||||
|
|
|
@ -695,6 +695,12 @@ abstract class BaseCcFilesPeer {
|
|||
// Invalidate objects in CcSchedulePeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CcSchedulePeer::clearInstancePool();
|
||||
// Invalidate objects in CcFileTagPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CcFileTagPeer::clearInstancePool();
|
||||
// Invalidate objects in CcPlayoutHistoryPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CcPlayoutHistoryPeer::clearInstancePool();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -180,6 +180,14 @@
|
|||
* @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 leftJoinCcFileTag($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFileTag relation
|
||||
* @method CcFilesQuery rightJoinCcFileTag($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFileTag relation
|
||||
* @method CcFilesQuery innerJoinCcFileTag($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFileTag 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 findOneOrCreate(PropelPDO $con = null) Return the first CcFiles matching the query, or a new CcFiles object populated from the query conditions when no match is found
|
||||
*
|
||||
|
@ -2535,6 +2543,134 @@ abstract class BaseCcFilesQuery extends ModelCriteria
|
|||
->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 CcFilesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCcFileTag($ccFileTag, $comparison = null)
|
||||
{
|
||||
return $this
|
||||
->addUsingAlias(CcFilesPeer::ID, $ccFileTag->getDbFileId(), $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 CcFilesQuery 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 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
|
||||
*
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,905 @@
|
|||
<?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
|
|
@ -0,0 +1,983 @@
|
|||
<?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();
|
||||
|
|
@ -0,0 +1,320 @@
|
|||
<?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
|
|
@ -0,0 +1,986 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Base static class for performing query and update operations on the 'cc_playout_history' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package propel.generator.airtime.om
|
||||
*/
|
||||
abstract class BaseCcPlayoutHistoryPeer {
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'airtime';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'cc_playout_history';
|
||||
|
||||
/** the related Propel class for this table */
|
||||
const OM_CLASS = 'CcPlayoutHistory';
|
||||
|
||||
/** A class that can be returned by this peer. */
|
||||
const CLASS_DEFAULT = 'airtime.CcPlayoutHistory';
|
||||
|
||||
/** the related TableMap class for this table */
|
||||
const TM_CLASS = 'CcPlayoutHistoryTableMap';
|
||||
|
||||
/** 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.ID';
|
||||
|
||||
/** the column name for the FILE_ID field */
|
||||
const FILE_ID = 'cc_playout_history.FILE_ID';
|
||||
|
||||
/** the column name for the STARTS field */
|
||||
const STARTS = 'cc_playout_history.STARTS';
|
||||
|
||||
/** the column name for the ENDS field */
|
||||
const ENDS = 'cc_playout_history.ENDS';
|
||||
|
||||
/**
|
||||
* An identiy map to hold any loaded instances of CcPlayoutHistory objects.
|
||||
* This must be public so that other peer classes can access this when hydrating from JOIN
|
||||
* queries.
|
||||
* @var array CcPlayoutHistory[]
|
||||
*/
|
||||
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', 'DbFileId', 'DbStarts', 'DbEnds', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFileId', 'dbStarts', 'dbEnds', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::FILE_ID, self::STARTS, self::ENDS, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FILE_ID', 'STARTS', 'ENDS', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'file_id', 'starts', 'ends', ),
|
||||
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, 'DbFileId' => 1, 'DbStarts' => 2, 'DbEnds' => 3, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFileId' => 1, 'dbStarts' => 2, 'dbEnds' => 3, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::FILE_ID => 1, self::STARTS => 2, self::ENDS => 3, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FILE_ID' => 1, 'STARTS' => 2, 'ENDS' => 3, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'file_id' => 1, 'starts' => 2, 'ends' => 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. CcPlayoutHistoryPeer::COLUMN_NAME).
|
||||
* @return string
|
||||
*/
|
||||
public static function alias($alias, $column)
|
||||
{
|
||||
return str_replace(CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::ID);
|
||||
$criteria->addSelectColumn(CcPlayoutHistoryPeer::FILE_ID);
|
||||
$criteria->addSelectColumn(CcPlayoutHistoryPeer::STARTS);
|
||||
$criteria->addSelectColumn(CcPlayoutHistoryPeer::ENDS);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.FILE_ID');
|
||||
$criteria->addSelectColumn($alias . '.STARTS');
|
||||
$criteria->addSelectColumn($alias . '.ENDS');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(CcPlayoutHistoryPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::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 CcPlayoutHistory
|
||||
* @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 = CcPlayoutHistoryPeer::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 CcPlayoutHistoryPeer::populateObjects(CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
$criteria = clone $criteria;
|
||||
CcPlayoutHistoryPeer::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 CcPlayoutHistory $value A CcPlayoutHistory object.
|
||||
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
|
||||
*/
|
||||
public static function addInstanceToPool(CcPlayoutHistory $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 CcPlayoutHistory object or a primary key value.
|
||||
*/
|
||||
public static function removeInstanceFromPool($value)
|
||||
{
|
||||
if (Propel::isInstancePoolingEnabled() && $value !== null) {
|
||||
if (is_object($value) && $value instanceof CcPlayoutHistory) {
|
||||
$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 CcPlayoutHistory 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 CcPlayoutHistory 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
|
||||
* by a foreign key with ON DELETE CASCADE
|
||||
*/
|
||||
public static function clearRelatedInstancePool()
|
||||
{
|
||||
// Invalidate objects in CcPlayoutHistoryMetaDataPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CcPlayoutHistoryMetaDataPeer::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 = CcPlayoutHistoryPeer::getOMClass(false);
|
||||
// populate the object(s)
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj = CcPlayoutHistoryPeer::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;
|
||||
CcPlayoutHistoryPeer::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 (CcPlayoutHistory object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $startcol = 0)
|
||||
{
|
||||
$key = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||
if (null !== ($obj = CcPlayoutHistoryPeer::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 + CcPlayoutHistoryPeer::NUM_COLUMNS;
|
||||
} else {
|
||||
$cls = CcPlayoutHistoryPeer::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $startcol);
|
||||
CcPlayoutHistoryPeer::addInstanceToPool($obj, $key);
|
||||
}
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related CcFiles table
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
|
||||
* @param PropelPDO $con
|
||||
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||
* @return int Number of matching rows.
|
||||
*/
|
||||
public static function doCountJoinCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
// we're going to modify criteria, so copy it first
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// We need to set the primary table name, since in the case that there are no WHERE columns
|
||||
// it will be impossible for the BasePeer::createSelectSql() method to determine which
|
||||
// tables go into the FROM clause.
|
||||
$criteria->setPrimaryTableName(CcPlayoutHistoryPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doCount($criteria, $con);
|
||||
|
||||
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$count = (int) $row[0];
|
||||
} else {
|
||||
$count = 0; // no rows returned; we infer that means 0 matches.
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of CcPlayoutHistory objects pre-filled with their CcFiles objects.
|
||||
* @param Criteria $criteria
|
||||
* @param PropelPDO $con
|
||||
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||
* @return array Array of CcPlayoutHistory objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
CcPlayoutHistoryPeer::addSelectColumns($criteria);
|
||||
$startcol = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||
CcFilesPeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = CcPlayoutHistoryPeer::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 = CcPlayoutHistoryPeer::getOMClass(false);
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
CcPlayoutHistoryPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if $obj1 already loaded
|
||||
|
||||
$key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = CcFilesPeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = CcFilesPeer::getOMClass(false);
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol);
|
||||
CcFilesPeer::addInstanceToPool($obj2, $key2);
|
||||
} // if obj2 already loaded
|
||||
|
||||
// Add the $obj1 (CcPlayoutHistory) to $obj2 (CcFiles)
|
||||
$obj2->addCcPlayoutHistory($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(CcPlayoutHistoryPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doCount($criteria, $con);
|
||||
|
||||
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$count = (int) $row[0];
|
||||
} else {
|
||||
$count = 0; // no rows returned; we infer that means 0 matches.
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects a collection of CcPlayoutHistory 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 CcPlayoutHistory 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);
|
||||
}
|
||||
|
||||
CcPlayoutHistoryPeer::addSelectColumns($criteria);
|
||||
$startcol2 = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||
|
||||
CcFilesPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||
|
||||
$criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = CcPlayoutHistoryPeer::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 = CcPlayoutHistoryPeer::getOMClass(false);
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
CcPlayoutHistoryPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if obj1 already loaded
|
||||
|
||||
// Add objects for joined CcFiles rows
|
||||
|
||||
$key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = CcFilesPeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = CcFilesPeer::getOMClass(false);
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol2);
|
||||
CcFilesPeer::addInstanceToPool($obj2, $key2);
|
||||
} // if obj2 loaded
|
||||
|
||||
// Add the $obj1 (CcPlayoutHistory) to the collection in $obj2 (CcFiles)
|
||||
$obj2->addCcPlayoutHistory($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(BaseCcPlayoutHistoryPeer::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(BaseCcPlayoutHistoryPeer::TABLE_NAME))
|
||||
{
|
||||
$dbMap->addTableObject(new CcPlayoutHistoryTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ? CcPlayoutHistoryPeer::CLASS_DEFAULT : CcPlayoutHistoryPeer::OM_CLASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform an INSERT on the database, given a CcPlayoutHistory or Criteria object.
|
||||
*
|
||||
* @param mixed $values Criteria or CcPlayoutHistory 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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
} else {
|
||||
$criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistory object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(CcPlayoutHistoryPeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryPeer::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryPeer::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 CcPlayoutHistory or Criteria object.
|
||||
*
|
||||
* @param mixed $values Criteria or CcPlayoutHistory 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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||
}
|
||||
|
||||
$selectCriteria = new Criteria(self::DATABASE_NAME);
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
|
||||
$comparison = $criteria->getComparison(CcPlayoutHistoryPeer::ID);
|
||||
$value = $criteria->remove(CcPlayoutHistoryPeer::ID);
|
||||
if ($value) {
|
||||
$selectCriteria->add(CcPlayoutHistoryPeer::ID, $value, $comparison);
|
||||
} else {
|
||||
$selectCriteria->setPrimaryTableName(CcPlayoutHistoryPeer::TABLE_NAME);
|
||||
}
|
||||
|
||||
} else { // $values is CcPlayoutHistory 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 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(CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::TABLE_NAME, $con, CcPlayoutHistoryPeer::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).
|
||||
CcPlayoutHistoryPeer::clearInstancePool();
|
||||
CcPlayoutHistoryPeer::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform a DELETE on the database, given a CcPlayoutHistory or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or CcPlayoutHistory 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(CcPlayoutHistoryPeer::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.
|
||||
CcPlayoutHistoryPeer::clearInstancePool();
|
||||
// rename for clarity
|
||||
$criteria = clone $values;
|
||||
} elseif ($values instanceof CcPlayoutHistory) { // it's a model object
|
||||
// invalidate the cache for this single object
|
||||
CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::ID, (array) $values, Criteria::IN);
|
||||
// invalidate the cache for this object(s)
|
||||
foreach ((array) $values as $singleval) {
|
||||
CcPlayoutHistoryPeer::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);
|
||||
CcPlayoutHistoryPeer::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates all modified columns of given CcPlayoutHistory 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 CcPlayoutHistory $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(CcPlayoutHistory $obj, $cols = null)
|
||||
{
|
||||
$columns = array();
|
||||
|
||||
if ($cols) {
|
||||
$dbMap = Propel::getDatabaseMap(CcPlayoutHistoryPeer::DATABASE_NAME);
|
||||
$tableMap = $dbMap->getTable(CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME, CcPlayoutHistoryPeer::TABLE_NAME, $columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a single object by pkey.
|
||||
*
|
||||
* @param int $pk the primary key.
|
||||
* @param PropelPDO $con the connection to use
|
||||
* @return CcPlayoutHistory
|
||||
*/
|
||||
public static function retrieveByPK($pk, PropelPDO $con = null)
|
||||
{
|
||||
|
||||
if (null !== ($obj = CcPlayoutHistoryPeer::getInstanceFromPool((string) $pk))) {
|
||||
return $obj;
|
||||
}
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria = new Criteria(CcPlayoutHistoryPeer::DATABASE_NAME);
|
||||
$criteria->add(CcPlayoutHistoryPeer::ID, $pk);
|
||||
|
||||
$v = CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$objs = null;
|
||||
if (empty($pks)) {
|
||||
$objs = array();
|
||||
} else {
|
||||
$criteria = new Criteria(CcPlayoutHistoryPeer::DATABASE_NAME);
|
||||
$criteria->add(CcPlayoutHistoryPeer::ID, $pks, Criteria::IN);
|
||||
$objs = CcPlayoutHistoryPeer::doSelect($criteria, $con);
|
||||
}
|
||||
return $objs;
|
||||
}
|
||||
|
||||
} // BaseCcPlayoutHistoryPeer
|
||||
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
BaseCcPlayoutHistoryPeer::buildTableMap();
|
||||
|
|
@ -0,0 +1,406 @@
|
|||
<?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 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 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 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 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
|
||||
*
|
||||
* @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 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 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
|
|
@ -0,0 +1,893 @@
|
|||
<?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 template_name field.
|
||||
* @var string
|
||||
*/
|
||||
protected $template_name;
|
||||
|
||||
/**
|
||||
* @var array CcPlayoutHistoryTemplateTag[] Collection to store aggregation of CcPlayoutHistoryTemplateTag objects.
|
||||
*/
|
||||
protected $collCcPlayoutHistoryTemplateTags;
|
||||
|
||||
/**
|
||||
* 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 [template_name] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDbTemplateName()
|
||||
{
|
||||
return $this->template_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 [template_name] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return CcPlayoutHistoryTemplate The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbTemplateName($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->template_name !== $v) {
|
||||
$this->template_name = $v;
|
||||
$this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::TEMPLATE_NAME;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbTemplateName()
|
||||
|
||||
/**
|
||||
* 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->template_name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
||||
if ($rehydrate) {
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 2; // 2 = 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->collCcPlayoutHistoryTemplateTags = 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->collCcPlayoutHistoryTemplateTags !== null) {
|
||||
foreach ($this->collCcPlayoutHistoryTemplateTags 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->collCcPlayoutHistoryTemplateTags !== null) {
|
||||
foreach ($this->collCcPlayoutHistoryTemplateTags 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->getDbTemplateName();
|
||||
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->getDbTemplateName(),
|
||||
);
|
||||
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->setDbTemplateName($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->setDbTemplateName($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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
|
||||
|
||||
if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::ID)) $criteria->add(CcPlayoutHistoryTemplatePeer::ID, $this->id);
|
||||
if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::TEMPLATE_NAME)) $criteria->add(CcPlayoutHistoryTemplatePeer::TEMPLATE_NAME, $this->template_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(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->setDbTemplateName($this->template_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->getCcPlayoutHistoryTemplateTags() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addCcPlayoutHistoryTemplateTag($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 collCcPlayoutHistoryTemplateTags 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 addCcPlayoutHistoryTemplateTags()
|
||||
*/
|
||||
public function clearCcPlayoutHistoryTemplateTags()
|
||||
{
|
||||
$this->collCcPlayoutHistoryTemplateTags = null; // important to set this to NULL since that means it is uninitialized
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collCcPlayoutHistoryTemplateTags collection.
|
||||
*
|
||||
* By default this just sets the collCcPlayoutHistoryTemplateTags collection to an empty array (like clearcollCcPlayoutHistoryTemplateTags());
|
||||
* 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 initCcPlayoutHistoryTemplateTags()
|
||||
{
|
||||
$this->collCcPlayoutHistoryTemplateTags = new PropelObjectCollection();
|
||||
$this->collCcPlayoutHistoryTemplateTags->setModel('CcPlayoutHistoryTemplateTag');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of CcPlayoutHistoryTemplateTag 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 CcPlayoutHistoryTemplateTag[] List of CcPlayoutHistoryTemplateTag objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCcPlayoutHistoryTemplateTags($criteria = null, PropelPDO $con = null)
|
||||
{
|
||||
if(null === $this->collCcPlayoutHistoryTemplateTags || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCcPlayoutHistoryTemplateTags) {
|
||||
// return empty collection
|
||||
$this->initCcPlayoutHistoryTemplateTags();
|
||||
} else {
|
||||
$collCcPlayoutHistoryTemplateTags = CcPlayoutHistoryTemplateTagQuery::create(null, $criteria)
|
||||
->filterByCcPlayoutHistoryTemplate($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
return $collCcPlayoutHistoryTemplateTags;
|
||||
}
|
||||
$this->collCcPlayoutHistoryTemplateTags = $collCcPlayoutHistoryTemplateTags;
|
||||
}
|
||||
}
|
||||
return $this->collCcPlayoutHistoryTemplateTags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related CcPlayoutHistoryTemplateTag objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param PropelPDO $con
|
||||
* @return int Count of related CcPlayoutHistoryTemplateTag objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countCcPlayoutHistoryTemplateTags(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
|
||||
{
|
||||
if(null === $this->collCcPlayoutHistoryTemplateTags || null !== $criteria) {
|
||||
if ($this->isNew() && null === $this->collCcPlayoutHistoryTemplateTags) {
|
||||
return 0;
|
||||
} else {
|
||||
$query = CcPlayoutHistoryTemplateTagQuery::create(null, $criteria);
|
||||
if($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
return $query
|
||||
->filterByCcPlayoutHistoryTemplate($this)
|
||||
->count($con);
|
||||
}
|
||||
} else {
|
||||
return count($this->collCcPlayoutHistoryTemplateTags);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a CcPlayoutHistoryTemplateTag object to this object
|
||||
* through the CcPlayoutHistoryTemplateTag foreign key attribute.
|
||||
*
|
||||
* @param CcPlayoutHistoryTemplateTag $l CcPlayoutHistoryTemplateTag
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function addCcPlayoutHistoryTemplateTag(CcPlayoutHistoryTemplateTag $l)
|
||||
{
|
||||
if ($this->collCcPlayoutHistoryTemplateTags === null) {
|
||||
$this->initCcPlayoutHistoryTemplateTags();
|
||||
}
|
||||
if (!$this->collCcPlayoutHistoryTemplateTags->contains($l)) { // only add it if the **same** object is not already associated
|
||||
$this->collCcPlayoutHistoryTemplateTags[]= $l;
|
||||
$l->setCcPlayoutHistoryTemplate($this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this CcPlayoutHistoryTemplate is new, it will return
|
||||
* an empty collection; or if this CcPlayoutHistoryTemplate has previously
|
||||
* been saved, it will retrieve related CcPlayoutHistoryTemplateTags 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 CcPlayoutHistoryTemplate.
|
||||
*
|
||||
* @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 CcPlayoutHistoryTemplateTag[] List of CcPlayoutHistoryTemplateTag objects
|
||||
*/
|
||||
public function getCcPlayoutHistoryTemplateTagsJoinCcTag($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = CcPlayoutHistoryTemplateTagQuery::create(null, $criteria);
|
||||
$query->joinWith('CcTag', $join_behavior);
|
||||
|
||||
return $this->getCcPlayoutHistoryTemplateTags($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->template_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->collCcPlayoutHistoryTemplateTags) {
|
||||
foreach ((array) $this->collCcPlayoutHistoryTemplateTags as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
$this->collCcPlayoutHistoryTemplateTags = 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
|
|
@ -0,0 +1,742 @@
|
|||
<?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 = 2;
|
||||
|
||||
/** 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 TEMPLATE_NAME field */
|
||||
const TEMPLATE_NAME = 'cc_playout_history_template.TEMPLATE_NAME';
|
||||
|
||||
/**
|
||||
* 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', 'DbTemplateName', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTemplateName', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::TEMPLATE_NAME, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TEMPLATE_NAME', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'template_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, 'DbTemplateName' => 1, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTemplateName' => 1, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TEMPLATE_NAME => 1, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TEMPLATE_NAME' => 1, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'template_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. 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::TEMPLATE_NAME);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.TEMPLATE_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(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 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 = 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();
|
||||
|
|
@ -0,0 +1,259 @@
|
|||
<?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 orderByDbTemplateName($order = Criteria::ASC) Order by the template_name column
|
||||
*
|
||||
* @method CcPlayoutHistoryTemplateQuery groupByDbId() Group by the id column
|
||||
* @method CcPlayoutHistoryTemplateQuery groupByDbTemplateName() Group by the template_name 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 leftJoinCcPlayoutHistoryTemplateTag($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistoryTemplateTag relation
|
||||
* @method CcPlayoutHistoryTemplateQuery rightJoinCcPlayoutHistoryTemplateTag($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistoryTemplateTag relation
|
||||
* @method CcPlayoutHistoryTemplateQuery innerJoinCcPlayoutHistoryTemplateTag($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistoryTemplateTag 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 findOneByDbTemplateName(string $template_name) Return the first CcPlayoutHistoryTemplate filtered by the template_name column
|
||||
*
|
||||
* @method array findByDbId(int $id) Return CcPlayoutHistoryTemplate objects filtered by the id column
|
||||
* @method array findByDbTemplateName(string $template_name) Return CcPlayoutHistoryTemplate objects filtered by the template_name 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 template_name column
|
||||
*
|
||||
* @param string $dbTemplateName 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 filterByDbTemplateName($dbTemplateName = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($dbTemplateName)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $dbTemplateName)) {
|
||||
$dbTemplateName = str_replace('*', '%', $dbTemplateName);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::TEMPLATE_NAME, $dbTemplateName, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 CcPlayoutHistoryTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCcPlayoutHistoryTemplateTag($ccPlayoutHistoryTemplateTag, $comparison = null)
|
||||
{
|
||||
return $this
|
||||
->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $ccPlayoutHistoryTemplateTag->getDbTemplateId(), $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 CcPlayoutHistoryTemplateQuery 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 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
|
|
@ -0,0 +1,936 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Base class that represents a row from the 'cc_playout_history_template_tag' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package propel.generator.airtime.om
|
||||
*/
|
||||
abstract class BaseCcPlayoutHistoryTemplateTag extends BaseObject implements Persistent
|
||||
{
|
||||
|
||||
/**
|
||||
* Peer class name
|
||||
*/
|
||||
const PEER = 'CcPlayoutHistoryTemplateTagPeer';
|
||||
|
||||
/**
|
||||
* 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 CcPlayoutHistoryTemplateTagPeer
|
||||
*/
|
||||
protected static $peer;
|
||||
|
||||
/**
|
||||
* The value for the id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* The value for the template_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $template_id;
|
||||
|
||||
/**
|
||||
* The value for the tag_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $tag_id;
|
||||
|
||||
/**
|
||||
* @var CcPlayoutHistoryTemplate
|
||||
*/
|
||||
protected $aCcPlayoutHistoryTemplate;
|
||||
|
||||
/**
|
||||
* @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 [template_id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDbTemplateId()
|
||||
{
|
||||
return $this->template_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 CcPlayoutHistoryTemplateTag 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[] = CcPlayoutHistoryTemplateTagPeer::ID;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbId()
|
||||
|
||||
/**
|
||||
* Set the value of [template_id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return CcPlayoutHistoryTemplateTag The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbTemplateId($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->template_id !== $v) {
|
||||
$this->template_id = $v;
|
||||
$this->modifiedColumns[] = CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID;
|
||||
}
|
||||
|
||||
if ($this->aCcPlayoutHistoryTemplate !== null && $this->aCcPlayoutHistoryTemplate->getDbId() !== $v) {
|
||||
$this->aCcPlayoutHistoryTemplate = null;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbTemplateId()
|
||||
|
||||
/**
|
||||
* Set the value of [tag_id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return CcPlayoutHistoryTemplateTag 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[] = CcPlayoutHistoryTemplateTagPeer::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->template_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 = CcPlayoutHistoryTemplateTagPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateTagPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating CcPlayoutHistoryTemplateTag 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->aCcPlayoutHistoryTemplate !== null && $this->template_id !== $this->aCcPlayoutHistoryTemplate->getDbId()) {
|
||||
$this->aCcPlayoutHistoryTemplate = 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(CcPlayoutHistoryTemplateTagPeer::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 = CcPlayoutHistoryTemplateTagPeer::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->aCcPlayoutHistoryTemplate = 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(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||
}
|
||||
|
||||
$con->beginTransaction();
|
||||
try {
|
||||
$ret = $this->preDelete($con);
|
||||
if ($ret) {
|
||||
CcPlayoutHistoryTemplateTagQuery::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(CcPlayoutHistoryTemplateTagPeer::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);
|
||||
CcPlayoutHistoryTemplateTagPeer::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->aCcPlayoutHistoryTemplate !== null) {
|
||||
if ($this->aCcPlayoutHistoryTemplate->isModified() || $this->aCcPlayoutHistoryTemplate->isNew()) {
|
||||
$affectedRows += $this->aCcPlayoutHistoryTemplate->save($con);
|
||||
}
|
||||
$this->setCcPlayoutHistoryTemplate($this->aCcPlayoutHistoryTemplate);
|
||||
}
|
||||
|
||||
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[] = CcPlayoutHistoryTemplateTagPeer::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(CcPlayoutHistoryTemplateTagPeer::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplateTagPeer::ID.')');
|
||||
}
|
||||
|
||||
$pk = BasePeer::doInsert($criteria, $con);
|
||||
$affectedRows += 1;
|
||||
$this->setDbId($pk); //[IMV] update autoincrement primary key
|
||||
$this->setNew(false);
|
||||
} else {
|
||||
$affectedRows += CcPlayoutHistoryTemplateTagPeer::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->aCcPlayoutHistoryTemplate !== null) {
|
||||
if (!$this->aCcPlayoutHistoryTemplate->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aCcPlayoutHistoryTemplate->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->aCcTag !== null) {
|
||||
if (!$this->aCcTag->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aCcTag->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($retval = CcPlayoutHistoryTemplateTagPeer::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 = CcPlayoutHistoryTemplateTagPeer::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->getDbTemplateId();
|
||||
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 = CcPlayoutHistoryTemplateTagPeer::getFieldNames($keyType);
|
||||
$result = array(
|
||||
$keys[0] => $this->getDbId(),
|
||||
$keys[1] => $this->getDbTemplateId(),
|
||||
$keys[2] => $this->getDbTagId(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->aCcPlayoutHistoryTemplate) {
|
||||
$result['CcPlayoutHistoryTemplate'] = $this->aCcPlayoutHistoryTemplate->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 = CcPlayoutHistoryTemplateTagPeer::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->setDbTemplateId($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 = CcPlayoutHistoryTemplateTagPeer::getFieldNames($keyType);
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setDbTemplateId($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(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME);
|
||||
|
||||
if ($this->isColumnModified(CcPlayoutHistoryTemplateTagPeer::ID)) $criteria->add(CcPlayoutHistoryTemplateTagPeer::ID, $this->id);
|
||||
if ($this->isColumnModified(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID)) $criteria->add(CcPlayoutHistoryTemplateTagPeer::TEMPLATE_ID, $this->template_id);
|
||||
if ($this->isColumnModified(CcPlayoutHistoryTemplateTagPeer::TAG_ID)) $criteria->add(CcPlayoutHistoryTemplateTagPeer::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(CcPlayoutHistoryTemplateTagPeer::DATABASE_NAME);
|
||||
$criteria->add(CcPlayoutHistoryTemplateTagPeer::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 CcPlayoutHistoryTemplateTag (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->setDbTemplateId($this->template_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 CcPlayoutHistoryTemplateTag 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 CcPlayoutHistoryTemplateTagPeer
|
||||
*/
|
||||
public function getPeer()
|
||||
{
|
||||
if (self::$peer === null) {
|
||||
self::$peer = new CcPlayoutHistoryTemplateTagPeer();
|
||||
}
|
||||
return self::$peer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a CcPlayoutHistoryTemplate object.
|
||||
*
|
||||
* @param CcPlayoutHistoryTemplate $v
|
||||
* @return CcPlayoutHistoryTemplateTag The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setCcPlayoutHistoryTemplate(CcPlayoutHistoryTemplate $v = null)
|
||||
{
|
||||
if ($v === null) {
|
||||
$this->setDbTemplateId(NULL);
|
||||
} else {
|
||||
$this->setDbTemplateId($v->getDbId());
|
||||
}
|
||||
|
||||
$this->aCcPlayoutHistoryTemplate = $v;
|
||||
|
||||
// Add binding for other direction of this n:n relationship.
|
||||
// If this object has already been added to the CcPlayoutHistoryTemplate object, it will not be re-added.
|
||||
if ($v !== null) {
|
||||
$v->addCcPlayoutHistoryTemplateTag($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the associated CcPlayoutHistoryTemplate object
|
||||
*
|
||||
* @param PropelPDO Optional Connection object.
|
||||
* @return CcPlayoutHistoryTemplate The associated CcPlayoutHistoryTemplate object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCcPlayoutHistoryTemplate(PropelPDO $con = null)
|
||||
{
|
||||
if ($this->aCcPlayoutHistoryTemplate === null && ($this->template_id !== null)) {
|
||||
$this->aCcPlayoutHistoryTemplate = CcPlayoutHistoryTemplateQuery::create()->findPk($this->template_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->aCcPlayoutHistoryTemplate->addCcPlayoutHistoryTemplateTags($this);
|
||||
*/
|
||||
}
|
||||
return $this->aCcPlayoutHistoryTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a CcTag object.
|
||||
*
|
||||
* @param CcTag $v
|
||||
* @return CcPlayoutHistoryTemplateTag 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->addCcPlayoutHistoryTemplateTag($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->addCcPlayoutHistoryTemplateTags($this);
|
||||
*/
|
||||
}
|
||||
return $this->aCcTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->template_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->aCcPlayoutHistoryTemplate = 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);
|
||||
}
|
||||
|
||||
} // BaseCcPlayoutHistoryTemplateTag
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,371 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'cc_playout_history_template_tag' 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 orderByDbTagId($order = Criteria::ASC) Order by the tag_id column
|
||||
*
|
||||
* @method CcPlayoutHistoryTemplateTagQuery groupByDbId() Group by the id column
|
||||
* @method CcPlayoutHistoryTemplateTagQuery groupByDbTemplateId() Group by the template_id column
|
||||
* @method CcPlayoutHistoryTemplateTagQuery groupByDbTagId() Group by the tag_id 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 CcPlayoutHistoryTemplateTagQuery leftJoinCcTag($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcTag relation
|
||||
* @method CcPlayoutHistoryTemplateTagQuery rightJoinCcTag($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcTag relation
|
||||
* @method CcPlayoutHistoryTemplateTagQuery innerJoinCcTag($relationAlias = '') Adds a INNER JOIN clause to the query using the CcTag 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 findOneByDbTagId(int $tag_id) Return the first CcPlayoutHistoryTemplateTag filtered by the tag_id 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 findByDbTagId(int $tag_id) Return CcPlayoutHistoryTemplateTag objects filtered by the tag_id 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 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 CcPlayoutHistoryTemplateTagQuery 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(CcPlayoutHistoryTemplateTagPeer::TAG_ID, $dbTagId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($dbTagId['max'])) {
|
||||
$this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::TAG_ID, $dbTagId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::TAG_ID, $dbTagId, $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');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 CcPlayoutHistoryTemplateTagQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCcTag($ccTag, $comparison = null)
|
||||
{
|
||||
return $this
|
||||
->addUsingAlias(CcPlayoutHistoryTemplateTagPeer::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 CcPlayoutHistoryTemplateTagQuery 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 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
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,745 @@
|
|||
<?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 = 2;
|
||||
|
||||
/** 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';
|
||||
|
||||
/**
|
||||
* 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', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTagName', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::TAG_NAME, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TAG_NAME', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'tag_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, 'DbTagName' => 1, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTagName' => 1, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TAG_NAME => 1, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TAG_NAME' => 1, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'tag_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. 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);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.TAG_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(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 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();
|
||||
|
|
@ -0,0 +1,327 @@
|
|||
<?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 groupByDbId() Group by the id column
|
||||
* @method CcTagQuery groupByDbTagName() Group by the tag_name 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 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 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
|
||||
*
|
||||
* @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 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 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
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
class Application_Service_HistoryService
|
||||
{
|
||||
private $con;
|
||||
private $timezone;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->con = isset($con) ? $con : Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME);
|
||||
$this->timezone = date_default_timezone_get();
|
||||
}
|
||||
|
||||
public function insertPlayedItem($schedId) {
|
||||
|
||||
$this->con->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
$item = CcScheduleQuery::create()->findPK($schedId, $this->con);
|
||||
|
||||
//TODO figure out how to combine these all into 1 query.
|
||||
$showInstance = $item->getCcShowInstances($this->con);
|
||||
$show = $showInstance->getCcShow($this->con);
|
||||
|
||||
$fileId = $item->getDbFileId();
|
||||
|
||||
//don't add webstreams
|
||||
if (isset($fileId)) {
|
||||
|
||||
//$starts = $item->getDbStarts(null);
|
||||
//$ends = $item->getDbEnds(null);
|
||||
|
||||
$metadata = array();
|
||||
//$metadata["date"] = $starts->format('Y-m-d');
|
||||
//$metadata["start"] = $starts->format('H:i:s');
|
||||
//$metadata["end"] = $ends->format('H:i:s');
|
||||
$metadata["showname"] = $show->getDbName();
|
||||
|
||||
$history = new CcPlayoutHistory();
|
||||
$history->setDbFileId($fileId);
|
||||
$history->setDbStarts($item->getDbStarts(null));
|
||||
$history->setDbEnds($item->getDbEnds(null));
|
||||
|
||||
foreach ($metadata as $key => $val) {
|
||||
$meta = new CcPlayoutHistoryMetaData();
|
||||
$meta->setDbKey($key);
|
||||
$meta->setDbValue($val);
|
||||
|
||||
$history->addCcPlayoutHistoryMetaData($meta);
|
||||
}
|
||||
|
||||
$history->save($this->con);
|
||||
}
|
||||
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -479,4 +479,52 @@
|
|||
<column name="locale_code" phpName="DbLocaleCode" type="VARCHAR" size="16" required="true" />
|
||||
<column name="locale_lang" phpName="DbLocaleLang" type="VARCHAR" size="128" required="true" />
|
||||
</table>
|
||||
<table name="cc_tag" phpName="CcTag">
|
||||
<column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
|
||||
<column name="tag_name" phpName="DbTagName" type="VARCHAR" size="128" required="true" />
|
||||
</table>
|
||||
<table name="cc_file_tag" phpName="CcFileTag">
|
||||
<column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
|
||||
<column name="file_id" phpName="DbFileId" type="INTEGER" required="true" />
|
||||
<column name="tag_id" phpName="DbTagId" type="INTEGER" required="true" />
|
||||
<foreign-key foreignTable="cc_files" name="cc_file_tag_file_fkey" onDelete="CASCADE">
|
||||
<reference local="file_id" foreign="id"/>
|
||||
</foreign-key>
|
||||
<foreign-key foreignTable="cc_tag" name="c_file_tag_tag_fkey" onDelete="CASCADE">
|
||||
<reference local="tag_id" foreign="id"/>
|
||||
</foreign-key>
|
||||
</table>
|
||||
<table name="cc_playout_history" phpName="CcPlayoutHistory">
|
||||
<column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
|
||||
<column name="file_id" phpName="DbFileId" type="INTEGER" required="false" />
|
||||
<column name="starts" phpName="DbStarts" type="TIMESTAMP" required="true"/>
|
||||
<column name="ends" phpName="DbEnds" type="TIMESTAMP" required="true"/>
|
||||
<foreign-key foreignTable="cc_files" name="cc_playout_history_file_tag_fkey" onDelete="CASCADE">
|
||||
<reference local="file_id" foreign="id"/>
|
||||
</foreign-key>
|
||||
</table>
|
||||
<table name="cc_playout_history_metadata" phpName="CcPlayoutHistoryMetaData">
|
||||
<column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
|
||||
<column name="history_id" phpName="DbHistoryId" type="INTEGER" required="true" />
|
||||
<column name="key" phpName="DbKey" type="VARCHAR" size="128" required="true" />
|
||||
<column name="value" phpName="DbValue" type="VARCHAR" size="128" required="true" />
|
||||
<foreign-key foreignTable="cc_playout_history" name="cc_playout_history_metadata_entry_fkey" onDelete="CASCADE">
|
||||
<reference local="history_id" foreign="id"/>
|
||||
</foreign-key>
|
||||
</table>
|
||||
<table name="cc_playout_history_template" phpName="CcPlayoutHistoryTemplate">
|
||||
<column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
|
||||
<column name="template_name" phpName="DbTemplateName" type="VARCHAR" size="128" required="true" />
|
||||
</table>
|
||||
<table name="cc_playout_history_template_tag" phpName="CcPlayoutHistoryTemplateTag">
|
||||
<column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />
|
||||
<column name="template_id" phpName="DbTemplateId" type="INTEGER" required="true" />
|
||||
<column name="tag_id" phpName="DbTagId" type="INTEGER" required="true" />
|
||||
<foreign-key foreignTable="cc_playout_history_template" name="cc_playout_history_template_template_fkey" onDelete="CASCADE">
|
||||
<reference local="template_id" foreign="id"/>
|
||||
</foreign-key>
|
||||
<foreign-key foreignTable="cc_tag" name="cc_playout_history_template_tag_fkey" onDelete="CASCADE">
|
||||
<reference local="tag_id" foreign="id"/>
|
||||
</foreign-key>
|
||||
</table>
|
||||
</database>
|
||||
|
|
|
@ -752,6 +752,120 @@ CREATE TABLE "cc_locale"
|
|||
COMMENT ON TABLE "cc_locale" IS '';
|
||||
|
||||
|
||||
SET search_path TO public;
|
||||
-----------------------------------------------------------------------------
|
||||
-- cc_tag
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE "cc_tag" CASCADE;
|
||||
|
||||
|
||||
CREATE TABLE "cc_tag"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"tag_name" VARCHAR(128) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
COMMENT ON TABLE "cc_tag" IS '';
|
||||
|
||||
|
||||
SET search_path TO public;
|
||||
-----------------------------------------------------------------------------
|
||||
-- cc_file_tag
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE "cc_file_tag" CASCADE;
|
||||
|
||||
|
||||
CREATE TABLE "cc_file_tag"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"file_id" INTEGER NOT NULL,
|
||||
"tag_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
COMMENT ON TABLE "cc_file_tag" IS '';
|
||||
|
||||
|
||||
SET search_path TO public;
|
||||
-----------------------------------------------------------------------------
|
||||
-- cc_playout_history
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE "cc_playout_history" CASCADE;
|
||||
|
||||
|
||||
CREATE TABLE "cc_playout_history"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"file_id" INTEGER,
|
||||
"starts" TIMESTAMP NOT NULL,
|
||||
"ends" TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
COMMENT ON TABLE "cc_playout_history" IS '';
|
||||
|
||||
|
||||
SET search_path TO public;
|
||||
-----------------------------------------------------------------------------
|
||||
-- cc_playout_history_metadata
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE "cc_playout_history_metadata" CASCADE;
|
||||
|
||||
|
||||
CREATE TABLE "cc_playout_history_metadata"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"history_id" INTEGER NOT NULL,
|
||||
"key" VARCHAR(128) NOT NULL,
|
||||
"value" VARCHAR(128) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
COMMENT ON TABLE "cc_playout_history_metadata" IS '';
|
||||
|
||||
|
||||
SET search_path TO public;
|
||||
-----------------------------------------------------------------------------
|
||||
-- cc_playout_history_template
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE "cc_playout_history_template" CASCADE;
|
||||
|
||||
|
||||
CREATE TABLE "cc_playout_history_template"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"template_name" VARCHAR(128) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
COMMENT ON TABLE "cc_playout_history_template" IS '';
|
||||
|
||||
|
||||
SET search_path TO public;
|
||||
-----------------------------------------------------------------------------
|
||||
-- cc_playout_history_template_tag
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE "cc_playout_history_template_tag" CASCADE;
|
||||
|
||||
|
||||
CREATE TABLE "cc_playout_history_template_tag"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"template_id" INTEGER NOT NULL,
|
||||
"tag_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
COMMENT ON TABLE "cc_playout_history_template_tag" IS '';
|
||||
|
||||
|
||||
SET search_path TO public;
|
||||
ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_owner_fkey" FOREIGN KEY ("owner_id") REFERENCES "cc_subjs" ("id");
|
||||
|
||||
|
@ -808,3 +922,15 @@ ALTER TABLE "cc_webstream_metadata" ADD CONSTRAINT "cc_schedule_inst_fkey" FOREI
|
|||
ALTER TABLE "cc_listener_count" ADD CONSTRAINT "cc_timestamp_inst_fkey" FOREIGN KEY ("timestamp_id") REFERENCES "cc_timestamp" ("id") ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_listener_count" ADD CONSTRAINT "cc_mount_name_inst_fkey" FOREIGN KEY ("mount_name_id") REFERENCES "cc_mount_name" ("id") ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_file_tag" ADD CONSTRAINT "cc_file_tag_file_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_file_tag" ADD CONSTRAINT "c_file_tag_tag_fkey" FOREIGN KEY ("tag_id") REFERENCES "cc_tag" ("id") ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playout_history" ADD CONSTRAINT "cc_playout_history_file_tag_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playout_history_metadata" ADD CONSTRAINT "cc_playout_history_metadata_entry_fkey" FOREIGN KEY ("history_id") REFERENCES "cc_playout_history" ("id") ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playout_history_template_tag" ADD CONSTRAINT "cc_playout_history_template_template_fkey" FOREIGN KEY ("template_id") REFERENCES "cc_playout_history_template" ("id") ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playout_history_template_tag" ADD CONSTRAINT "cc_playout_history_template_tag_fkey" FOREIGN KEY ("tag_id") REFERENCES "cc_tag" ("id") ON DELETE CASCADE;
|
||||
|
|
Loading…
Reference in New Issue