Merge branch 'cc-5709-airtime-analyzer-cloud-storage' into cc-5709-airtime-analyzer

Conflicts:
	airtime_mvc/application/models/airtime/CcFiles.php
	airtime_mvc/application/modules/rest/controllers/MediaController.php
This commit is contained in:
Albert Santoni 2015-02-20 11:14:11 -05:00
commit 6d00da89db
601 changed files with 118801 additions and 207033 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
.*
*.pyc
vendor/*
composer.phar

View File

@ -3,10 +3,16 @@ require_once __DIR__."/configs/conf.php";
$CC_CONFIG = Config::getConfig();
require_once __DIR__."/configs/ACL.php";
require_once 'propel/runtime/lib/Propel.php';
if (!@include_once('propel/propel1/runtime/lib/Propel.php'))
{
die('Error: Propel not found. Did you install Airtime\'s third-party dependencies with composer? (Check the README.)');
}
Propel::init(__DIR__."/configs/airtime-conf-production.php");
//Composer's autoloader
require_once 'autoload.php';
require_once __DIR__."/configs/constants.php";
require_once 'Preference.php';
require_once 'Locale.php';

View File

@ -0,0 +1,62 @@
<?php
require_once 'StorageBackend.php';
use Aws\S3\S3Client;
class Amazon_S3 extends StorageBackend
{
private $s3Client;
public function Amazon_S3($securityCredentials)
{
$this->setBucket($securityCredentials['bucket']);
$this->setAccessKey($securityCredentials['api_key']);
$this->setSecretKey($securityCredentials['api_key_secret']);
$this->s3Client = S3Client::factory(array(
'key' => $securityCredentials['api_key'],
'secret' => $securityCredentials['api_key_secret'],
'region' => $securityCredentials['region']
));
}
public function getAbsoluteFilePath($resourceId)
{
return $this->s3Client->getObjectUrl($this->getBucket(), $resourceId);
}
public function getSignedURL($resourceId)
{
return $this->s3Client->getObjectUrl($this->getBucket(), $resourceId, '+60 minutes');
}
public function getFileSize($resourceId)
{
$obj = $this->s3Client->getObject(array(
'Bucket' => $this->getBucket(),
'Key' => $resourceId,
));
if (isset($obj["ContentLength"])) {
return (int)$obj["ContentLength"];
} else {
return 0;
}
}
public function deletePhysicalFile($resourceId)
{
$bucket = $this->getBucket();
if ($this->s3Client->doesObjectExist($bucket, $resourceId)) {
$result = $this->s3Client->deleteObject(array(
'Bucket' => $bucket,
'Key' => $resourceId,
));
} else {
throw new Exception("ERROR: Could not locate file to delete.");
}
}
}

View File

@ -0,0 +1,49 @@
<?php
require_once 'StorageBackend.php';
require_once 'Amazon_S3.php';
/**
*
* Controls access to the storage backend class where a file is stored.
*
*/
class ProxyStorageBackend extends StorageBackend
{
private $storageBackend;
/**
* Receives the file's storage backend and instantiates the approriate
* object.
*/
public function ProxyStorageBackend($storageBackend)
{
$CC_CONFIG = Config::getConfig();
//The storage backend in the airtime.conf directly corresponds to
//the name of the class that implements it (eg. Amazon_S3), so we
//can easily create the right backend object dynamically:
$this->storageBackend = new $storageBackend($CC_CONFIG[$storageBackend]);
}
public function getAbsoluteFilePath($resourceId)
{
return $this->storageBackend->getAbsoluteFilePath($resourceId);
}
public function getSignedURL($resourceId)
{
return $this->storageBackend->getSignedURL($resourceId);
}
public function getFileSize($resourceId)
{
return $this->storageBackend->getFileSize($resourceId);
}
public function deletePhysicalFile($resourceId)
{
$this->storageBackend->deletePhysicalFile($resourceId);
}
}

View File

@ -0,0 +1,55 @@
<?php
/**
*
* Provides access to file objects stored on a specific storage backend.
*/
abstract class StorageBackend
{
private $bucket;
private $accessKey;
private $secretKey;
/** Returns the file object's URL to the storage backend it is located on. */
abstract public function getAbsoluteFilePath($resourceId);
/** Returns the file object's signed URL. The URL must be signed since they
* privately stored on the storage backend. */
abstract public function getSignedURL($resourceId);
/** Returns the file's size in bytes. */
abstract public function getFileSize($resourceId);
/** Deletes the file from the storage backend. */
abstract public function deletePhysicalFile($resourceId);
protected function getBucket()
{
return $this->bucket;
}
protected function setBucket($bucket)
{
$this->bucket = $bucket;
}
protected function getAccessKey()
{
return $this->accessKey;
}
protected function setAccessKey($accessKey)
{
$this->accessKey = $accessKey;
}
protected function getSecretKey()
{
return $this->secretKey;
}
protected function setSecretKey($secretKey)
{
$this->secretKey = $secretKey;
}
}

View File

@ -28,7 +28,7 @@ $conf = array (
),
'default' => 'airtime',
),
'generator_version' => '1.5.2',
'generator_version' => '1.7.0',
);
$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-airtime-conf.php');
return $conf;

View File

@ -1,5 +1,5 @@
<?php
// This file generated by Propel 1.5.2 convert-conf target
// This file generated by Propel 1.7.0 convert-conf target
// from XML runtime conf file /home/ubuntu/airtime/airtime_mvc/build/runtime-conf.xml
$conf = array (
'datasources' =>
@ -22,7 +22,7 @@ $conf = array (
),
'default' => 'airtime',
),
'generator_version' => '1.5.2',
'generator_version' => '1.7.0',
);
$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-airtime-conf.php');
return $conf;

View File

@ -1,242 +1,242 @@
<?php
// This file generated by Propel 1.5.2 convert-conf target
// This file generated by Propel 1.7.0 convert-conf target
return array (
'CcMusicDirsTableMap' => 'airtime/map/CcMusicDirsTableMap.php',
'CcMusicDirsPeer' => 'airtime/CcMusicDirsPeer.php',
'CcMusicDirs' => 'airtime/CcMusicDirs.php',
'CcMusicDirsQuery' => 'airtime/CcMusicDirsQuery.php',
'BaseCcMusicDirsPeer' => 'airtime/om/BaseCcMusicDirsPeer.php',
'BaseCcMusicDirs' => 'airtime/om/BaseCcMusicDirs.php',
'BaseCcMusicDirsQuery' => 'airtime/om/BaseCcMusicDirsQuery.php',
'CcFilesTableMap' => 'airtime/map/CcFilesTableMap.php',
'CcFilesPeer' => 'airtime/CcFilesPeer.php',
'CcFiles' => 'airtime/CcFiles.php',
'CcFilesQuery' => 'airtime/CcFilesQuery.php',
'BaseCcFilesPeer' => 'airtime/om/BaseCcFilesPeer.php',
'BaseCcFiles' => 'airtime/om/BaseCcFiles.php',
'BaseCcFilesQuery' => 'airtime/om/BaseCcFilesQuery.php',
'CcPermsTableMap' => 'airtime/map/CcPermsTableMap.php',
'CcPermsPeer' => 'airtime/CcPermsPeer.php',
'CcPerms' => 'airtime/CcPerms.php',
'CcPermsQuery' => 'airtime/CcPermsQuery.php',
'BaseCcPermsPeer' => 'airtime/om/BaseCcPermsPeer.php',
'BaseCcPerms' => 'airtime/om/BaseCcPerms.php',
'BaseCcPermsQuery' => 'airtime/om/BaseCcPermsQuery.php',
'CcShowTableMap' => 'airtime/map/CcShowTableMap.php',
'CcShowPeer' => 'airtime/CcShowPeer.php',
'CcShow' => 'airtime/CcShow.php',
'CcShowQuery' => 'airtime/CcShowQuery.php',
'BaseCcShowPeer' => 'airtime/om/BaseCcShowPeer.php',
'BaseCcShow' => 'airtime/om/BaseCcShow.php',
'BaseCcShowQuery' => 'airtime/om/BaseCcShowQuery.php',
'CcShowInstancesTableMap' => 'airtime/map/CcShowInstancesTableMap.php',
'CcShowInstancesPeer' => 'airtime/CcShowInstancesPeer.php',
'CcShowInstances' => 'airtime/CcShowInstances.php',
'CcShowInstancesQuery' => 'airtime/CcShowInstancesQuery.php',
'BaseCcShowInstancesPeer' => 'airtime/om/BaseCcShowInstancesPeer.php',
'BaseCcShowInstances' => 'airtime/om/BaseCcShowInstances.php',
'BaseCcShowInstancesQuery' => 'airtime/om/BaseCcShowInstancesQuery.php',
'CcShowDaysTableMap' => 'airtime/map/CcShowDaysTableMap.php',
'CcShowDaysPeer' => 'airtime/CcShowDaysPeer.php',
'CcShowDays' => 'airtime/CcShowDays.php',
'CcShowDaysQuery' => 'airtime/CcShowDaysQuery.php',
'BaseCcShowDaysPeer' => 'airtime/om/BaseCcShowDaysPeer.php',
'BaseCcShowDays' => 'airtime/om/BaseCcShowDays.php',
'BaseCcShowDaysQuery' => 'airtime/om/BaseCcShowDaysQuery.php',
'CcShowRebroadcastTableMap' => 'airtime/map/CcShowRebroadcastTableMap.php',
'CcShowRebroadcastPeer' => 'airtime/CcShowRebroadcastPeer.php',
'CcShowRebroadcast' => 'airtime/CcShowRebroadcast.php',
'CcShowRebroadcastQuery' => 'airtime/CcShowRebroadcastQuery.php',
'BaseCcShowRebroadcastPeer' => 'airtime/om/BaseCcShowRebroadcastPeer.php',
'BaseCcShowRebroadcast' => 'airtime/om/BaseCcShowRebroadcast.php',
'BaseCcShowRebroadcastQuery' => 'airtime/om/BaseCcShowRebroadcastQuery.php',
'CcShowHostsTableMap' => 'airtime/map/CcShowHostsTableMap.php',
'CcShowHostsPeer' => 'airtime/CcShowHostsPeer.php',
'CcShowHosts' => 'airtime/CcShowHosts.php',
'CcShowHostsQuery' => 'airtime/CcShowHostsQuery.php',
'BaseCcShowHostsPeer' => 'airtime/om/BaseCcShowHostsPeer.php',
'BaseCcShowHosts' => 'airtime/om/BaseCcShowHosts.php',
'BaseCcShowHostsQuery' => 'airtime/om/BaseCcShowHostsQuery.php',
'CcPlaylistTableMap' => 'airtime/map/CcPlaylistTableMap.php',
'CcPlaylistPeer' => 'airtime/CcPlaylistPeer.php',
'CcPlaylist' => 'airtime/CcPlaylist.php',
'CcPlaylistQuery' => 'airtime/CcPlaylistQuery.php',
'BaseCcPlaylistPeer' => 'airtime/om/BaseCcPlaylistPeer.php',
'BaseCcPlaylist' => 'airtime/om/BaseCcPlaylist.php',
'BaseCcPlaylistQuery' => 'airtime/om/BaseCcPlaylistQuery.php',
'CcPlaylistcontentsTableMap' => 'airtime/map/CcPlaylistcontentsTableMap.php',
'CcPlaylistcontentsPeer' => 'airtime/CcPlaylistcontentsPeer.php',
'CcPlaylistcontents' => 'airtime/CcPlaylistcontents.php',
'CcPlaylistcontentsQuery' => 'airtime/CcPlaylistcontentsQuery.php',
'BaseCcPlaylistcontentsPeer' => 'airtime/om/BaseCcPlaylistcontentsPeer.php',
'BaseCcPlaylistcontents' => 'airtime/om/BaseCcPlaylistcontents.php',
'BaseCcPlaylistcontentsQuery' => 'airtime/om/BaseCcPlaylistcontentsQuery.php',
'CcBlockTableMap' => 'airtime/map/CcBlockTableMap.php',
'CcBlockPeer' => 'airtime/CcBlockPeer.php',
'CcBlock' => 'airtime/CcBlock.php',
'CcBlockQuery' => 'airtime/CcBlockQuery.php',
'BaseCcBlockPeer' => 'airtime/om/BaseCcBlockPeer.php',
'BaseCcBlock' => 'airtime/om/BaseCcBlock.php',
'BaseCcBlockPeer' => 'airtime/om/BaseCcBlockPeer.php',
'BaseCcBlockQuery' => 'airtime/om/BaseCcBlockQuery.php',
'CcBlockcontentsTableMap' => 'airtime/map/CcBlockcontentsTableMap.php',
'CcBlockcontentsPeer' => 'airtime/CcBlockcontentsPeer.php',
'CcBlockcontents' => 'airtime/CcBlockcontents.php',
'CcBlockcontentsQuery' => 'airtime/CcBlockcontentsQuery.php',
'BaseCcBlockcontentsPeer' => 'airtime/om/BaseCcBlockcontentsPeer.php',
'BaseCcBlockcontents' => 'airtime/om/BaseCcBlockcontents.php',
'BaseCcBlockcontentsPeer' => 'airtime/om/BaseCcBlockcontentsPeer.php',
'BaseCcBlockcontentsQuery' => 'airtime/om/BaseCcBlockcontentsQuery.php',
'CcBlockcriteriaTableMap' => 'airtime/map/CcBlockcriteriaTableMap.php',
'CcBlockcriteriaPeer' => 'airtime/CcBlockcriteriaPeer.php',
'CcBlockcriteria' => 'airtime/CcBlockcriteria.php',
'CcBlockcriteriaQuery' => 'airtime/CcBlockcriteriaQuery.php',
'BaseCcBlockcriteriaPeer' => 'airtime/om/BaseCcBlockcriteriaPeer.php',
'BaseCcBlockcriteria' => 'airtime/om/BaseCcBlockcriteria.php',
'BaseCcBlockcriteriaPeer' => 'airtime/om/BaseCcBlockcriteriaPeer.php',
'BaseCcBlockcriteriaQuery' => 'airtime/om/BaseCcBlockcriteriaQuery.php',
'CcPrefTableMap' => 'airtime/map/CcPrefTableMap.php',
'CcPrefPeer' => 'airtime/CcPrefPeer.php',
'CcPref' => 'airtime/CcPref.php',
'CcPrefQuery' => 'airtime/CcPrefQuery.php',
'BaseCcPrefPeer' => 'airtime/om/BaseCcPrefPeer.php',
'BaseCcPref' => 'airtime/om/BaseCcPref.php',
'BaseCcPrefQuery' => 'airtime/om/BaseCcPrefQuery.php',
'CcScheduleTableMap' => 'airtime/map/CcScheduleTableMap.php',
'CcSchedulePeer' => 'airtime/CcSchedulePeer.php',
'CcSchedule' => 'airtime/CcSchedule.php',
'CcScheduleQuery' => 'airtime/CcScheduleQuery.php',
'BaseCcSchedulePeer' => 'airtime/om/BaseCcSchedulePeer.php',
'BaseCcSchedule' => 'airtime/om/BaseCcSchedule.php',
'BaseCcScheduleQuery' => 'airtime/om/BaseCcScheduleQuery.php',
'CcSessTableMap' => 'airtime/map/CcSessTableMap.php',
'CcSessPeer' => 'airtime/CcSessPeer.php',
'CcSess' => 'airtime/CcSess.php',
'CcSessQuery' => 'airtime/CcSessQuery.php',
'BaseCcSessPeer' => 'airtime/om/BaseCcSessPeer.php',
'BaseCcSess' => 'airtime/om/BaseCcSess.php',
'BaseCcSessQuery' => 'airtime/om/BaseCcSessQuery.php',
'CcSmembTableMap' => 'airtime/map/CcSmembTableMap.php',
'CcSmembPeer' => 'airtime/CcSmembPeer.php',
'CcSmemb' => 'airtime/CcSmemb.php',
'CcSmembQuery' => 'airtime/CcSmembQuery.php',
'BaseCcSmembPeer' => 'airtime/om/BaseCcSmembPeer.php',
'BaseCcSmemb' => 'airtime/om/BaseCcSmemb.php',
'BaseCcSmembQuery' => 'airtime/om/BaseCcSmembQuery.php',
'CcSubjsTableMap' => 'airtime/map/CcSubjsTableMap.php',
'CcSubjsPeer' => 'airtime/CcSubjsPeer.php',
'CcSubjs' => 'airtime/CcSubjs.php',
'CcSubjsQuery' => 'airtime/CcSubjsQuery.php',
'BaseCcSubjsPeer' => 'airtime/om/BaseCcSubjsPeer.php',
'BaseCcSubjs' => 'airtime/om/BaseCcSubjs.php',
'BaseCcSubjsQuery' => 'airtime/om/BaseCcSubjsQuery.php',
'CcSubjsTokenTableMap' => 'airtime/map/CcSubjsTokenTableMap.php',
'CcSubjsTokenPeer' => 'airtime/CcSubjsTokenPeer.php',
'CcSubjsToken' => 'airtime/CcSubjsToken.php',
'CcSubjsTokenQuery' => 'airtime/CcSubjsTokenQuery.php',
'BaseCcSubjsTokenPeer' => 'airtime/om/BaseCcSubjsTokenPeer.php',
'BaseCcSubjsToken' => 'airtime/om/BaseCcSubjsToken.php',
'BaseCcSubjsTokenQuery' => 'airtime/om/BaseCcSubjsTokenQuery.php',
'CcCountryTableMap' => 'airtime/map/CcCountryTableMap.php',
'CcCountryPeer' => 'airtime/CcCountryPeer.php',
'CcCountry' => 'airtime/CcCountry.php',
'CcCountryQuery' => 'airtime/CcCountryQuery.php',
'BaseCcCountryPeer' => 'airtime/om/BaseCcCountryPeer.php',
'BaseCcCountry' => 'airtime/om/BaseCcCountry.php',
'BaseCcCountryPeer' => 'airtime/om/BaseCcCountryPeer.php',
'BaseCcCountryQuery' => 'airtime/om/BaseCcCountryQuery.php',
'CcStreamSettingTableMap' => 'airtime/map/CcStreamSettingTableMap.php',
'CcStreamSettingPeer' => 'airtime/CcStreamSettingPeer.php',
'CcStreamSetting' => 'airtime/CcStreamSetting.php',
'CcStreamSettingQuery' => 'airtime/CcStreamSettingQuery.php',
'BaseCcStreamSettingPeer' => 'airtime/om/BaseCcStreamSettingPeer.php',
'BaseCcStreamSetting' => 'airtime/om/BaseCcStreamSetting.php',
'BaseCcStreamSettingQuery' => 'airtime/om/BaseCcStreamSettingQuery.php',
'CcLoginAttemptsTableMap' => 'airtime/map/CcLoginAttemptsTableMap.php',
'CcLoginAttemptsPeer' => 'airtime/CcLoginAttemptsPeer.php',
'CcLoginAttempts' => 'airtime/CcLoginAttempts.php',
'CcLoginAttemptsQuery' => 'airtime/CcLoginAttemptsQuery.php',
'BaseCcLoginAttemptsPeer' => 'airtime/om/BaseCcLoginAttemptsPeer.php',
'BaseCcLoginAttempts' => 'airtime/om/BaseCcLoginAttempts.php',
'BaseCcLoginAttemptsQuery' => 'airtime/om/BaseCcLoginAttemptsQuery.php',
'CcServiceRegisterTableMap' => 'airtime/map/CcServiceRegisterTableMap.php',
'CcServiceRegisterPeer' => 'airtime/CcServiceRegisterPeer.php',
'CcServiceRegister' => 'airtime/CcServiceRegister.php',
'CcServiceRegisterQuery' => 'airtime/CcServiceRegisterQuery.php',
'BaseCcServiceRegisterPeer' => 'airtime/om/BaseCcServiceRegisterPeer.php',
'BaseCcServiceRegister' => 'airtime/om/BaseCcServiceRegister.php',
'BaseCcServiceRegisterQuery' => 'airtime/om/BaseCcServiceRegisterQuery.php',
'CcLiveLogTableMap' => 'airtime/map/CcLiveLogTableMap.php',
'CcLiveLogPeer' => 'airtime/CcLiveLogPeer.php',
'CcLiveLog' => 'airtime/CcLiveLog.php',
'CcLiveLogQuery' => 'airtime/CcLiveLogQuery.php',
'BaseCcLiveLogPeer' => 'airtime/om/BaseCcLiveLogPeer.php',
'BaseCcLiveLog' => 'airtime/om/BaseCcLiveLog.php',
'BaseCcLiveLogQuery' => 'airtime/om/BaseCcLiveLogQuery.php',
'CcWebstreamTableMap' => 'airtime/map/CcWebstreamTableMap.php',
'CcWebstreamPeer' => 'airtime/CcWebstreamPeer.php',
'CcWebstream' => 'airtime/CcWebstream.php',
'CcWebstreamQuery' => 'airtime/CcWebstreamQuery.php',
'BaseCcWebstreamPeer' => 'airtime/om/BaseCcWebstreamPeer.php',
'BaseCcWebstream' => 'airtime/om/BaseCcWebstream.php',
'BaseCcWebstreamQuery' => 'airtime/om/BaseCcWebstreamQuery.php',
'CcWebstreamMetadataTableMap' => 'airtime/map/CcWebstreamMetadataTableMap.php',
'CcWebstreamMetadataPeer' => 'airtime/CcWebstreamMetadataPeer.php',
'CcWebstreamMetadata' => 'airtime/CcWebstreamMetadata.php',
'CcWebstreamMetadataQuery' => 'airtime/CcWebstreamMetadataQuery.php',
'BaseCcWebstreamMetadataPeer' => 'airtime/om/BaseCcWebstreamMetadataPeer.php',
'BaseCcWebstreamMetadata' => 'airtime/om/BaseCcWebstreamMetadata.php',
'BaseCcWebstreamMetadataQuery' => 'airtime/om/BaseCcWebstreamMetadataQuery.php',
'CcMountNameTableMap' => 'airtime/map/CcMountNameTableMap.php',
'CcMountNamePeer' => 'airtime/CcMountNamePeer.php',
'CcMountName' => 'airtime/CcMountName.php',
'CcMountNameQuery' => 'airtime/CcMountNameQuery.php',
'BaseCcMountNamePeer' => 'airtime/om/BaseCcMountNamePeer.php',
'BaseCcMountName' => 'airtime/om/BaseCcMountName.php',
'BaseCcMountNameQuery' => 'airtime/om/BaseCcMountNameQuery.php',
'CcTimestampTableMap' => 'airtime/map/CcTimestampTableMap.php',
'CcTimestampPeer' => 'airtime/CcTimestampPeer.php',
'CcTimestamp' => 'airtime/CcTimestamp.php',
'CcTimestampQuery' => 'airtime/CcTimestampQuery.php',
'BaseCcTimestampPeer' => 'airtime/om/BaseCcTimestampPeer.php',
'BaseCcTimestamp' => 'airtime/om/BaseCcTimestamp.php',
'BaseCcTimestampQuery' => 'airtime/om/BaseCcTimestampQuery.php',
'CcListenerCountTableMap' => 'airtime/map/CcListenerCountTableMap.php',
'CcListenerCountPeer' => 'airtime/CcListenerCountPeer.php',
'CcListenerCount' => 'airtime/CcListenerCount.php',
'CcListenerCountQuery' => 'airtime/CcListenerCountQuery.php',
'BaseCcListenerCountPeer' => 'airtime/om/BaseCcListenerCountPeer.php',
'BaseCcFiles' => 'airtime/om/BaseCcFiles.php',
'BaseCcFilesPeer' => 'airtime/om/BaseCcFilesPeer.php',
'BaseCcFilesQuery' => 'airtime/om/BaseCcFilesQuery.php',
'BaseCcListenerCount' => 'airtime/om/BaseCcListenerCount.php',
'BaseCcListenerCountPeer' => 'airtime/om/BaseCcListenerCountPeer.php',
'BaseCcListenerCountQuery' => 'airtime/om/BaseCcListenerCountQuery.php',
'CcLocaleTableMap' => 'airtime/map/CcLocaleTableMap.php',
'CcLocalePeer' => 'airtime/CcLocalePeer.php',
'CcLocale' => 'airtime/CcLocale.php',
'CcLocaleQuery' => 'airtime/CcLocaleQuery.php',
'BaseCcLocalePeer' => 'airtime/om/BaseCcLocalePeer.php',
'BaseCcLocale' => 'airtime/om/BaseCcLocale.php',
'BaseCcLocaleQuery' => 'airtime/om/BaseCcLocaleQuery.php',
'CcPlayoutHistoryTableMap' => 'airtime/map/CcPlayoutHistoryTableMap.php',
'CcPlayoutHistoryPeer' => 'airtime/CcPlayoutHistoryPeer.php',
'CcPlayoutHistory' => 'airtime/CcPlayoutHistory.php',
'CcPlayoutHistoryQuery' => 'airtime/CcPlayoutHistoryQuery.php',
'BaseCcPlayoutHistoryPeer' => 'airtime/om/BaseCcPlayoutHistoryPeer.php',
'BaseCcLiveLog' => 'airtime/om/BaseCcLiveLog.php',
'BaseCcLiveLogPeer' => 'airtime/om/BaseCcLiveLogPeer.php',
'BaseCcLiveLogQuery' => 'airtime/om/BaseCcLiveLogQuery.php',
'BaseCcLoginAttempts' => 'airtime/om/BaseCcLoginAttempts.php',
'BaseCcLoginAttemptsPeer' => 'airtime/om/BaseCcLoginAttemptsPeer.php',
'BaseCcLoginAttemptsQuery' => 'airtime/om/BaseCcLoginAttemptsQuery.php',
'BaseCcMountName' => 'airtime/om/BaseCcMountName.php',
'BaseCcMountNamePeer' => 'airtime/om/BaseCcMountNamePeer.php',
'BaseCcMountNameQuery' => 'airtime/om/BaseCcMountNameQuery.php',
'BaseCcMusicDirs' => 'airtime/om/BaseCcMusicDirs.php',
'BaseCcMusicDirsPeer' => 'airtime/om/BaseCcMusicDirsPeer.php',
'BaseCcMusicDirsQuery' => 'airtime/om/BaseCcMusicDirsQuery.php',
'BaseCcPerms' => 'airtime/om/BaseCcPerms.php',
'BaseCcPermsPeer' => 'airtime/om/BaseCcPermsPeer.php',
'BaseCcPermsQuery' => 'airtime/om/BaseCcPermsQuery.php',
'BaseCcPlaylist' => 'airtime/om/BaseCcPlaylist.php',
'BaseCcPlaylistPeer' => 'airtime/om/BaseCcPlaylistPeer.php',
'BaseCcPlaylistQuery' => 'airtime/om/BaseCcPlaylistQuery.php',
'BaseCcPlaylistcontents' => 'airtime/om/BaseCcPlaylistcontents.php',
'BaseCcPlaylistcontentsPeer' => 'airtime/om/BaseCcPlaylistcontentsPeer.php',
'BaseCcPlaylistcontentsQuery' => 'airtime/om/BaseCcPlaylistcontentsQuery.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',
'BaseCcPlayoutHistoryMetaDataPeer' => 'airtime/om/BaseCcPlayoutHistoryMetaDataPeer.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',
'BaseCcPlayoutHistoryPeer' => 'airtime/om/BaseCcPlayoutHistoryPeer.php',
'BaseCcPlayoutHistoryQuery' => 'airtime/om/BaseCcPlayoutHistoryQuery.php',
'BaseCcPlayoutHistoryTemplate' => 'airtime/om/BaseCcPlayoutHistoryTemplate.php',
'BaseCcPlayoutHistoryTemplateQuery' => 'airtime/om/BaseCcPlayoutHistoryTemplateQuery.php',
'CcPlayoutHistoryTemplateFieldTableMap' => 'airtime/map/CcPlayoutHistoryTemplateFieldTableMap.php',
'CcPlayoutHistoryTemplateFieldPeer' => 'airtime/CcPlayoutHistoryTemplateFieldPeer.php',
'CcPlayoutHistoryTemplateField' => 'airtime/CcPlayoutHistoryTemplateField.php',
'CcPlayoutHistoryTemplateFieldQuery' => 'airtime/CcPlayoutHistoryTemplateFieldQuery.php',
'BaseCcPlayoutHistoryTemplateFieldPeer' => 'airtime/om/BaseCcPlayoutHistoryTemplateFieldPeer.php',
'BaseCcPlayoutHistoryTemplateField' => 'airtime/om/BaseCcPlayoutHistoryTemplateField.php',
'BaseCcPlayoutHistoryTemplateFieldPeer' => 'airtime/om/BaseCcPlayoutHistoryTemplateFieldPeer.php',
'BaseCcPlayoutHistoryTemplateFieldQuery' => 'airtime/om/BaseCcPlayoutHistoryTemplateFieldQuery.php',
'BaseCcPlayoutHistoryTemplatePeer' => 'airtime/om/BaseCcPlayoutHistoryTemplatePeer.php',
'BaseCcPlayoutHistoryTemplateQuery' => 'airtime/om/BaseCcPlayoutHistoryTemplateQuery.php',
'BaseCcPref' => 'airtime/om/BaseCcPref.php',
'BaseCcPrefPeer' => 'airtime/om/BaseCcPrefPeer.php',
'BaseCcPrefQuery' => 'airtime/om/BaseCcPrefQuery.php',
'BaseCcSchedule' => 'airtime/om/BaseCcSchedule.php',
'BaseCcSchedulePeer' => 'airtime/om/BaseCcSchedulePeer.php',
'BaseCcScheduleQuery' => 'airtime/om/BaseCcScheduleQuery.php',
'BaseCcServiceRegister' => 'airtime/om/BaseCcServiceRegister.php',
'BaseCcServiceRegisterPeer' => 'airtime/om/BaseCcServiceRegisterPeer.php',
'BaseCcServiceRegisterQuery' => 'airtime/om/BaseCcServiceRegisterQuery.php',
'BaseCcSess' => 'airtime/om/BaseCcSess.php',
'BaseCcSessPeer' => 'airtime/om/BaseCcSessPeer.php',
'BaseCcSessQuery' => 'airtime/om/BaseCcSessQuery.php',
'BaseCcShow' => 'airtime/om/BaseCcShow.php',
'BaseCcShowDays' => 'airtime/om/BaseCcShowDays.php',
'BaseCcShowDaysPeer' => 'airtime/om/BaseCcShowDaysPeer.php',
'BaseCcShowDaysQuery' => 'airtime/om/BaseCcShowDaysQuery.php',
'BaseCcShowHosts' => 'airtime/om/BaseCcShowHosts.php',
'BaseCcShowHostsPeer' => 'airtime/om/BaseCcShowHostsPeer.php',
'BaseCcShowHostsQuery' => 'airtime/om/BaseCcShowHostsQuery.php',
'BaseCcShowInstances' => 'airtime/om/BaseCcShowInstances.php',
'BaseCcShowInstancesPeer' => 'airtime/om/BaseCcShowInstancesPeer.php',
'BaseCcShowInstancesQuery' => 'airtime/om/BaseCcShowInstancesQuery.php',
'BaseCcShowPeer' => 'airtime/om/BaseCcShowPeer.php',
'BaseCcShowQuery' => 'airtime/om/BaseCcShowQuery.php',
'BaseCcShowRebroadcast' => 'airtime/om/BaseCcShowRebroadcast.php',
'BaseCcShowRebroadcastPeer' => 'airtime/om/BaseCcShowRebroadcastPeer.php',
'BaseCcShowRebroadcastQuery' => 'airtime/om/BaseCcShowRebroadcastQuery.php',
'BaseCcSmemb' => 'airtime/om/BaseCcSmemb.php',
'BaseCcSmembPeer' => 'airtime/om/BaseCcSmembPeer.php',
'BaseCcSmembQuery' => 'airtime/om/BaseCcSmembQuery.php',
'BaseCcStreamSetting' => 'airtime/om/BaseCcStreamSetting.php',
'BaseCcStreamSettingPeer' => 'airtime/om/BaseCcStreamSettingPeer.php',
'BaseCcStreamSettingQuery' => 'airtime/om/BaseCcStreamSettingQuery.php',
'BaseCcSubjs' => 'airtime/om/BaseCcSubjs.php',
'BaseCcSubjsPeer' => 'airtime/om/BaseCcSubjsPeer.php',
'BaseCcSubjsQuery' => 'airtime/om/BaseCcSubjsQuery.php',
'BaseCcSubjsToken' => 'airtime/om/BaseCcSubjsToken.php',
'BaseCcSubjsTokenPeer' => 'airtime/om/BaseCcSubjsTokenPeer.php',
'BaseCcSubjsTokenQuery' => 'airtime/om/BaseCcSubjsTokenQuery.php',
'BaseCcTimestamp' => 'airtime/om/BaseCcTimestamp.php',
'BaseCcTimestampPeer' => 'airtime/om/BaseCcTimestampPeer.php',
'BaseCcTimestampQuery' => 'airtime/om/BaseCcTimestampQuery.php',
'BaseCcWebstream' => 'airtime/om/BaseCcWebstream.php',
'BaseCcWebstreamMetadata' => 'airtime/om/BaseCcWebstreamMetadata.php',
'BaseCcWebstreamMetadataPeer' => 'airtime/om/BaseCcWebstreamMetadataPeer.php',
'BaseCcWebstreamMetadataQuery' => 'airtime/om/BaseCcWebstreamMetadataQuery.php',
'BaseCcWebstreamPeer' => 'airtime/om/BaseCcWebstreamPeer.php',
'BaseCcWebstreamQuery' => 'airtime/om/BaseCcWebstreamQuery.php',
'BaseCloudFile' => 'airtime/om/BaseCloudFile.php',
'BaseCloudFilePeer' => 'airtime/om/BaseCloudFilePeer.php',
'BaseCloudFileQuery' => 'airtime/om/BaseCloudFileQuery.php',
'CcBlock' => 'airtime/CcBlock.php',
'CcBlockPeer' => 'airtime/CcBlockPeer.php',
'CcBlockQuery' => 'airtime/CcBlockQuery.php',
'CcBlockTableMap' => 'airtime/map/CcBlockTableMap.php',
'CcBlockcontents' => 'airtime/CcBlockcontents.php',
'CcBlockcontentsPeer' => 'airtime/CcBlockcontentsPeer.php',
'CcBlockcontentsQuery' => 'airtime/CcBlockcontentsQuery.php',
'CcBlockcontentsTableMap' => 'airtime/map/CcBlockcontentsTableMap.php',
'CcBlockcriteria' => 'airtime/CcBlockcriteria.php',
'CcBlockcriteriaPeer' => 'airtime/CcBlockcriteriaPeer.php',
'CcBlockcriteriaQuery' => 'airtime/CcBlockcriteriaQuery.php',
'CcBlockcriteriaTableMap' => 'airtime/map/CcBlockcriteriaTableMap.php',
'CcCountry' => 'airtime/CcCountry.php',
'CcCountryPeer' => 'airtime/CcCountryPeer.php',
'CcCountryQuery' => 'airtime/CcCountryQuery.php',
'CcCountryTableMap' => 'airtime/map/CcCountryTableMap.php',
'CcFiles' => 'airtime/CcFiles.php',
'CcFilesPeer' => 'airtime/CcFilesPeer.php',
'CcFilesQuery' => 'airtime/CcFilesQuery.php',
'CcFilesTableMap' => 'airtime/map/CcFilesTableMap.php',
'CcListenerCount' => 'airtime/CcListenerCount.php',
'CcListenerCountPeer' => 'airtime/CcListenerCountPeer.php',
'CcListenerCountQuery' => 'airtime/CcListenerCountQuery.php',
'CcListenerCountTableMap' => 'airtime/map/CcListenerCountTableMap.php',
'CcLiveLog' => 'airtime/CcLiveLog.php',
'CcLiveLogPeer' => 'airtime/CcLiveLogPeer.php',
'CcLiveLogQuery' => 'airtime/CcLiveLogQuery.php',
'CcLiveLogTableMap' => 'airtime/map/CcLiveLogTableMap.php',
'CcLoginAttempts' => 'airtime/CcLoginAttempts.php',
'CcLoginAttemptsPeer' => 'airtime/CcLoginAttemptsPeer.php',
'CcLoginAttemptsQuery' => 'airtime/CcLoginAttemptsQuery.php',
'CcLoginAttemptsTableMap' => 'airtime/map/CcLoginAttemptsTableMap.php',
'CcMountName' => 'airtime/CcMountName.php',
'CcMountNamePeer' => 'airtime/CcMountNamePeer.php',
'CcMountNameQuery' => 'airtime/CcMountNameQuery.php',
'CcMountNameTableMap' => 'airtime/map/CcMountNameTableMap.php',
'CcMusicDirs' => 'airtime/CcMusicDirs.php',
'CcMusicDirsPeer' => 'airtime/CcMusicDirsPeer.php',
'CcMusicDirsQuery' => 'airtime/CcMusicDirsQuery.php',
'CcMusicDirsTableMap' => 'airtime/map/CcMusicDirsTableMap.php',
'CcPerms' => 'airtime/CcPerms.php',
'CcPermsPeer' => 'airtime/CcPermsPeer.php',
'CcPermsQuery' => 'airtime/CcPermsQuery.php',
'CcPermsTableMap' => 'airtime/map/CcPermsTableMap.php',
'CcPlaylist' => 'airtime/CcPlaylist.php',
'CcPlaylistPeer' => 'airtime/CcPlaylistPeer.php',
'CcPlaylistQuery' => 'airtime/CcPlaylistQuery.php',
'CcPlaylistTableMap' => 'airtime/map/CcPlaylistTableMap.php',
'CcPlaylistcontents' => 'airtime/CcPlaylistcontents.php',
'CcPlaylistcontentsPeer' => 'airtime/CcPlaylistcontentsPeer.php',
'CcPlaylistcontentsQuery' => 'airtime/CcPlaylistcontentsQuery.php',
'CcPlaylistcontentsTableMap' => 'airtime/map/CcPlaylistcontentsTableMap.php',
'CcPlayoutHistory' => 'airtime/CcPlayoutHistory.php',
'CcPlayoutHistoryMetaData' => 'airtime/CcPlayoutHistoryMetaData.php',
'CcPlayoutHistoryMetaDataPeer' => 'airtime/CcPlayoutHistoryMetaDataPeer.php',
'CcPlayoutHistoryMetaDataQuery' => 'airtime/CcPlayoutHistoryMetaDataQuery.php',
'CcPlayoutHistoryMetaDataTableMap' => 'airtime/map/CcPlayoutHistoryMetaDataTableMap.php',
'CcPlayoutHistoryPeer' => 'airtime/CcPlayoutHistoryPeer.php',
'CcPlayoutHistoryQuery' => 'airtime/CcPlayoutHistoryQuery.php',
'CcPlayoutHistoryTableMap' => 'airtime/map/CcPlayoutHistoryTableMap.php',
'CcPlayoutHistoryTemplate' => 'airtime/CcPlayoutHistoryTemplate.php',
'CcPlayoutHistoryTemplateField' => 'airtime/CcPlayoutHistoryTemplateField.php',
'CcPlayoutHistoryTemplateFieldPeer' => 'airtime/CcPlayoutHistoryTemplateFieldPeer.php',
'CcPlayoutHistoryTemplateFieldQuery' => 'airtime/CcPlayoutHistoryTemplateFieldQuery.php',
'CcPlayoutHistoryTemplateFieldTableMap' => 'airtime/map/CcPlayoutHistoryTemplateFieldTableMap.php',
'CcPlayoutHistoryTemplatePeer' => 'airtime/CcPlayoutHistoryTemplatePeer.php',
'CcPlayoutHistoryTemplateQuery' => 'airtime/CcPlayoutHistoryTemplateQuery.php',
'CcPlayoutHistoryTemplateTableMap' => 'airtime/map/CcPlayoutHistoryTemplateTableMap.php',
'CcPref' => 'airtime/CcPref.php',
'CcPrefPeer' => 'airtime/CcPrefPeer.php',
'CcPrefQuery' => 'airtime/CcPrefQuery.php',
'CcPrefTableMap' => 'airtime/map/CcPrefTableMap.php',
'CcSchedule' => 'airtime/CcSchedule.php',
'CcSchedulePeer' => 'airtime/CcSchedulePeer.php',
'CcScheduleQuery' => 'airtime/CcScheduleQuery.php',
'CcScheduleTableMap' => 'airtime/map/CcScheduleTableMap.php',
'CcServiceRegister' => 'airtime/CcServiceRegister.php',
'CcServiceRegisterPeer' => 'airtime/CcServiceRegisterPeer.php',
'CcServiceRegisterQuery' => 'airtime/CcServiceRegisterQuery.php',
'CcServiceRegisterTableMap' => 'airtime/map/CcServiceRegisterTableMap.php',
'CcSess' => 'airtime/CcSess.php',
'CcSessPeer' => 'airtime/CcSessPeer.php',
'CcSessQuery' => 'airtime/CcSessQuery.php',
'CcSessTableMap' => 'airtime/map/CcSessTableMap.php',
'CcShow' => 'airtime/CcShow.php',
'CcShowDays' => 'airtime/CcShowDays.php',
'CcShowDaysPeer' => 'airtime/CcShowDaysPeer.php',
'CcShowDaysQuery' => 'airtime/CcShowDaysQuery.php',
'CcShowDaysTableMap' => 'airtime/map/CcShowDaysTableMap.php',
'CcShowHosts' => 'airtime/CcShowHosts.php',
'CcShowHostsPeer' => 'airtime/CcShowHostsPeer.php',
'CcShowHostsQuery' => 'airtime/CcShowHostsQuery.php',
'CcShowHostsTableMap' => 'airtime/map/CcShowHostsTableMap.php',
'CcShowInstances' => 'airtime/CcShowInstances.php',
'CcShowInstancesPeer' => 'airtime/CcShowInstancesPeer.php',
'CcShowInstancesQuery' => 'airtime/CcShowInstancesQuery.php',
'CcShowInstancesTableMap' => 'airtime/map/CcShowInstancesTableMap.php',
'CcShowPeer' => 'airtime/CcShowPeer.php',
'CcShowQuery' => 'airtime/CcShowQuery.php',
'CcShowRebroadcast' => 'airtime/CcShowRebroadcast.php',
'CcShowRebroadcastPeer' => 'airtime/CcShowRebroadcastPeer.php',
'CcShowRebroadcastQuery' => 'airtime/CcShowRebroadcastQuery.php',
'CcShowRebroadcastTableMap' => 'airtime/map/CcShowRebroadcastTableMap.php',
'CcShowTableMap' => 'airtime/map/CcShowTableMap.php',
'CcSmemb' => 'airtime/CcSmemb.php',
'CcSmembPeer' => 'airtime/CcSmembPeer.php',
'CcSmembQuery' => 'airtime/CcSmembQuery.php',
'CcSmembTableMap' => 'airtime/map/CcSmembTableMap.php',
'CcStreamSetting' => 'airtime/CcStreamSetting.php',
'CcStreamSettingPeer' => 'airtime/CcStreamSettingPeer.php',
'CcStreamSettingQuery' => 'airtime/CcStreamSettingQuery.php',
'CcStreamSettingTableMap' => 'airtime/map/CcStreamSettingTableMap.php',
'CcSubjs' => 'airtime/CcSubjs.php',
'CcSubjsPeer' => 'airtime/CcSubjsPeer.php',
'CcSubjsQuery' => 'airtime/CcSubjsQuery.php',
'CcSubjsTableMap' => 'airtime/map/CcSubjsTableMap.php',
'CcSubjsToken' => 'airtime/CcSubjsToken.php',
'CcSubjsTokenPeer' => 'airtime/CcSubjsTokenPeer.php',
'CcSubjsTokenQuery' => 'airtime/CcSubjsTokenQuery.php',
'CcSubjsTokenTableMap' => 'airtime/map/CcSubjsTokenTableMap.php',
'CcTimestamp' => 'airtime/CcTimestamp.php',
'CcTimestampPeer' => 'airtime/CcTimestampPeer.php',
'CcTimestampQuery' => 'airtime/CcTimestampQuery.php',
'CcTimestampTableMap' => 'airtime/map/CcTimestampTableMap.php',
'CcWebstream' => 'airtime/CcWebstream.php',
'CcWebstreamMetadata' => 'airtime/CcWebstreamMetadata.php',
'CcWebstreamMetadataPeer' => 'airtime/CcWebstreamMetadataPeer.php',
'CcWebstreamMetadataQuery' => 'airtime/CcWebstreamMetadataQuery.php',
'CcWebstreamMetadataTableMap' => 'airtime/map/CcWebstreamMetadataTableMap.php',
'CcWebstreamPeer' => 'airtime/CcWebstreamPeer.php',
'CcWebstreamQuery' => 'airtime/CcWebstreamQuery.php',
'CcWebstreamTableMap' => 'airtime/map/CcWebstreamTableMap.php',
'CloudFile' => 'airtime/CloudFile.php',
'CloudFilePeer' => 'airtime/CloudFilePeer.php',
'CloudFileQuery' => 'airtime/CloudFileQuery.php',
'CloudFileTableMap' => 'airtime/map/CloudFileTableMap.php',
);

View File

@ -25,6 +25,19 @@ class Config {
$filename = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
}
// Parse separate conf file for cloud storage values
$cloudStorageConfig = isset($_SERVER['CLOUD_STORAGE_CONF']) ? $_SERVER['CLOUD_STORAGE_CONF'] : "/etc/airtime-saas/cloud_storage.conf";
$cloudStorageValues = parse_ini_file($cloudStorageConfig, true);
$supportedStorageBackends = array('amazon_S3');
foreach ($supportedStorageBackends as $backend) {
$CC_CONFIG[$backend] = $cloudStorageValues[$backend];
}
// Tells us where file uploads will be uploaded to.
// It will either be set to a cloud storage backend or local file storage.
$CC_CONFIG["current_backend"] = $cloudStorageValues["current_backend"]["storage_backend"];
$values = parse_ini_file($filename, true);
// Name of the web server user

View File

@ -87,26 +87,19 @@ class ApiController extends Zend_Controller_Action
*/
public function getMediaAction()
{
// Close the session so other HTTP requests can be completed while
// tracks are read for previewing or downloading.
session_write_close();
$fileId = $this->_getParam("file");
$media = Application_Model_StoredFile::RecallById($fileId);
if ($media != null) {
$filepath = $media->getFilePath();
// Make sure we don't have some wrong result beecause of caching
clearstatcache();
if (is_file($filepath)) {
$full_path = $media->getPropelOrm()->getDbFilepath();
$file_base_name = strrchr($full_path, '/');
/* If $full_path does not contain a '/', strrchr will return false,
* in which case we can use $full_path as the base name.
*/
if (!$file_base_name) {
$file_base_name = $full_path;
} else {
$file_base_name = substr($file_base_name, 1);
}
if ($media->getPropelOrm()->isValidPhysicalFile()) {
$filename = $media->getPropelOrm()->getFilename();
//Download user left clicks a track and selects Download.
if ("true" == $this->_getParam('download')) {
@ -114,13 +107,13 @@ class ApiController extends Zend_Controller_Action
//We just want the basename which is the file name with the path
//information stripped away. We are using Content-Disposition to specify
//to the browser what name the file should be saved as.
header('Content-Disposition: attachment; filename="'.$file_base_name.'"');
header('Content-Disposition: attachment; filename="'.$filename.'"');
} else {
//user clicks play button for track and downloads it.
header('Content-Disposition: inline; filename="'.$file_base_name.'"');
//user clicks play button for track preview
header('Content-Disposition: inline; filename="'.$filename.'"');
}
$this->smartReadFile($filepath, $media->getPropelOrm()->getDbMime());
$this->smartReadFile($media);
exit;
} else {
header ("HTTP/1.1 404 Not Found");
@ -142,12 +135,13 @@ class ApiController extends Zend_Controller_Action
* @link https://groups.google.com/d/msg/jplayer/nSM2UmnSKKA/Hu76jDZS4xcJ
* @link http://php.net/manual/en/function.readfile.php#86244
*/
public function smartReadFile($location, $mimeType = 'audio/mp3')
public function smartReadFile($media)
{
$size= filesize($location);
$time= date('r', filemtime($location));
$filepath = $media->getFilePath();
$size= $media->getFileSize();
$mimeType = $media->getPropelOrm()->getDbMime();
$fm = @fopen($location, 'rb');
$fm = @fopen($filepath, 'rb');
if (!$fm) {
header ("HTTP/1.1 505 Internal server error");
@ -180,20 +174,18 @@ class ApiController extends Zend_Controller_Action
header("Content-Range: bytes $begin-$end/$size");
}
header("Content-Transfer-Encoding: binary");
header("Last-Modified: $time");
//We can have multiple levels of output buffering. Need to
//keep looping until all have been disabled!!!
//http://www.php.net/manual/en/function.ob-end-flush.php
while (@ob_end_flush());
$cur = $begin;
fseek($fm, $begin, 0);
while (!feof($fm) && $cur <= $end && (connection_status() == 0)) {
echo fread($fm, min(1024 * 16, ($end - $cur) + 1));
$cur += 1024 * 16;
// NOTE: We can't use fseek here because it does not work with streams
// (a.k.a. Files stored in the cloud)
while(!feof($fm) && (connection_status() == 0)) {
echo fread($fm, 1024 * 8);
}
fclose($fm);
}
//Used by the SaaS monitoring

View File

@ -46,8 +46,8 @@ class AudiopreviewController extends Zend_Controller_Action
}
if ($type == "audioclip") {
$uri = $baseUrl."api/get-media/file/".$audioFileID;
$media = Application_Model_StoredFile::RecallById($audioFileID);
$uri = $baseUrl."api/get-media/file/".$audioFileID;
$mime = $media->getPropelOrm()->getDbMime();
} elseif ($type == "stream") {
$webstream = CcWebstreamQuery::create()->findPk($audioFileID);

View File

@ -189,7 +189,6 @@ class LibraryController extends Zend_Controller_Action
$obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
if ($type === "audioclip") {
$file = Application_Model_StoredFile::RecallById($id);
$menu["play"]["mime"] = $file->getPropelOrm()->getDbMime();
@ -214,7 +213,11 @@ class LibraryController extends Zend_Controller_Action
$menu["edit"] = array("name"=> _("Edit Metadata"), "icon" => "edit", "url" => $baseUrl."library/edit-file-md/id/{$id}");
}
$url = $file->getRelativeFileUrl($baseUrl).'/download/true';
// It's important that we always return the parent id (cc_files id)
// and not the cloud_file id (if applicable) for track download.
// Our application logic (StoredFile.php) will determine if the track
// is a cloud_file and handle it appropriately.
$url = $baseUrl."api/get-media/file/".$id.".".$file->getFileExtension().'/download/true';
$menu["download"] = array("name" => _("Download"), "icon" => "download", "url" => $url);
} elseif ($type === "playlist" || $type === "block") {
if ($type === 'playlist') {
@ -349,7 +352,6 @@ class LibraryController extends Zend_Controller_Action
foreach ($files as $id) {
$file = Application_Model_StoredFile::RecallById($id);
if (isset($file)) {
try {
$res = $file->delete();
@ -357,8 +359,8 @@ class LibraryController extends Zend_Controller_Action
$message = $noPermissionMsg;
} catch (Exception $e) {
//could throw a scheduled in future exception.
$message = _("Could not delete some scheduled files.");
Logging::debug($e->getMessage());
$message = _("Could not delete file(s).");
Logging::info($message.": ".$e->getMessage());
}
}
}
@ -468,7 +470,7 @@ class LibraryController extends Zend_Controller_Action
$md = $file->getMetadata();
foreach ($md as $key => $value) {
if ($key == 'MDATA_KEY_DIRECTORY') {
if ($key == 'MDATA_KEY_DIRECTORY' && !is_null($value)) {
$musicDir = Application_Model_MusicDir::getDirByPK($value);
$md['MDATA_KEY_FILEPATH'] = Application_Common_OsPath::join($musicDir->getDirectory(), $md['MDATA_KEY_FILEPATH']);
}

View File

@ -88,7 +88,7 @@ class WebstreamController extends Zend_Controller_Action
public function isAuthorized($webstream_id)
{
$user = Application_Model_User::getCurrentUser();
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
if ($user->isUserType(array(UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
return true;
}

View File

@ -80,14 +80,21 @@ class Application_Model_RabbitMq
}
public static function SendMessageToAnalyzer($tmpFilePath, $importedStorageDirectory, $originalFilename,
$callbackUrl, $apiKey)
$callbackUrl, $apiKey, $currentStorageBackend)
{
$exchange = 'airtime-uploads';
$data['tmp_file_path'] = $tmpFilePath;
$data['current_storage_backend'] = $currentStorageBackend;
$data['import_directory'] = $importedStorageDirectory;
$data['original_filename'] = $originalFilename;
$data['callback_url'] = $callbackUrl;
$data['api_key'] = $apiKey;
// Pass station name to the analyzer so we can set it with the file's metadata
// and prefix the object name with it before uploading it to the cloud. This
// isn't a requirement for cloud storage, but put there as a safeguard, since
// all Airtime Pro stations will share the same bucket.
$data['station_domain'] = $stationDomain = Application_Model_Preference::GetStationName();
$jsonData = json_encode($data);
self::sendMessage($exchange, 'topic', false, $jsonData, 'airtime-uploads');

View File

@ -761,7 +761,20 @@ SQL;
}
}
private static function createFileScheduleEvent(&$data, $item, $media_id, $uri)
/**
*
* Appends schedule "events" to an array of schedule events that gets
* sent to PYPO. Each schedule event contains information PYPO and
* Liquidsoap need for playout.
*
* @param Array $data array to be filled with schedule info - $item(s)
* @param Array $item schedule info about one track
* @param Integer $media_id scheduled item's cc_files id
* @param String $uri path to the scheduled item's physical location
* @param Integer $filsize The file's file size in bytes
*
*/
private static function createFileScheduleEvent(&$data, $item, $media_id, $uri, $filesize)
{
$start = self::AirtimeTimeToPypoTime($item["start"]);
$end = self::AirtimeTimeToPypoTime($item["end"]);
@ -796,6 +809,7 @@ SQL;
'show_name' => $item["show_name"],
'replay_gain' => $replay_gain,
'independent_event' => $independent_event,
'filesize' => $filesize,
);
if ($schedule_item['cue_in'] > $schedule_item['cue_out']) {
@ -928,8 +942,13 @@ SQL;
//row is from "file"
$media_id = $item['file_id'];
$storedFile = Application_Model_StoredFile::RecallById($media_id);
$uri = $storedFile->getFilePath();
self::createFileScheduleEvent($data, $item, $media_id, $uri);
$file = $storedFile->getPropelOrm();
$uri = $file->getAbsoluteFilePath();
$baseUrl = Application_Common_OsPath::getBaseDir();
$filesize = $file->getFileSize();
self::createFileScheduleEvent($data, $item, $media_id, $uri, $filesize);
}
elseif (!is_null($item['stream_id'])) {
//row is type "webstream"

View File

@ -210,6 +210,13 @@ class Application_Model_StoredFile
if ($dbColumn == "track_title" && (is_null($mdValue) || $mdValue == "")) {
continue;
}
// Bpm gets POSTed as a string type. With Propel 1.6 this value
// was casted to an integer type before saving it to the db. But
// Propel 1.7 does not do this
if ($dbColumn == "bpm") {
$mdValue = (int) $mdValue;
}
# TODO : refactor string evals
if (isset($this->_dbMD[$dbColumn])) {
$propelColumn = $this->_dbMD[$dbColumn];
@ -364,15 +371,13 @@ SQL;
}
/**
* Delete stored virtual file
*
* @param boolean $p_deleteFile
* Deletes the physical file from the local file system or from the cloud
*
*/
public function delete()
{
// Check if the file is scheduled to be played in the future
if (Application_Model_Schedule::IsFileScheduledInTheFuture($this->getId())) {
if (Application_Model_Schedule::IsFileScheduledInTheFuture($this->_file->getCcFileId())) {
throw new DeleteScheduledFileException();
}
@ -382,30 +387,37 @@ SQL;
if (!$isAdminOrPM && $this->getFileOwnerId() != $user->getId()) {
throw new FileNoPermissionException();
}
$file_id = $this->_file->getDbId();
Logging::info("User ".$user->getLogin()." is deleting file: ".$this->_file->getDbTrackTitle()." - file id: ".$file_id);
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
assert($music_dir);
$type = $music_dir->getType();
$filesize = $this->_file->getFileSize();
if ($filesize <= 0) {
throw new Exception("Cannot delete file with filesize ".$filesize);
}
Logging::info($_SERVER["HTTP_HOST"].": User ".$user->getLogin()." is deleting file: ".$this->_file->getDbTrackTitle()." - file id: ".$this->_file->getDbId());
//Delete the physical file from either the local stor directory
//or from the cloud
$this->_file->deletePhysicalFile();
try {
if ($this->existsOnDisk() && $type == "stor") {
$filepath = $this->getFilePath();
//Update the user's disk usage
Application_Model_Preference::updateDiskUsage(-1 * abs(filesize($filepath)));
unlink($filepath);
}
} catch (Exception $e) {
Logging::warning($e->getMessage());
//If the file didn't exist on disk, that's fine, we still want to
//remove it from the database, so we continue here.
Application_Model_Preference::updateDiskUsage(-1 * $filesize);
//Explicitly update any playlist's and block's length that contain
//the file getting deleted
self::updateBlockAndPlaylistLength($this->_file->getDbId());
//delete the file record from cc_files (and cloud_file, if applicable)
$this->_file->delete();
}
// need to explicitly update any playlist's and block's length
// that contains the file getting deleted
$fileId = $this->_file->getDbId();
$plRows = CcPlaylistcontentsQuery::create()->filterByDbFileId()->find();
/*
* This function is meant to be called when a file is getting
* deleted from the library. It re-calculates the length of
* all blocks and playlists that contained the deleted file.
*/
private static function updateBlockAndPlaylistLength($fileId)
{
$plRows = CcPlaylistcontentsQuery::create()->filterByDbFileId($fileId)->find();
foreach ($plRows as $row) {
$pl = CcPlaylistQuery::create()->filterByDbId($row->getDbPlaylistId($fileId))->findOne();
$pl->setDbLength($pl->computeDbLength(Propel::getConnection(CcPlaylistPeer::DATABASE_NAME)));
@ -418,9 +430,6 @@ SQL;
$bl->setDbLength($bl->computeDbLength(Propel::getConnection(CcBlockPeer::DATABASE_NAME)));
$bl->save();
}
//We actually do want to delete the file from the database here
$this->_file->delete();
}
/**
@ -471,7 +480,7 @@ SQL;
$mime = $this->_file->getDbMime();
if ($mime == "audio/ogg" || $mime == "application/ogg") {
if ($mime == "audio/ogg" || $mime == "application/ogg" || $mime == "audio/vorbis") {
return "ogg";
} elseif ($mime == "audio/mp3" || $mime == "audio/mpeg") {
return "mp3";
@ -485,7 +494,7 @@ SQL;
}
/**
* Get real filename of raw media data
* Get the absolute filepath
*
* @return string
*/
@ -493,19 +502,7 @@ SQL;
{
assert($this->_file);
$music_dir = Application_Model_MusicDir::getDirByPK($this->
_file->getDbDirectory());
if (!$music_dir) {
throw new Exception(_("Invalid music_dir for file in database."));
}
$directory = $music_dir->getDirectory();
$filepath = $this->_file->getDbFilepath();
if (!$filepath) {
throw new Exception(sprintf(_("Blank file path for file %s (id: %s) in database."), $this->_file->getDbTrackTitle(), $this->getId()));
}
return Application_Common_OsPath::join($directory, $filepath);
return $this->_file->getURLForTrackPreviewOrDownload();
}
/**
@ -558,6 +555,20 @@ SQL;
return $baseUrl."api/get-media/file/".$this->getId().".".$this->getFileExtension();
}
public function getResourceId()
{
return $this->_file->getResourceId();
}
public function getFileSize()
{
$filesize = $this->_file->getFileSize();
if ($filesize <= 0) {
throw new Exception ("Could not determine filesize for file id: ".$this->_file->getDbId().". Filesize: ".$filesize);
}
return $filesize;
}
public static function Insert($md, $con)
{
// save some work by checking if filepath is given right away
@ -596,8 +607,23 @@ SQL;
}
if (isset($p_id)) {
$f = CcFilesQuery::create()->findPK(intval($p_id), $con);
return is_null($f) ? null : self::createWithFile($f, $con);
$p_id = intval($p_id);
$storedFile = CcFilesQuery::create()->findPK($p_id, $con);
if (is_null($storedFile)) {
throw new Exception("Could not recall file with id: ".$p_id);
}
//Attempt to get the cloud file object and return it. If no cloud
//file object is found then we are dealing with a regular stored
//object so return that
$cloudFile = CloudFileQuery::create()->findOneByCcFileId($p_id);
if (is_null($cloudFile)) {
return self::createWithFile($storedFile, $con);
} else {
return self::createWithFile($cloudFile, $con);
}
} else {
throw new Exception("No arguments passed to RecallById");
}
@ -605,8 +631,7 @@ SQL;
public function getName()
{
$info = pathinfo($this->getFilePath());
return $info['filename'];
return $this->_file->getFilename();
}
/**

View File

@ -420,4 +420,79 @@ class CcFiles extends BaseCcFiles {
{
exec("find $path -empty -type d -delete");
}
/**
* Returns the file size in bytes.
*/
public function getFileSize()
{
return filesize($this->getAbsoluteFilePath());
}
public function getFilename()
{
$info = pathinfo($this->getAbsoluteFilePath());
return $info['filename'];
}
/**
* Returns the file's absolute file path stored on disk.
*/
public function getURLForTrackPreviewOrDownload()
{
return $this->getAbsoluteFilePath();
}
/**
* Returns the file's absolute file path stored on disk.
*/
public function getAbsoluteFilePath()
{
$music_dir = Application_Model_MusicDir::getDirByPK($this->getDbDirectory());
if (!$music_dir) {
throw new Exception("Invalid music_dir for file in database.");
}
$directory = $music_dir->getDirectory();
$filepath = $this->getDbFilepath();
return Application_Common_OsPath::join($directory, $filepath);
}
/**
* Checks if the file is a regular file that can be previewed and downloaded.
*/
public function isValidPhysicalFile()
{
return is_file($this->getAbsoluteFilePath());
}
/**
*
* Deletes the file from the stor directory on disk.
*/
public function deletePhysicalFile()
{
$filepath = $this->getAbsoluteFilePath();
if (file_exists($filepath)) {
unlink($filepath);
} else {
throw new Exception("Could not locate file ".$filepath);
}
}
/**
*
* This function refers to the file's Amazon S3 resource id.
* Returns null because cc_files are stored on local disk.
*/
public function getResourceId()
{
return null;
}
public function getCcFileId()
{
return $this->id;
}
} // CcFiles

View File

@ -0,0 +1,96 @@
<?php
require_once 'ProxyStorageBackend.php';
/**
* Skeleton subclass for representing a row from the 'cloud_file' table.
*
* Each cloud_file has a corresponding cc_file referenced as a foreign key.
* The file's metadata is stored in the cc_file table. This, cloud_file,
* table represents files that are stored in the cloud.
*
* 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 CloudFile extends BaseCloudFile
{
private $proxyStorageBackend;
/**
* Returns a signed URL to the file's object on Amazon S3. Since we are
* requesting the file's object via this URL, it needs to be signed because
* all objects stored on Amazon S3 are private.
*/
public function getURLForTrackPreviewOrDownload()
{
if ($this->proxyStorageBackend == null) {
$this->proxyStorageBackend = new ProxyStorageBackend($this->getStorageBackend());
}
return $this->proxyStorageBackend->getSignedURL($this->getResourceId());
}
/**
*
* Returns a url to the file's object on Amazon S3.
*/
public function getAbsoluteFilePath()
{
if ($this->proxyStorageBackend == null) {
$this->proxyStorageBackend = new ProxyStorageBackend($this->getStorageBackend());
}
return $this->proxyStorageBackend->getAbsoluteFilePath($this->getResourceId());
}
/**
* Returns the file size in bytes.
*/
public function getFileSize()
{
if ($this->proxyStorageBackend == null) {
$this->proxyStorageBackend = new ProxyStorageBackend($this->getStorageBackend());
}
return $this->proxyStorageBackend->getFileSize($this->getResourceId());
}
public function getFilename()
{
return $this->getDbFilepath();
}
/**
* Checks if the file is a regular file that can be previewed and downloaded.
*/
public function isValidPhysicalFile()
{
// We don't need to check if the cloud file is a valid file because
// before it is imported the Analyzer runs it through Liquidsoap
// to check its playability. If Liquidsoap can't play the file it
// does not get imported into the Airtime library.
return true;
}
/**
*
* Deletes the file from cloud storage
*/
public function deletePhysicalFile()
{
if ($this->proxyStorageBackend == null) {
$this->proxyStorageBackend = new ProxyStorageBackend($this->getStorageBackend());
}
$this->proxyStorageBackend->deletePhysicalFile($this->getResourceId());
}
/**
*
* Deletes the cc_file and cloud_file entries from the database.
*/
public function delete(PropelPDO $con = NULL)
{
CcFilesQuery::create()->findPk($this->getCcFileId())->delete();
parent::delete();
}
}

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cloud_file' 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 CloudFilePeer extends BaseCloudFilePeer
{
}

View File

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cloud_file' 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 CloudFileQuery extends BaseCloudFileQuery
{
}

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcBlockTableMap extends TableMap {
class CcBlockTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,14 +39,14 @@ class CcBlockTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_block_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
$this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', false, 6, null);
$this->addForeignKey('CREATOR_ID', 'DbCreatorId', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
$this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null);
$this->addColumn('LENGTH', 'DbLength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('TYPE', 'DbType', 'VARCHAR', false, 7, 'static');
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('name', 'DbName', 'VARCHAR', true, 255, '');
$this->addColumn('mtime', 'DbMtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('utime', 'DbUtime', 'TIMESTAMP', false, 6, null);
$this->addForeignKey('creator_id', 'DbCreatorId', 'INTEGER', 'cc_subjs', 'id', false, null, null);
$this->addColumn('description', 'DbDescription', 'VARCHAR', false, 512, null);
$this->addColumn('length', 'DbLength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('type', 'DbType', 'VARCHAR', false, 7, 'static');
// validators
} // initialize()
@ -55,9 +56,9 @@ class CcBlockTableMap extends TableMap {
public function buildRelations()
{
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);
$this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);
$this->addRelation('CcBlockcriteria', 'CcBlockcriteria', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null, 'CcPlaylistcontentss');
$this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null, 'CcBlockcontentss');
$this->addRelation('CcBlockcriteria', 'CcBlockcriteria', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null, 'CcBlockcriterias');
} // buildRelations()
/**
@ -69,7 +70,13 @@ class CcBlockTableMap extends TableMap {
public function getBehaviors()
{
return array(
'aggregate_column' => array('name' => 'length', 'expression' => 'SUM(cliplength)', 'foreign_table' => 'cc_blockcontents', ),
'aggregate_column' => array (
'name' => 'length',
'expression' => 'SUM(cliplength)',
'condition' => NULL,
'foreign_table' => 'cc_blockcontents',
'foreign_schema' => NULL,
),
);
} // getBehaviors()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcBlockcontentsTableMap extends TableMap {
class CcBlockcontentsTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,16 +39,16 @@ class CcBlockcontentsTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_blockcontents_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('BLOCK_ID', 'DbBlockId', 'INTEGER', 'cc_block', 'ID', false, null, null);
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null);
$this->addColumn('TRACKOFFSET', 'DbTrackOffset', 'REAL', true, null, 0);
$this->addColumn('CLIPLENGTH', 'DbCliplength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('CUEIN', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('CUEOUT', 'DbCueout', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('FADEIN', 'DbFadein', 'TIME', false, null, '00:00:00');
$this->addColumn('FADEOUT', 'DbFadeout', 'TIME', false, null, '00:00:00');
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('block_id', 'DbBlockId', 'INTEGER', 'cc_block', 'id', false, null, null);
$this->addForeignKey('file_id', 'DbFileId', 'INTEGER', 'cc_files', 'id', false, null, null);
$this->addColumn('position', 'DbPosition', 'INTEGER', false, null, null);
$this->addColumn('trackoffset', 'DbTrackOffset', 'REAL', true, null, 0);
$this->addColumn('cliplength', 'DbCliplength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('cuein', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('cueout', 'DbCueout', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('fadein', 'DbFadein', 'TIME', false, null, '00:00:00');
$this->addColumn('fadeout', 'DbFadeout', 'TIME', false, null, '00:00:00');
// validators
} // initialize()
@ -69,7 +70,10 @@ class CcBlockcontentsTableMap extends TableMap {
public function getBehaviors()
{
return array(
'aggregate_column_relation' => array('foreign_table' => 'cc_block', 'update_method' => 'updateDbLength', ),
'aggregate_column_relation' => array (
'foreign_table' => 'cc_block',
'update_method' => 'updateDbLength',
),
);
} // getBehaviors()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcBlockcriteriaTableMap extends TableMap {
class CcBlockcriteriaTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,12 +39,12 @@ class CcBlockcriteriaTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_blockcriteria_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('CRITERIA', 'DbCriteria', 'VARCHAR', true, 32, null);
$this->addColumn('MODIFIER', 'DbModifier', 'VARCHAR', true, 16, null);
$this->addColumn('VALUE', 'DbValue', 'VARCHAR', true, 512, null);
$this->addColumn('EXTRA', 'DbExtra', 'VARCHAR', false, 512, null);
$this->addForeignKey('BLOCK_ID', 'DbBlockId', 'INTEGER', 'cc_block', 'ID', true, null, null);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('criteria', 'DbCriteria', 'VARCHAR', true, 32, null);
$this->addColumn('modifier', 'DbModifier', 'VARCHAR', true, 16, null);
$this->addColumn('value', 'DbValue', 'VARCHAR', true, 512, null);
$this->addColumn('extra', 'DbExtra', 'VARCHAR', false, 512, null);
$this->addForeignKey('block_id', 'DbBlockId', 'INTEGER', 'cc_block', 'id', true, null, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcCountryTableMap extends TableMap {
class CcCountryTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -37,8 +38,8 @@ class CcCountryTableMap extends TableMap {
$this->setPackage('airtime');
$this->setUseIdGenerator(false);
// columns
$this->addPrimaryKey('ISOCODE', 'DbIsoCode', 'CHAR', true, 3, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, null);
$this->addPrimaryKey('isocode', 'DbIsoCode', 'CHAR', true, 3, null);
$this->addColumn('name', 'DbName', 'VARCHAR', true, 255, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcFilesTableMap extends TableMap {
class CcFilesTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,76 +39,76 @@ class CcFilesTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_files_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
$this->addColumn('MIME', 'DbMime', 'VARCHAR', true, 255, '');
$this->addColumn('FTYPE', 'DbFtype', 'VARCHAR', true, 128, '');
$this->addForeignKey('DIRECTORY', 'DbDirectory', 'INTEGER', 'cc_music_dirs', 'ID', false, null, null);
$this->addColumn('FILEPATH', 'DbFilepath', 'LONGVARCHAR', false, null, '');
$this->addColumn('IMPORT_STATUS', 'DbImportStatus', 'INTEGER', true, null, 1);
$this->addColumn('CURRENTLYACCESSING', 'DbCurrentlyaccessing', 'INTEGER', true, null, 0);
$this->addForeignKey('EDITEDBY', 'DbEditedby', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
$this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('LPTIME', 'DbLPtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('MD5', 'DbMd5', 'CHAR', false, 32, null);
$this->addColumn('TRACK_TITLE', 'DbTrackTitle', 'VARCHAR', false, 512, null);
$this->addColumn('ARTIST_NAME', 'DbArtistName', 'VARCHAR', false, 512, null);
$this->addColumn('BIT_RATE', 'DbBitRate', 'INTEGER', false, null, null);
$this->addColumn('SAMPLE_RATE', 'DbSampleRate', 'INTEGER', false, null, null);
$this->addColumn('FORMAT', 'DbFormat', 'VARCHAR', false, 128, null);
$this->addColumn('LENGTH', 'DbLength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('ALBUM_TITLE', 'DbAlbumTitle', 'VARCHAR', false, 512, null);
$this->addColumn('GENRE', 'DbGenre', 'VARCHAR', false, 64, null);
$this->addColumn('COMMENTS', 'DbComments', 'LONGVARCHAR', false, null, null);
$this->addColumn('YEAR', 'DbYear', 'VARCHAR', false, 16, null);
$this->addColumn('TRACK_NUMBER', 'DbTrackNumber', 'INTEGER', false, null, null);
$this->addColumn('CHANNELS', 'DbChannels', 'INTEGER', false, null, null);
$this->addColumn('URL', 'DbUrl', 'VARCHAR', false, 1024, null);
$this->addColumn('BPM', 'DbBpm', 'INTEGER', false, null, null);
$this->addColumn('RATING', 'DbRating', 'VARCHAR', false, 8, null);
$this->addColumn('ENCODED_BY', 'DbEncodedBy', 'VARCHAR', false, 255, null);
$this->addColumn('DISC_NUMBER', 'DbDiscNumber', 'VARCHAR', false, 8, null);
$this->addColumn('MOOD', 'DbMood', 'VARCHAR', false, 64, null);
$this->addColumn('LABEL', 'DbLabel', 'VARCHAR', false, 512, null);
$this->addColumn('COMPOSER', 'DbComposer', 'VARCHAR', false, 512, null);
$this->addColumn('ENCODER', 'DbEncoder', 'VARCHAR', false, 64, null);
$this->addColumn('CHECKSUM', 'DbChecksum', 'VARCHAR', false, 256, null);
$this->addColumn('LYRICS', 'DbLyrics', 'LONGVARCHAR', false, null, null);
$this->addColumn('ORCHESTRA', 'DbOrchestra', 'VARCHAR', false, 512, null);
$this->addColumn('CONDUCTOR', 'DbConductor', 'VARCHAR', false, 512, null);
$this->addColumn('LYRICIST', 'DbLyricist', 'VARCHAR', false, 512, null);
$this->addColumn('ORIGINAL_LYRICIST', 'DbOriginalLyricist', 'VARCHAR', false, 512, null);
$this->addColumn('RADIO_STATION_NAME', 'DbRadioStationName', 'VARCHAR', false, 512, null);
$this->addColumn('INFO_URL', 'DbInfoUrl', 'VARCHAR', false, 512, null);
$this->addColumn('ARTIST_URL', 'DbArtistUrl', 'VARCHAR', false, 512, null);
$this->addColumn('AUDIO_SOURCE_URL', 'DbAudioSourceUrl', 'VARCHAR', false, 512, null);
$this->addColumn('RADIO_STATION_URL', 'DbRadioStationUrl', 'VARCHAR', false, 512, null);
$this->addColumn('BUY_THIS_URL', 'DbBuyThisUrl', 'VARCHAR', false, 512, null);
$this->addColumn('ISRC_NUMBER', 'DbIsrcNumber', 'VARCHAR', false, 512, null);
$this->addColumn('CATALOG_NUMBER', 'DbCatalogNumber', 'VARCHAR', false, 512, null);
$this->addColumn('ORIGINAL_ARTIST', 'DbOriginalArtist', 'VARCHAR', false, 512, null);
$this->addColumn('COPYRIGHT', 'DbCopyright', 'VARCHAR', false, 512, null);
$this->addColumn('REPORT_DATETIME', 'DbReportDatetime', 'VARCHAR', false, 32, null);
$this->addColumn('REPORT_LOCATION', 'DbReportLocation', 'VARCHAR', false, 512, null);
$this->addColumn('REPORT_ORGANIZATION', 'DbReportOrganization', 'VARCHAR', false, 512, null);
$this->addColumn('SUBJECT', 'DbSubject', 'VARCHAR', false, 512, null);
$this->addColumn('CONTRIBUTOR', 'DbContributor', 'VARCHAR', false, 512, null);
$this->addColumn('LANGUAGE', 'DbLanguage', 'VARCHAR', false, 512, null);
$this->addColumn('FILE_EXISTS', 'DbFileExists', 'BOOLEAN', false, null, true);
$this->addColumn('SOUNDCLOUD_ID', 'DbSoundcloudId', 'INTEGER', false, null, null);
$this->addColumn('SOUNDCLOUD_ERROR_CODE', 'DbSoundcloudErrorCode', 'INTEGER', false, null, null);
$this->addColumn('SOUNDCLOUD_ERROR_MSG', 'DbSoundcloudErrorMsg', 'VARCHAR', false, 512, null);
$this->addColumn('SOUNDCLOUD_LINK_TO_FILE', 'DbSoundcloudLinkToFile', 'VARCHAR', false, 4096, null);
$this->addColumn('SOUNDCLOUD_UPLOAD_TIME', 'DbSoundCloundUploadTime', 'TIMESTAMP', false, 6, null);
$this->addColumn('REPLAY_GAIN', 'DbReplayGain', 'NUMERIC', false, null, null);
$this->addForeignKey('OWNER_ID', 'DbOwnerId', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
$this->addColumn('CUEIN', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('CUEOUT', 'DbCueout', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('SILAN_CHECK', 'DbSilanCheck', 'BOOLEAN', false, null, false);
$this->addColumn('HIDDEN', 'DbHidden', 'BOOLEAN', false, null, false);
$this->addColumn('IS_SCHEDULED', 'DbIsScheduled', 'BOOLEAN', false, null, false);
$this->addColumn('IS_PLAYLIST', 'DbIsPlaylist', 'BOOLEAN', false, null, false);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('name', 'DbName', 'VARCHAR', true, 255, '');
$this->addColumn('mime', 'DbMime', 'VARCHAR', true, 255, '');
$this->addColumn('ftype', 'DbFtype', 'VARCHAR', true, 128, '');
$this->addForeignKey('directory', 'DbDirectory', 'INTEGER', 'cc_music_dirs', 'id', false, null, null);
$this->addColumn('filepath', 'DbFilepath', 'LONGVARCHAR', false, null, '');
$this->addColumn('import_status', 'DbImportStatus', 'INTEGER', true, null, 1);
$this->addColumn('currentlyaccessing', 'DbCurrentlyaccessing', 'INTEGER', true, null, 0);
$this->addForeignKey('editedby', 'DbEditedby', 'INTEGER', 'cc_subjs', 'id', false, null, null);
$this->addColumn('mtime', 'DbMtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('utime', 'DbUtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('lptime', 'DbLPtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('md5', 'DbMd5', 'CHAR', false, 32, null);
$this->addColumn('track_title', 'DbTrackTitle', 'VARCHAR', false, 512, null);
$this->addColumn('artist_name', 'DbArtistName', 'VARCHAR', false, 512, null);
$this->addColumn('bit_rate', 'DbBitRate', 'INTEGER', false, null, null);
$this->addColumn('sample_rate', 'DbSampleRate', 'INTEGER', false, null, null);
$this->addColumn('format', 'DbFormat', 'VARCHAR', false, 128, null);
$this->addColumn('length', 'DbLength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('album_title', 'DbAlbumTitle', 'VARCHAR', false, 512, null);
$this->addColumn('genre', 'DbGenre', 'VARCHAR', false, 64, null);
$this->addColumn('comments', 'DbComments', 'LONGVARCHAR', false, null, null);
$this->addColumn('year', 'DbYear', 'VARCHAR', false, 16, null);
$this->addColumn('track_number', 'DbTrackNumber', 'INTEGER', false, null, null);
$this->addColumn('channels', 'DbChannels', 'INTEGER', false, null, null);
$this->addColumn('url', 'DbUrl', 'VARCHAR', false, 1024, null);
$this->addColumn('bpm', 'DbBpm', 'INTEGER', false, null, null);
$this->addColumn('rating', 'DbRating', 'VARCHAR', false, 8, null);
$this->addColumn('encoded_by', 'DbEncodedBy', 'VARCHAR', false, 255, null);
$this->addColumn('disc_number', 'DbDiscNumber', 'VARCHAR', false, 8, null);
$this->addColumn('mood', 'DbMood', 'VARCHAR', false, 64, null);
$this->addColumn('label', 'DbLabel', 'VARCHAR', false, 512, null);
$this->addColumn('composer', 'DbComposer', 'VARCHAR', false, 512, null);
$this->addColumn('encoder', 'DbEncoder', 'VARCHAR', false, 64, null);
$this->addColumn('checksum', 'DbChecksum', 'VARCHAR', false, 256, null);
$this->addColumn('lyrics', 'DbLyrics', 'LONGVARCHAR', false, null, null);
$this->addColumn('orchestra', 'DbOrchestra', 'VARCHAR', false, 512, null);
$this->addColumn('conductor', 'DbConductor', 'VARCHAR', false, 512, null);
$this->addColumn('lyricist', 'DbLyricist', 'VARCHAR', false, 512, null);
$this->addColumn('original_lyricist', 'DbOriginalLyricist', 'VARCHAR', false, 512, null);
$this->addColumn('radio_station_name', 'DbRadioStationName', 'VARCHAR', false, 512, null);
$this->addColumn('info_url', 'DbInfoUrl', 'VARCHAR', false, 512, null);
$this->addColumn('artist_url', 'DbArtistUrl', 'VARCHAR', false, 512, null);
$this->addColumn('audio_source_url', 'DbAudioSourceUrl', 'VARCHAR', false, 512, null);
$this->addColumn('radio_station_url', 'DbRadioStationUrl', 'VARCHAR', false, 512, null);
$this->addColumn('buy_this_url', 'DbBuyThisUrl', 'VARCHAR', false, 512, null);
$this->addColumn('isrc_number', 'DbIsrcNumber', 'VARCHAR', false, 512, null);
$this->addColumn('catalog_number', 'DbCatalogNumber', 'VARCHAR', false, 512, null);
$this->addColumn('original_artist', 'DbOriginalArtist', 'VARCHAR', false, 512, null);
$this->addColumn('copyright', 'DbCopyright', 'VARCHAR', false, 512, null);
$this->addColumn('report_datetime', 'DbReportDatetime', 'VARCHAR', false, 32, null);
$this->addColumn('report_location', 'DbReportLocation', 'VARCHAR', false, 512, null);
$this->addColumn('report_organization', 'DbReportOrganization', 'VARCHAR', false, 512, null);
$this->addColumn('subject', 'DbSubject', 'VARCHAR', false, 512, null);
$this->addColumn('contributor', 'DbContributor', 'VARCHAR', false, 512, null);
$this->addColumn('language', 'DbLanguage', 'VARCHAR', false, 512, null);
$this->addColumn('file_exists', 'DbFileExists', 'BOOLEAN', false, null, true);
$this->addColumn('soundcloud_id', 'DbSoundcloudId', 'INTEGER', false, null, null);
$this->addColumn('soundcloud_error_code', 'DbSoundcloudErrorCode', 'INTEGER', false, null, null);
$this->addColumn('soundcloud_error_msg', 'DbSoundcloudErrorMsg', 'VARCHAR', false, 512, null);
$this->addColumn('soundcloud_link_to_file', 'DbSoundcloudLinkToFile', 'VARCHAR', false, 4096, null);
$this->addColumn('soundcloud_upload_time', 'DbSoundCloundUploadTime', 'TIMESTAMP', false, 6, null);
$this->addColumn('replay_gain', 'DbReplayGain', 'NUMERIC', false, null, null);
$this->addForeignKey('owner_id', 'DbOwnerId', 'INTEGER', 'cc_subjs', 'id', false, null, null);
$this->addColumn('cuein', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('cueout', 'DbCueout', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('silan_check', 'DbSilanCheck', 'BOOLEAN', false, null, false);
$this->addColumn('hidden', 'DbHidden', 'BOOLEAN', false, null, false);
$this->addColumn('is_scheduled', 'DbIsScheduled', 'BOOLEAN', false, null, false);
$this->addColumn('is_playlist', 'DbIsPlaylist', 'BOOLEAN', false, null, false);
// validators
} // initialize()
@ -119,11 +120,12 @@ class CcFilesTableMap extends TableMap {
$this->addRelation('FkOwner', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner_id' => 'id', ), null, null);
$this->addRelation('CcSubjsRelatedByDbEditedby', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null);
$this->addRelation('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), null, null);
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
$this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
$this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
$this->addRelation('CloudFile', 'CloudFile', RelationMap::ONE_TO_MANY, array('id' => 'cc_file_id', ), 'CASCADE', null, 'CloudFiles');
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcShowInstancess');
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcPlaylistcontentss');
$this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcBlockcontentss');
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcSchedules');
$this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcPlayoutHistorys');
} // buildRelations()
} // CcFilesTableMap

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcListenerCountTableMap extends TableMap {
class CcListenerCountTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,10 +39,10 @@ class CcListenerCountTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_listener_count_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('TIMESTAMP_ID', 'DbTimestampId', 'INTEGER', 'cc_timestamp', 'ID', true, null, null);
$this->addForeignKey('MOUNT_NAME_ID', 'DbMountNameId', 'INTEGER', 'cc_mount_name', 'ID', true, null, null);
$this->addColumn('LISTENER_COUNT', 'DbListenerCount', 'INTEGER', true, null, null);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('timestamp_id', 'DbTimestampId', 'INTEGER', 'cc_timestamp', 'id', true, null, null);
$this->addForeignKey('mount_name_id', 'DbMountNameId', 'INTEGER', 'cc_mount_name', 'id', true, null, null);
$this->addColumn('listener_count', 'DbListenerCount', 'INTEGER', true, null, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcLiveLogTableMap extends TableMap {
class CcLiveLogTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,10 +39,10 @@ class CcLiveLogTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_live_log_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('STATE', 'DbState', 'VARCHAR', true, 32, null);
$this->addColumn('START_TIME', 'DbStartTime', 'TIMESTAMP', true, null, null);
$this->addColumn('END_TIME', 'DbEndTime', 'TIMESTAMP', false, null, null);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('state', 'DbState', 'VARCHAR', true, 32, null);
$this->addColumn('start_time', 'DbStartTime', 'TIMESTAMP', true, null, null);
$this->addColumn('end_time', 'DbEndTime', 'TIMESTAMP', false, null, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcLocaleTableMap extends TableMap {
class CcLocaleTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,9 +39,9 @@ class CcLocaleTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_locale_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('LOCALE_CODE', 'DbLocaleCode', 'VARCHAR', true, 16, null);
$this->addColumn('LOCALE_LANG', 'DbLocaleLang', 'VARCHAR', true, 128, null);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('locale_code', 'DbLocaleCode', 'VARCHAR', true, 16, null);
$this->addColumn('locale_lang', 'DbLocaleLang', 'VARCHAR', true, 128, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcLoginAttemptsTableMap extends TableMap {
class CcLoginAttemptsTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -37,8 +38,8 @@ class CcLoginAttemptsTableMap extends TableMap {
$this->setPackage('airtime');
$this->setUseIdGenerator(false);
// columns
$this->addPrimaryKey('IP', 'DbIP', 'VARCHAR', true, 32, null);
$this->addColumn('ATTEMPTS', 'DbAttempts', 'INTEGER', false, null, 0);
$this->addPrimaryKey('ip', 'DbIP', 'VARCHAR', true, 32, null);
$this->addColumn('attempts', 'DbAttempts', 'INTEGER', false, null, 0);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcMountNameTableMap extends TableMap {
class CcMountNameTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,8 +39,8 @@ class CcMountNameTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_mount_name_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('MOUNT_NAME', 'DbMountName', 'VARCHAR', true, 255, null);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('mount_name', 'DbMountName', 'VARCHAR', true, null, null);
// validators
} // initialize()
@ -48,7 +49,7 @@ class CcMountNameTableMap extends TableMap {
*/
public function buildRelations()
{
$this->addRelation('CcListenerCount', 'CcListenerCount', RelationMap::ONE_TO_MANY, array('id' => 'mount_name_id', ), 'CASCADE', null);
$this->addRelation('CcListenerCount', 'CcListenerCount', RelationMap::ONE_TO_MANY, array('id' => 'mount_name_id', ), 'CASCADE', null, 'CcListenerCounts');
} // buildRelations()
} // CcMountNameTableMap

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcMusicDirsTableMap extends TableMap {
class CcMusicDirsTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,11 +39,11 @@ class CcMusicDirsTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_music_dirs_id_seq');
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('DIRECTORY', 'Directory', 'LONGVARCHAR', false, null, null);
$this->addColumn('TYPE', 'Type', 'VARCHAR', false, 255, null);
$this->addColumn('EXISTS', 'Exists', 'BOOLEAN', false, null, true);
$this->addColumn('WATCHED', 'Watched', 'BOOLEAN', false, null, true);
$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
$this->addColumn('directory', 'Directory', 'LONGVARCHAR', false, null, null);
$this->addColumn('type', 'Type', 'VARCHAR', false, 255, null);
$this->addColumn('exists', 'Exists', 'BOOLEAN', false, null, true);
$this->addColumn('watched', 'Watched', 'BOOLEAN', false, null, true);
// validators
} // initialize()
@ -51,7 +52,7 @@ class CcMusicDirsTableMap extends TableMap {
*/
public function buildRelations()
{
$this->addRelation('CcFiles', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'directory', ), null, null);
$this->addRelation('CcFiles', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'directory', ), null, null, 'CcFiless');
} // buildRelations()
} // CcMusicDirsTableMap

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcPermsTableMap extends TableMap {
class CcPermsTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -37,11 +38,11 @@ class CcPermsTableMap extends TableMap {
$this->setPackage('airtime');
$this->setUseIdGenerator(false);
// columns
$this->addPrimaryKey('PERMID', 'Permid', 'INTEGER', true, null, null);
$this->addForeignKey('SUBJ', 'Subj', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
$this->addColumn('ACTION', 'Action', 'VARCHAR', false, 20, null);
$this->addColumn('OBJ', 'Obj', 'INTEGER', false, null, null);
$this->addColumn('TYPE', 'Type', 'CHAR', false, 1, null);
$this->addPrimaryKey('permid', 'Permid', 'INTEGER', true, null, null);
$this->addForeignKey('subj', 'Subj', 'INTEGER', 'cc_subjs', 'id', false, null, null);
$this->addColumn('action', 'Action', 'VARCHAR', false, 20, null);
$this->addColumn('obj', 'Obj', 'INTEGER', false, null, null);
$this->addColumn('type', 'Type', 'CHAR', false, 1, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcPlaylistTableMap extends TableMap {
class CcPlaylistTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,13 +39,13 @@ class CcPlaylistTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_playlist_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
$this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', false, 6, null);
$this->addForeignKey('CREATOR_ID', 'DbCreatorId', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
$this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null);
$this->addColumn('LENGTH', 'DbLength', 'VARCHAR', false, null, '00:00:00');
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('name', 'DbName', 'VARCHAR', true, 255, '');
$this->addColumn('mtime', 'DbMtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('utime', 'DbUtime', 'TIMESTAMP', false, 6, null);
$this->addForeignKey('creator_id', 'DbCreatorId', 'INTEGER', 'cc_subjs', 'id', false, null, null);
$this->addColumn('description', 'DbDescription', 'VARCHAR', false, 512, null);
$this->addColumn('length', 'DbLength', 'VARCHAR', false, null, '00:00:00');
// validators
} // initialize()
@ -54,7 +55,7 @@ class CcPlaylistTableMap extends TableMap {
public function buildRelations()
{
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'playlist_id', ), 'CASCADE', null);
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'playlist_id', ), 'CASCADE', null, 'CcPlaylistcontentss');
} // buildRelations()
/**
@ -66,7 +67,13 @@ class CcPlaylistTableMap extends TableMap {
public function getBehaviors()
{
return array(
'aggregate_column' => array('name' => 'length', 'expression' => 'SUM(cliplength)', 'foreign_table' => 'cc_playlistcontents', ),
'aggregate_column' => array (
'name' => 'length',
'expression' => 'SUM(cliplength)',
'condition' => NULL,
'foreign_table' => 'cc_playlistcontents',
'foreign_schema' => NULL,
),
);
} // getBehaviors()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcPlaylistcontentsTableMap extends TableMap {
class CcPlaylistcontentsTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,19 +39,19 @@ class CcPlaylistcontentsTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_playlistcontents_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', 'cc_playlist', 'ID', false, null, null);
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
$this->addForeignKey('BLOCK_ID', 'DbBlockId', 'INTEGER', 'cc_block', 'ID', false, null, null);
$this->addColumn('STREAM_ID', 'DbStreamId', 'INTEGER', false, null, null);
$this->addColumn('TYPE', 'DbType', 'SMALLINT', true, null, 0);
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null);
$this->addColumn('TRACKOFFSET', 'DbTrackOffset', 'REAL', true, null, 0);
$this->addColumn('CLIPLENGTH', 'DbCliplength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('CUEIN', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('CUEOUT', 'DbCueout', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('FADEIN', 'DbFadein', 'TIME', false, null, '00:00:00');
$this->addColumn('FADEOUT', 'DbFadeout', 'TIME', false, null, '00:00:00');
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('playlist_id', 'DbPlaylistId', 'INTEGER', 'cc_playlist', 'id', false, null, null);
$this->addForeignKey('file_id', 'DbFileId', 'INTEGER', 'cc_files', 'id', false, null, null);
$this->addForeignKey('block_id', 'DbBlockId', 'INTEGER', 'cc_block', 'id', false, null, null);
$this->addColumn('stream_id', 'DbStreamId', 'INTEGER', false, null, null);
$this->addColumn('type', 'DbType', 'SMALLINT', true, null, 0);
$this->addColumn('position', 'DbPosition', 'INTEGER', false, null, null);
$this->addColumn('trackoffset', 'DbTrackOffset', 'REAL', true, null, 0);
$this->addColumn('cliplength', 'DbCliplength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('cuein', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('cueout', 'DbCueout', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('fadein', 'DbFadein', 'TIME', false, null, '00:00:00');
$this->addColumn('fadeout', 'DbFadeout', 'TIME', false, null, '00:00:00');
// validators
} // initialize()
@ -73,7 +74,10 @@ class CcPlaylistcontentsTableMap extends TableMap {
public function getBehaviors()
{
return array(
'aggregate_column_relation' => array('foreign_table' => 'cc_playlist', 'update_method' => 'updateDbLength', ),
'aggregate_column_relation' => array (
'foreign_table' => 'cc_playlist',
'update_method' => 'updateDbLength',
),
);
} // getBehaviors()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcPlayoutHistoryMetaDataTableMap extends TableMap {
class CcPlayoutHistoryMetaDataTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,10 +39,10 @@ class CcPlayoutHistoryMetaDataTableMap extends TableMap {
$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);
$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()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcPlayoutHistoryTableMap extends TableMap {
class CcPlayoutHistoryTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,11 +39,11 @@ class CcPlayoutHistoryTableMap extends TableMap {
$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', false, null, null);
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', false, null, null);
$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', false, null, null);
$this->addForeignKey('instance_id', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'id', false, null, null);
// validators
} // initialize()
@ -53,7 +54,7 @@ class CcPlayoutHistoryTableMap extends TableMap {
{
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'SET NULL', null);
$this->addRelation('CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaData', RelationMap::ONE_TO_MANY, array('id' => 'history_id', ), 'CASCADE', null);
$this->addRelation('CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaData', RelationMap::ONE_TO_MANY, array('id' => 'history_id', ), 'CASCADE', null, 'CcPlayoutHistoryMetaDatas');
} // buildRelations()
} // CcPlayoutHistoryTableMap

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcPlayoutHistoryTemplateFieldTableMap extends TableMap {
class CcPlayoutHistoryTemplateFieldTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,13 +39,13 @@ class CcPlayoutHistoryTemplateFieldTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_playout_history_template_field_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('TEMPLATE_ID', 'DbTemplateId', 'INTEGER', 'cc_playout_history_template', 'ID', true, null, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 128, null);
$this->addColumn('LABEL', 'DbLabel', 'VARCHAR', true, 128, null);
$this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 128, null);
$this->addColumn('IS_FILE_MD', 'DbIsFileMD', 'BOOLEAN', true, null, false);
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', true, null, null);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('template_id', 'DbTemplateId', 'INTEGER', 'cc_playout_history_template', 'id', true, null, null);
$this->addColumn('name', 'DbName', 'VARCHAR', true, 128, null);
$this->addColumn('label', 'DbLabel', 'VARCHAR', true, 128, null);
$this->addColumn('type', 'DbType', 'VARCHAR', true, 128, null);
$this->addColumn('is_file_md', 'DbIsFileMD', 'BOOLEAN', true, null, false);
$this->addColumn('position', 'DbPosition', 'INTEGER', true, null, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcPlayoutHistoryTemplateTableMap extends TableMap {
class CcPlayoutHistoryTemplateTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,9 +39,9 @@ class CcPlayoutHistoryTemplateTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_playout_history_template_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 128, null);
$this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 35, null);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('name', 'DbName', 'VARCHAR', true, 128, null);
$this->addColumn('type', 'DbType', 'VARCHAR', true, 35, null);
// validators
} // initialize()
@ -49,7 +50,7 @@ class CcPlayoutHistoryTemplateTableMap extends TableMap {
*/
public function buildRelations()
{
$this->addRelation('CcPlayoutHistoryTemplateField', 'CcPlayoutHistoryTemplateField', RelationMap::ONE_TO_MANY, array('id' => 'template_id', ), 'CASCADE', null);
$this->addRelation('CcPlayoutHistoryTemplateField', 'CcPlayoutHistoryTemplateField', RelationMap::ONE_TO_MANY, array('id' => 'template_id', ), 'CASCADE', null, 'CcPlayoutHistoryTemplateFields');
} // buildRelations()
} // CcPlayoutHistoryTemplateTableMap

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcPrefTableMap extends TableMap {
class CcPrefTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,10 +39,10 @@ class CcPrefTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_pref_id_seq');
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('SUBJID', 'Subjid', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
$this->addColumn('KEYSTR', 'Keystr', 'VARCHAR', false, 255, null);
$this->addColumn('VALSTR', 'Valstr', 'LONGVARCHAR', false, null, null);
$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('subjid', 'Subjid', 'INTEGER', 'cc_subjs', 'id', false, null, null);
$this->addColumn('keystr', 'Keystr', 'VARCHAR', false, 255, null);
$this->addColumn('valstr', 'Valstr', 'LONGVARCHAR', false, null, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcScheduleTableMap extends TableMap {
class CcScheduleTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,21 +39,21 @@ class CcScheduleTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_schedule_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
$this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
$this->addForeignKey('STREAM_ID', 'DbStreamId', 'INTEGER', 'cc_webstream', 'ID', false, null, null);
$this->addColumn('CLIP_LENGTH', 'DbClipLength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('FADE_IN', 'DbFadeIn', 'TIME', false, null, '00:00:00');
$this->addColumn('FADE_OUT', 'DbFadeOut', 'TIME', false, null, '00:00:00');
$this->addColumn('CUE_IN', 'DbCueIn', 'VARCHAR', true, null, null);
$this->addColumn('CUE_OUT', 'DbCueOut', 'VARCHAR', true, null, null);
$this->addColumn('MEDIA_ITEM_PLAYED', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false);
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null);
$this->addColumn('PLAYOUT_STATUS', 'DbPlayoutStatus', 'SMALLINT', true, null, 1);
$this->addColumn('BROADCASTED', 'DbBroadcasted', 'SMALLINT', true, null, 0);
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', true, null, 0);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('starts', 'DbStarts', 'TIMESTAMP', true, null, null);
$this->addColumn('ends', 'DbEnds', 'TIMESTAMP', true, null, null);
$this->addForeignKey('file_id', 'DbFileId', 'INTEGER', 'cc_files', 'id', false, null, null);
$this->addForeignKey('stream_id', 'DbStreamId', 'INTEGER', 'cc_webstream', 'id', false, null, null);
$this->addColumn('clip_length', 'DbClipLength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('fade_in', 'DbFadeIn', 'TIME', false, null, '00:00:00');
$this->addColumn('fade_out', 'DbFadeOut', 'TIME', false, null, '00:00:00');
$this->addColumn('cue_in', 'DbCueIn', 'VARCHAR', true, null, null);
$this->addColumn('cue_out', 'DbCueOut', 'VARCHAR', true, null, null);
$this->addColumn('media_item_played', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false);
$this->addForeignKey('instance_id', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'id', true, null, null);
$this->addColumn('playout_status', 'DbPlayoutStatus', 'SMALLINT', true, null, 1);
$this->addColumn('broadcasted', 'DbBroadcasted', 'SMALLINT', true, null, 0);
$this->addColumn('position', 'DbPosition', 'INTEGER', true, null, 0);
// validators
} // initialize()
@ -64,7 +65,7 @@ class CcScheduleTableMap extends TableMap {
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcWebstream', 'CcWebstream', RelationMap::MANY_TO_ONE, array('stream_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcWebstreamMetadata', 'CcWebstreamMetadata', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null);
$this->addRelation('CcWebstreamMetadata', 'CcWebstreamMetadata', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null, 'CcWebstreamMetadatas');
} // buildRelations()
} // CcScheduleTableMap

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcServiceRegisterTableMap extends TableMap {
class CcServiceRegisterTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -37,8 +38,8 @@ class CcServiceRegisterTableMap extends TableMap {
$this->setPackage('airtime');
$this->setUseIdGenerator(false);
// columns
$this->addPrimaryKey('NAME', 'DbName', 'VARCHAR', true, 32, null);
$this->addColumn('IP', 'DbIp', 'VARCHAR', true, 18, null);
$this->addPrimaryKey('name', 'DbName', 'VARCHAR', true, 32, null);
$this->addColumn('ip', 'DbIp', 'VARCHAR', true, 18, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcSessTableMap extends TableMap {
class CcSessTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -37,10 +38,10 @@ class CcSessTableMap extends TableMap {
$this->setPackage('airtime');
$this->setUseIdGenerator(false);
// columns
$this->addPrimaryKey('SESSID', 'Sessid', 'CHAR', true, 32, null);
$this->addForeignKey('USERID', 'Userid', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
$this->addColumn('LOGIN', 'Login', 'VARCHAR', false, 255, null);
$this->addColumn('TS', 'Ts', 'TIMESTAMP', false, null, null);
$this->addPrimaryKey('sessid', 'Sessid', 'CHAR', true, 32, null);
$this->addForeignKey('userid', 'Userid', 'INTEGER', 'cc_subjs', 'id', false, null, null);
$this->addColumn('login', 'Login', 'VARCHAR', false, 255, null);
$this->addColumn('ts', 'Ts', 'TIMESTAMP', false, null, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcShowDaysTableMap extends TableMap {
class CcShowDaysTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,17 +39,17 @@ class CcShowDaysTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_show_days_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('FIRST_SHOW', 'DbFirstShow', 'DATE', true, null, null);
$this->addColumn('LAST_SHOW', 'DbLastShow', 'DATE', false, null, null);
$this->addColumn('START_TIME', 'DbStartTime', 'TIME', true, null, null);
$this->addColumn('TIMEZONE', 'DbTimezone', 'VARCHAR', true, 255, null);
$this->addColumn('DURATION', 'DbDuration', 'VARCHAR', true, 255, null);
$this->addColumn('DAY', 'DbDay', 'TINYINT', false, null, null);
$this->addColumn('REPEAT_TYPE', 'DbRepeatType', 'TINYINT', true, null, null);
$this->addColumn('NEXT_POP_DATE', 'DbNextPopDate', 'DATE', false, null, null);
$this->addForeignKey('SHOW_ID', 'DbShowId', 'INTEGER', 'cc_show', 'ID', true, null, null);
$this->addColumn('RECORD', 'DbRecord', 'TINYINT', false, null, 0);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('first_show', 'DbFirstShow', 'DATE', true, null, null);
$this->addColumn('last_show', 'DbLastShow', 'DATE', false, null, null);
$this->addColumn('start_time', 'DbStartTime', 'TIME', true, null, null);
$this->addColumn('timezone', 'DbTimezone', 'VARCHAR', true, null, null);
$this->addColumn('duration', 'DbDuration', 'VARCHAR', true, null, null);
$this->addColumn('day', 'DbDay', 'TINYINT', false, null, null);
$this->addColumn('repeat_type', 'DbRepeatType', 'TINYINT', true, null, null);
$this->addColumn('next_pop_date', 'DbNextPopDate', 'DATE', false, null, null);
$this->addForeignKey('show_id', 'DbShowId', 'INTEGER', 'cc_show', 'id', true, null, null);
$this->addColumn('record', 'DbRecord', 'TINYINT', false, null, 0);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcShowHostsTableMap extends TableMap {
class CcShowHostsTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,9 +39,9 @@ class CcShowHostsTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_show_hosts_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('SHOW_ID', 'DbShow', 'INTEGER', 'cc_show', 'ID', true, null, null);
$this->addForeignKey('SUBJS_ID', 'DbHost', 'INTEGER', 'cc_subjs', 'ID', true, null, null);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('show_id', 'DbShow', 'INTEGER', 'cc_show', 'id', true, null, null);
$this->addForeignKey('subjs_id', 'DbHost', 'INTEGER', 'cc_subjs', 'id', true, null, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcShowInstancesTableMap extends TableMap {
class CcShowInstancesTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,18 +39,18 @@ class CcShowInstancesTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_show_instances_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
$this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
$this->addForeignKey('SHOW_ID', 'DbShowId', 'INTEGER', 'cc_show', 'ID', true, null, null);
$this->addColumn('RECORD', 'DbRecord', 'TINYINT', false, null, 0);
$this->addColumn('REBROADCAST', 'DbRebroadcast', 'TINYINT', false, null, 0);
$this->addForeignKey('INSTANCE_ID', 'DbOriginalShow', 'INTEGER', 'cc_show_instances', 'ID', false, null, null);
$this->addForeignKey('FILE_ID', 'DbRecordedFile', 'INTEGER', 'cc_files', 'ID', false, null, null);
$this->addColumn('TIME_FILLED', 'DbTimeFilled', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('CREATED', 'DbCreated', 'TIMESTAMP', true, null, null);
$this->addColumn('LAST_SCHEDULED', 'DbLastScheduled', 'TIMESTAMP', false, null, null);
$this->addColumn('MODIFIED_INSTANCE', 'DbModifiedInstance', 'BOOLEAN', true, null, false);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('starts', 'DbStarts', 'TIMESTAMP', true, null, null);
$this->addColumn('ends', 'DbEnds', 'TIMESTAMP', true, null, null);
$this->addForeignKey('show_id', 'DbShowId', 'INTEGER', 'cc_show', 'id', true, null, null);
$this->addColumn('record', 'DbRecord', 'TINYINT', false, null, 0);
$this->addColumn('rebroadcast', 'DbRebroadcast', 'TINYINT', false, null, 0);
$this->addForeignKey('instance_id', 'DbOriginalShow', 'INTEGER', 'cc_show_instances', 'id', false, null, null);
$this->addForeignKey('file_id', 'DbRecordedFile', 'INTEGER', 'cc_files', 'id', false, null, null);
$this->addColumn('time_filled', 'DbTimeFilled', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('created', 'DbCreated', 'TIMESTAMP', true, null, null);
$this->addColumn('last_scheduled', 'DbLastScheduled', 'TIMESTAMP', false, null, null);
$this->addColumn('modified_instance', 'DbModifiedInstance', 'BOOLEAN', true, null, false);
// validators
} // initialize()
@ -61,9 +62,9 @@ class CcShowInstancesTableMap extends TableMap {
$this->addRelation('CcShow', 'CcShow', RelationMap::MANY_TO_ONE, array('show_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcShowInstancesRelatedByDbOriginalShow', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcShowInstancesRelatedByDbId', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null);
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null);
$this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'SET NULL', null);
$this->addRelation('CcShowInstancesRelatedByDbId', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null, 'CcShowInstancessRelatedByDbId');
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null, 'CcSchedules');
$this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'SET NULL', null, 'CcPlayoutHistorys');
} // buildRelations()
} // CcShowInstancesTableMap

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcShowRebroadcastTableMap extends TableMap {
class CcShowRebroadcastTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,10 +39,10 @@ class CcShowRebroadcastTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_show_rebroadcast_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('DAY_OFFSET', 'DbDayOffset', 'VARCHAR', true, 255, null);
$this->addColumn('START_TIME', 'DbStartTime', 'TIME', true, null, null);
$this->addForeignKey('SHOW_ID', 'DbShowId', 'INTEGER', 'cc_show', 'ID', true, null, null);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('day_offset', 'DbDayOffset', 'VARCHAR', true, null, null);
$this->addColumn('start_time', 'DbStartTime', 'TIME', true, null, null);
$this->addForeignKey('show_id', 'DbShowId', 'INTEGER', 'cc_show', 'id', true, null, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcShowTableMap extends TableMap {
class CcShowTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,19 +39,19 @@ class CcShowTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_show_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
$this->addColumn('URL', 'DbUrl', 'VARCHAR', false, 255, '');
$this->addColumn('GENRE', 'DbGenre', 'VARCHAR', false, 255, '');
$this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null);
$this->addColumn('COLOR', 'DbColor', 'VARCHAR', false, 6, null);
$this->addColumn('BACKGROUND_COLOR', 'DbBackgroundColor', 'VARCHAR', false, 6, null);
$this->addColumn('LIVE_STREAM_USING_AIRTIME_AUTH', 'DbLiveStreamUsingAirtimeAuth', 'BOOLEAN', false, null, false);
$this->addColumn('LIVE_STREAM_USING_CUSTOM_AUTH', 'DbLiveStreamUsingCustomAuth', 'BOOLEAN', false, null, false);
$this->addColumn('LIVE_STREAM_USER', 'DbLiveStreamUser', 'VARCHAR', false, 255, null);
$this->addColumn('LIVE_STREAM_PASS', 'DbLiveStreamPass', 'VARCHAR', false, 255, null);
$this->addColumn('LINKED', 'DbLinked', 'BOOLEAN', true, null, false);
$this->addColumn('IS_LINKABLE', 'DbIsLinkable', 'BOOLEAN', true, null, true);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('name', 'DbName', 'VARCHAR', true, 255, '');
$this->addColumn('url', 'DbUrl', 'VARCHAR', false, 255, '');
$this->addColumn('genre', 'DbGenre', 'VARCHAR', false, 255, '');
$this->addColumn('description', 'DbDescription', 'VARCHAR', false, 512, null);
$this->addColumn('color', 'DbColor', 'VARCHAR', false, 6, null);
$this->addColumn('background_color', 'DbBackgroundColor', 'VARCHAR', false, 6, null);
$this->addColumn('live_stream_using_airtime_auth', 'DbLiveStreamUsingAirtimeAuth', 'BOOLEAN', false, null, false);
$this->addColumn('live_stream_using_custom_auth', 'DbLiveStreamUsingCustomAuth', 'BOOLEAN', false, null, false);
$this->addColumn('live_stream_user', 'DbLiveStreamUser', 'VARCHAR', false, 255, null);
$this->addColumn('live_stream_pass', 'DbLiveStreamPass', 'VARCHAR', false, 255, null);
$this->addColumn('linked', 'DbLinked', 'BOOLEAN', true, null, false);
$this->addColumn('is_linkable', 'DbIsLinkable', 'BOOLEAN', true, null, true);
// validators
} // initialize()
@ -59,10 +60,10 @@ class CcShowTableMap extends TableMap {
*/
public function buildRelations()
{
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null);
$this->addRelation('CcShowDays', 'CcShowDays', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null);
$this->addRelation('CcShowRebroadcast', 'CcShowRebroadcast', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null);
$this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null);
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null, 'CcShowInstancess');
$this->addRelation('CcShowDays', 'CcShowDays', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null, 'CcShowDayss');
$this->addRelation('CcShowRebroadcast', 'CcShowRebroadcast', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null, 'CcShowRebroadcasts');
$this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null, 'CcShowHostss');
} // buildRelations()
} // CcShowTableMap

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcSmembTableMap extends TableMap {
class CcSmembTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -37,11 +38,11 @@ class CcSmembTableMap extends TableMap {
$this->setPackage('airtime');
$this->setUseIdGenerator(false);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('UID', 'Uid', 'INTEGER', true, null, 0);
$this->addColumn('GID', 'Gid', 'INTEGER', true, null, 0);
$this->addColumn('LEVEL', 'Level', 'INTEGER', true, null, 0);
$this->addColumn('MID', 'Mid', 'INTEGER', false, null, null);
$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
$this->addColumn('uid', 'Uid', 'INTEGER', true, null, 0);
$this->addColumn('gid', 'Gid', 'INTEGER', true, null, 0);
$this->addColumn('level', 'Level', 'INTEGER', true, null, 0);
$this->addColumn('mid', 'Mid', 'INTEGER', false, null, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcStreamSettingTableMap extends TableMap {
class CcStreamSettingTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -37,9 +38,9 @@ class CcStreamSettingTableMap extends TableMap {
$this->setPackage('airtime');
$this->setUseIdGenerator(false);
// columns
$this->addPrimaryKey('KEYNAME', 'DbKeyName', 'VARCHAR', true, 64, null);
$this->addColumn('VALUE', 'DbValue', 'VARCHAR', false, 255, null);
$this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 16, null);
$this->addPrimaryKey('keyname', 'DbKeyName', 'VARCHAR', true, 64, null);
$this->addColumn('value', 'DbValue', 'VARCHAR', false, 255, null);
$this->addColumn('type', 'DbType', 'VARCHAR', true, 16, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcSubjsTableMap extends TableMap {
class CcSubjsTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,19 +39,19 @@ class CcSubjsTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_subjs_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('LOGIN', 'DbLogin', 'VARCHAR', true, 255, '');
$this->addColumn('PASS', 'DbPass', 'VARCHAR', true, 255, '');
$this->addColumn('TYPE', 'DbType', 'CHAR', true, 1, 'U');
$this->addColumn('FIRST_NAME', 'DbFirstName', 'VARCHAR', true, 255, '');
$this->addColumn('LAST_NAME', 'DbLastName', 'VARCHAR', true, 255, '');
$this->addColumn('LASTLOGIN', 'DbLastlogin', 'TIMESTAMP', false, null, null);
$this->addColumn('LASTFAIL', 'DbLastfail', 'TIMESTAMP', false, null, null);
$this->addColumn('SKYPE_CONTACT', 'DbSkypeContact', 'VARCHAR', false, 255, null);
$this->addColumn('JABBER_CONTACT', 'DbJabberContact', 'VARCHAR', false, 255, null);
$this->addColumn('EMAIL', 'DbEmail', 'VARCHAR', false, 255, null);
$this->addColumn('CELL_PHONE', 'DbCellPhone', 'VARCHAR', false, 255, null);
$this->addColumn('LOGIN_ATTEMPTS', 'DbLoginAttempts', 'INTEGER', false, null, 0);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('login', 'DbLogin', 'VARCHAR', true, 255, '');
$this->addColumn('pass', 'DbPass', 'VARCHAR', true, 255, '');
$this->addColumn('type', 'DbType', 'CHAR', true, 1, 'U');
$this->addColumn('first_name', 'DbFirstName', 'VARCHAR', true, 255, '');
$this->addColumn('last_name', 'DbLastName', 'VARCHAR', true, 255, '');
$this->addColumn('lastlogin', 'DbLastlogin', 'TIMESTAMP', false, null, null);
$this->addColumn('lastfail', 'DbLastfail', 'TIMESTAMP', false, null, null);
$this->addColumn('skype_contact', 'DbSkypeContact', 'VARCHAR', false, null, null);
$this->addColumn('jabber_contact', 'DbJabberContact', 'VARCHAR', false, null, null);
$this->addColumn('email', 'DbEmail', 'VARCHAR', false, null, null);
$this->addColumn('cell_phone', 'DbCellPhone', 'VARCHAR', false, null, null);
$this->addColumn('login_attempts', 'DbLoginAttempts', 'INTEGER', false, null, 0);
// validators
} // initialize()
@ -59,15 +60,15 @@ class CcSubjsTableMap extends TableMap {
*/
public function buildRelations()
{
$this->addRelation('CcFilesRelatedByDbOwnerId', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'owner_id', ), null, null);
$this->addRelation('CcFilesRelatedByDbEditedby', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'editedby', ), null, null);
$this->addRelation('CcPerms', 'CcPerms', RelationMap::ONE_TO_MANY, array('id' => 'subj', ), 'CASCADE', null);
$this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'subjs_id', ), 'CASCADE', null);
$this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', null);
$this->addRelation('CcBlock', 'CcBlock', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', null);
$this->addRelation('CcPref', 'CcPref', RelationMap::ONE_TO_MANY, array('id' => 'subjid', ), 'CASCADE', null);
$this->addRelation('CcSess', 'CcSess', RelationMap::ONE_TO_MANY, array('id' => 'userid', ), 'CASCADE', null);
$this->addRelation('CcSubjsToken', 'CcSubjsToken', RelationMap::ONE_TO_MANY, array('id' => 'user_id', ), 'CASCADE', null);
$this->addRelation('CcFilesRelatedByDbOwnerId', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'owner_id', ), null, null, 'CcFilessRelatedByDbOwnerId');
$this->addRelation('CcFilesRelatedByDbEditedby', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'editedby', ), null, null, 'CcFilessRelatedByDbEditedby');
$this->addRelation('CcPerms', 'CcPerms', RelationMap::ONE_TO_MANY, array('id' => 'subj', ), 'CASCADE', null, 'CcPermss');
$this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'subjs_id', ), 'CASCADE', null, 'CcShowHostss');
$this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', null, 'CcPlaylists');
$this->addRelation('CcBlock', 'CcBlock', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', null, 'CcBlocks');
$this->addRelation('CcPref', 'CcPref', RelationMap::ONE_TO_MANY, array('id' => 'subjid', ), 'CASCADE', null, 'CcPrefs');
$this->addRelation('CcSess', 'CcSess', RelationMap::ONE_TO_MANY, array('id' => 'userid', ), 'CASCADE', null, 'CcSesss');
$this->addRelation('CcSubjsToken', 'CcSubjsToken', RelationMap::ONE_TO_MANY, array('id' => 'user_id', ), 'CASCADE', null, 'CcSubjsTokens');
} // buildRelations()
} // CcSubjsTableMap

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcSubjsTokenTableMap extends TableMap {
class CcSubjsTokenTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,11 +39,11 @@ class CcSubjsTokenTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_subjs_token_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('USER_ID', 'DbUserId', 'INTEGER', 'cc_subjs', 'ID', true, null, null);
$this->addColumn('ACTION', 'DbAction', 'VARCHAR', true, 255, null);
$this->addColumn('TOKEN', 'DbToken', 'VARCHAR', true, 40, null);
$this->addColumn('CREATED', 'DbCreated', 'TIMESTAMP', true, null, null);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('user_id', 'DbUserId', 'INTEGER', 'cc_subjs', 'id', true, null, null);
$this->addColumn('action', 'DbAction', 'VARCHAR', true, 255, null);
$this->addColumn('token', 'DbToken', 'VARCHAR', true, 40, null);
$this->addColumn('created', 'DbCreated', 'TIMESTAMP', true, null, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcTimestampTableMap extends TableMap {
class CcTimestampTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,8 +39,8 @@ class CcTimestampTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_timestamp_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('TIMESTAMP', 'DbTimestamp', 'TIMESTAMP', true, null, null);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('timestamp', 'DbTimestamp', 'TIMESTAMP', true, null, null);
// validators
} // initialize()
@ -48,7 +49,7 @@ class CcTimestampTableMap extends TableMap {
*/
public function buildRelations()
{
$this->addRelation('CcListenerCount', 'CcListenerCount', RelationMap::ONE_TO_MANY, array('id' => 'timestamp_id', ), 'CASCADE', null);
$this->addRelation('CcListenerCount', 'CcListenerCount', RelationMap::ONE_TO_MANY, array('id' => 'timestamp_id', ), 'CASCADE', null, 'CcListenerCounts');
} // buildRelations()
} // CcTimestampTableMap

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcWebstreamMetadataTableMap extends TableMap {
class CcWebstreamMetadataTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,10 +39,10 @@ class CcWebstreamMetadataTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_webstream_metadata_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_schedule', 'ID', true, null, null);
$this->addColumn('START_TIME', 'DbStartTime', 'TIMESTAMP', true, null, null);
$this->addColumn('LIQUIDSOAP_DATA', 'DbLiquidsoapData', 'VARCHAR', true, 1024, null);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addForeignKey('instance_id', 'DbInstanceId', 'INTEGER', 'cc_schedule', 'id', true, null, null);
$this->addColumn('start_time', 'DbStartTime', 'TIMESTAMP', true, null, null);
$this->addColumn('liquidsoap_data', 'DbLiquidsoapData', 'VARCHAR', true, 1024, null);
// validators
} // initialize()

View File

@ -14,7 +14,8 @@
*
* @package propel.generator.airtime.map
*/
class CcWebstreamTableMap extends TableMap {
class CcWebstreamTableMap extends TableMap
{
/**
* The (dot-path) name of this class
@ -38,16 +39,16 @@ class CcWebstreamTableMap extends TableMap {
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_webstream_id_seq');
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, null);
$this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', true, 255, null);
$this->addColumn('URL', 'DbUrl', 'VARCHAR', true, 512, null);
$this->addColumn('LENGTH', 'DbLength', 'VARCHAR', true, null, '00:00:00');
$this->addColumn('CREATOR_ID', 'DbCreatorId', 'INTEGER', true, null, null);
$this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', true, 6, null);
$this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', true, 6, null);
$this->addColumn('LPTIME', 'DbLPtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('MIME', 'DbMime', 'VARCHAR', false, 255, null);
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('name', 'DbName', 'VARCHAR', true, 255, null);
$this->addColumn('description', 'DbDescription', 'VARCHAR', true, 255, null);
$this->addColumn('url', 'DbUrl', 'VARCHAR', true, 512, null);
$this->addColumn('length', 'DbLength', 'VARCHAR', true, null, '00:00:00');
$this->addColumn('creator_id', 'DbCreatorId', 'INTEGER', true, null, null);
$this->addColumn('mtime', 'DbMtime', 'TIMESTAMP', true, 6, null);
$this->addColumn('utime', 'DbUtime', 'TIMESTAMP', true, 6, null);
$this->addColumn('lptime', 'DbLPtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('mime', 'DbMime', 'VARCHAR', false, null, null);
// validators
} // initialize()
@ -56,7 +57,7 @@ class CcWebstreamTableMap extends TableMap {
*/
public function buildRelations()
{
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'stream_id', ), 'CASCADE', null);
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'stream_id', ), 'CASCADE', null, 'CcSchedules');
} // buildRelations()
} // CcWebstreamTableMap

View File

@ -0,0 +1,72 @@
<?php
/**
* This class defines the structure of the 'cloud_file' 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 CloudFileTableMap extends TableMap
{
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'airtime.map.CloudFileTableMap';
/**
* 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('cloud_file');
$this->setPhpName('CloudFile');
$this->setClassname('CloudFile');
$this->setPackage('airtime');
$this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cloud_file_id_seq');
// columns
$this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('storage_backend', 'StorageBackend', 'VARCHAR', true, 512, null);
$this->addColumn('resource_id', 'ResourceId', 'LONGVARCHAR', true, null, null);
$this->addForeignKey('cc_file_id', 'CcFileId', 'INTEGER', 'cc_files', 'id', false, null, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('cc_file_id' => 'id', ), 'CASCADE', null);
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'delegate' => array (
'to' => 'cc_files',
),
);
} // getBehaviors()
} // CloudFileTableMap

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,8 @@
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcBlockPeer {
abstract class BaseCcBlockPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
@ -19,9 +20,6 @@ abstract class BaseCcBlockPeer {
/** the related Propel class for this table */
const OM_CLASS = 'CcBlock';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcBlock';
/** the related TableMap class for this table */
const TM_CLASS = 'CcBlockTableMap';
@ -31,32 +29,38 @@ abstract class BaseCcBlockPeer {
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_block.ID';
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 8;
/** the column name for the NAME field */
const NAME = 'cc_block.NAME';
/** the column name for the id field */
const ID = 'cc_block.id';
/** the column name for the MTIME field */
const MTIME = 'cc_block.MTIME';
/** the column name for the name field */
const NAME = 'cc_block.name';
/** the column name for the UTIME field */
const UTIME = 'cc_block.UTIME';
/** the column name for the mtime field */
const MTIME = 'cc_block.mtime';
/** the column name for the CREATOR_ID field */
const CREATOR_ID = 'cc_block.CREATOR_ID';
/** the column name for the utime field */
const UTIME = 'cc_block.utime';
/** the column name for the DESCRIPTION field */
const DESCRIPTION = 'cc_block.DESCRIPTION';
/** the column name for the creator_id field */
const CREATOR_ID = 'cc_block.creator_id';
/** the column name for the LENGTH field */
const LENGTH = 'cc_block.LENGTH';
/** the column name for the description field */
const DESCRIPTION = 'cc_block.description';
/** the column name for the TYPE field */
const TYPE = 'cc_block.TYPE';
/** the column name for the length field */
const LENGTH = 'cc_block.length';
/** the column name for the type field */
const TYPE = 'cc_block.type';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CcBlock objects.
* An identity map to hold any loaded instances of CcBlock objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcBlock[]
@ -68,12 +72,12 @@ abstract class BaseCcBlockPeer {
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
* e.g. CcBlockPeer::$fieldNames[CcBlockPeer::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMtime', 'DbUtime', 'DbCreatorId', 'DbDescription', 'DbLength', 'DbType', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMtime', 'dbUtime', 'dbCreatorId', 'dbDescription', 'dbLength', 'dbType', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::MTIME, self::UTIME, self::CREATOR_ID, self::DESCRIPTION, self::LENGTH, self::TYPE, ),
BasePeer::TYPE_COLNAME => array (CcBlockPeer::ID, CcBlockPeer::NAME, CcBlockPeer::MTIME, CcBlockPeer::UTIME, CcBlockPeer::CREATOR_ID, CcBlockPeer::DESCRIPTION, CcBlockPeer::LENGTH, CcBlockPeer::TYPE, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MTIME', 'UTIME', 'CREATOR_ID', 'DESCRIPTION', 'LENGTH', 'TYPE', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mtime', 'utime', 'creator_id', 'description', 'length', 'type', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
@ -83,12 +87,12 @@ abstract class BaseCcBlockPeer {
* 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
* e.g. CcBlockPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMtime' => 2, 'DbUtime' => 3, 'DbCreatorId' => 4, 'DbDescription' => 5, 'DbLength' => 6, 'DbType' => 7, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMtime' => 2, 'dbUtime' => 3, 'dbCreatorId' => 4, 'dbDescription' => 5, 'dbLength' => 6, 'dbType' => 7, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::MTIME => 2, self::UTIME => 3, self::CREATOR_ID => 4, self::DESCRIPTION => 5, self::LENGTH => 6, self::TYPE => 7, ),
BasePeer::TYPE_COLNAME => array (CcBlockPeer::ID => 0, CcBlockPeer::NAME => 1, CcBlockPeer::MTIME => 2, CcBlockPeer::UTIME => 3, CcBlockPeer::CREATOR_ID => 4, CcBlockPeer::DESCRIPTION => 5, CcBlockPeer::LENGTH => 6, CcBlockPeer::TYPE => 7, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MTIME' => 2, 'UTIME' => 3, 'CREATOR_ID' => 4, 'DESCRIPTION' => 5, 'LENGTH' => 6, 'TYPE' => 7, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mtime' => 2, 'utime' => 3, 'creator_id' => 4, 'description' => 5, 'length' => 6, 'type' => 7, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
@ -104,13 +108,14 @@ abstract class BaseCcBlockPeer {
* @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)
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = CcBlockPeer::getFieldNames($toType);
$key = isset(CcBlockPeer::$fieldKeys[$fromType][$name]) ? CcBlockPeer::$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));
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcBlockPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@ -121,14 +126,15 @@ abstract class BaseCcBlockPeer {
* 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
* @throws PropelException - if the type is not valid.
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
if (!array_key_exists($type, CcBlockPeer::$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];
return CcBlockPeer::$fieldNames[$type];
}
/**
@ -172,14 +178,14 @@ abstract class BaseCcBlockPeer {
$criteria->addSelectColumn(CcBlockPeer::LENGTH);
$criteria->addSelectColumn(CcBlockPeer::TYPE);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.NAME');
$criteria->addSelectColumn($alias . '.MTIME');
$criteria->addSelectColumn($alias . '.UTIME');
$criteria->addSelectColumn($alias . '.CREATOR_ID');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.LENGTH');
$criteria->addSelectColumn($alias . '.TYPE');
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.name');
$criteria->addSelectColumn($alias . '.mtime');
$criteria->addSelectColumn($alias . '.utime');
$criteria->addSelectColumn($alias . '.creator_id');
$criteria->addSelectColumn($alias . '.description');
$criteria->addSelectColumn($alias . '.length');
$criteria->addSelectColumn($alias . '.type');
}
}
@ -210,7 +216,7 @@ abstract class BaseCcBlockPeer {
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
$criteria->setDbName(CcBlockPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -224,10 +230,11 @@ abstract class BaseCcBlockPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
@ -243,10 +250,11 @@ abstract class BaseCcBlockPeer {
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
@ -261,7 +269,7 @@ abstract class BaseCcBlockPeer {
/**
* 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
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
@ -283,7 +291,7 @@ abstract class BaseCcBlockPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
@ -297,16 +305,16 @@ abstract class BaseCcBlockPeer {
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcBlock $value A CcBlock object.
* @param CcBlock $obj A CcBlock object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcBlock $obj, $key = null)
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getDbId();
} // if key === null
self::$instances[$key] = $obj;
CcBlockPeer::$instances[$key] = $obj;
}
}
@ -319,6 +327,9 @@ abstract class BaseCcBlockPeer {
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcBlock object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
@ -333,7 +344,7 @@ abstract class BaseCcBlockPeer {
throw $e;
}
unset(self::$instances[$key]);
unset(CcBlockPeer::$instances[$key]);
}
} // removeInstanceFromPool()
@ -344,16 +355,17 @@ abstract class BaseCcBlockPeer {
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return CcBlock Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @return CcBlock Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(self::$instances[$key])) {
return self::$instances[$key];
if (isset(CcBlockPeer::$instances[$key])) {
return CcBlockPeer::$instances[$key];
}
}
return null; // just to be explicit
}
@ -362,9 +374,14 @@ abstract class BaseCcBlockPeer {
*
* @return void
*/
public static function clearInstancePool()
public static function clearInstancePool($and_clear_all_references = false)
{
self::$instances = array();
if ($and_clear_all_references) {
foreach (CcBlockPeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcBlockPeer::$instances = array();
}
/**
@ -392,14 +409,15 @@ abstract class BaseCcBlockPeer {
*
* @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.
* @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 the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
@ -414,6 +432,7 @@ abstract class BaseCcBlockPeer {
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
@ -429,7 +448,7 @@ abstract class BaseCcBlockPeer {
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcBlockPeer::getOMClass(false);
$cls = CcBlockPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcBlockPeer::getPrimaryKeyHashFromRow($row, 0);
@ -446,6 +465,7 @@ abstract class BaseCcBlockPeer {
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
@ -464,16 +484,18 @@ abstract class BaseCcBlockPeer {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + CcBlockPeer::NUM_COLUMNS;
$col = $startcol + CcBlockPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CcBlockPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcBlockPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the number of rows matching criteria, joining the related CcSubjs table
*
@ -504,7 +526,7 @@ abstract class BaseCcBlockPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -520,6 +542,7 @@ abstract class BaseCcBlockPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -539,11 +562,11 @@ abstract class BaseCcBlockPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockPeer::DATABASE_NAME);
}
CcBlockPeer::addSelectColumns($criteria);
$startcol = (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol = CcBlockPeer::NUM_HYDRATE_COLUMNS;
CcSubjsPeer::addSelectColumns($criteria);
$criteria->addJoin(CcBlockPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
@ -559,7 +582,7 @@ abstract class BaseCcBlockPeer {
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcBlockPeer::getOMClass(false);
$cls = CcBlockPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -571,7 +594,7 @@ abstract class BaseCcBlockPeer {
$obj2 = CcSubjsPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcSubjsPeer::getOMClass(false);
$cls = CcSubjsPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
@ -586,6 +609,7 @@ abstract class BaseCcBlockPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -620,7 +644,7 @@ abstract class BaseCcBlockPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -636,6 +660,7 @@ abstract class BaseCcBlockPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -655,14 +680,14 @@ abstract class BaseCcBlockPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockPeer::DATABASE_NAME);
}
CcBlockPeer::addSelectColumns($criteria);
$startcol2 = (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcBlockPeer::NUM_HYDRATE_COLUMNS;
CcSubjsPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcBlockPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
@ -676,7 +701,7 @@ abstract class BaseCcBlockPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcBlockPeer::getOMClass(false);
$cls = CcBlockPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -690,7 +715,7 @@ abstract class BaseCcBlockPeer {
$obj2 = CcSubjsPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcSubjsPeer::getOMClass(false);
$cls = CcSubjsPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -704,6 +729,7 @@ abstract class BaseCcBlockPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -716,7 +742,7 @@ abstract class BaseCcBlockPeer {
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
return Propel::getDatabaseMap(CcBlockPeer::DATABASE_NAME)->getTable(CcBlockPeer::TABLE_NAME);
}
/**
@ -725,30 +751,24 @@ abstract class BaseCcBlockPeer {
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcBlockPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcBlockPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcBlockTableMap());
if (!$dbMap->hasTable(BaseCcBlockPeer::TABLE_NAME)) {
$dbMap->addTableObject(new \CcBlockTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
* @return string ClassName
*/
public static function getOMClass($withPrefix = true)
public static function getOMClass($row = 0, $colnum = 0)
{
return $withPrefix ? CcBlockPeer::CLASS_DEFAULT : CcBlockPeer::OM_CLASS;
return CcBlockPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcBlock or Criteria object.
* Performs an INSERT on the database, given a CcBlock or Criteria object.
*
* @param mixed $values Criteria or CcBlock object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
@ -774,7 +794,7 @@ abstract class BaseCcBlockPeer {
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
@ -782,7 +802,7 @@ abstract class BaseCcBlockPeer {
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -791,7 +811,7 @@ abstract class BaseCcBlockPeer {
}
/**
* Method perform an UPDATE on the database, given a CcBlock or Criteria object.
* Performs an UPDATE on the database, given a CcBlock or Criteria object.
*
* @param mixed $values Criteria or CcBlock object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
@ -805,7 +825,7 @@ abstract class BaseCcBlockPeer {
$con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
$selectCriteria = new Criteria(CcBlockPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
@ -824,17 +844,19 @@ abstract class BaseCcBlockPeer {
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_block table.
* Deletes all rows from the cc_block table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll($con = null)
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
@ -851,15 +873,16 @@ abstract class BaseCcBlockPeer {
CcBlockPeer::clearInstancePool();
CcBlockPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcBlock or Criteria object OR a primary key value.
* Performs a DELETE on the database, given a CcBlock or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcBlock object or primary key or array of primary keys
* which is used to create the DELETE statement
@ -888,7 +911,7 @@ abstract class BaseCcBlockPeer {
// 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 = new Criteria(CcBlockPeer::DATABASE_NAME);
$criteria->add(CcBlockPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
@ -897,7 +920,7 @@ abstract class BaseCcBlockPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@ -909,8 +932,9 @@ abstract class BaseCcBlockPeer {
$affectedRows += BasePeer::doDelete($criteria, $con);
CcBlockPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -928,7 +952,7 @@ abstract class BaseCcBlockPeer {
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(CcBlock $obj, $cols = null)
public static function doValidate($obj, $cols = null)
{
$columns = array();
@ -941,7 +965,7 @@ abstract class BaseCcBlockPeer {
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
@ -984,6 +1008,7 @@ abstract class BaseCcBlockPeer {
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcBlock[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
@ -1001,6 +1026,7 @@ abstract class BaseCcBlockPeer {
$criteria->add(CcBlockPeer::ID, $pks, Criteria::IN);
$objs = CcBlockPeer::doSelect($criteria, $con);
}
return $objs;
}

View File

@ -28,26 +28,25 @@
* @method CcBlockQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcBlockQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcBlockQuery leftJoinCcSubjs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjs relation
* @method CcBlockQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation
* @method CcBlockQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation
* @method CcBlockQuery leftJoinCcSubjs($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjs relation
* @method CcBlockQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation
* @method CcBlockQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs relation
*
* @method CcBlockQuery leftJoinCcPlaylistcontents($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlaylistcontents relation
* @method CcBlockQuery rightJoinCcPlaylistcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
* @method CcBlockQuery innerJoinCcPlaylistcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
* @method CcBlockQuery leftJoinCcPlaylistcontents($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlaylistcontents relation
* @method CcBlockQuery rightJoinCcPlaylistcontents($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
* @method CcBlockQuery innerJoinCcPlaylistcontents($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
*
* @method CcBlockQuery leftJoinCcBlockcontents($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlockcontents relation
* @method CcBlockQuery rightJoinCcBlockcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlockcontents relation
* @method CcBlockQuery innerJoinCcBlockcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlockcontents relation
* @method CcBlockQuery leftJoinCcBlockcontents($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcBlockcontents relation
* @method CcBlockQuery rightJoinCcBlockcontents($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcBlockcontents relation
* @method CcBlockQuery innerJoinCcBlockcontents($relationAlias = null) Adds a INNER JOIN clause to the query using the CcBlockcontents relation
*
* @method CcBlockQuery leftJoinCcBlockcriteria($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlockcriteria relation
* @method CcBlockQuery rightJoinCcBlockcriteria($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlockcriteria relation
* @method CcBlockQuery innerJoinCcBlockcriteria($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlockcriteria relation
* @method CcBlockQuery leftJoinCcBlockcriteria($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcBlockcriteria relation
* @method CcBlockQuery rightJoinCcBlockcriteria($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcBlockcriteria relation
* @method CcBlockQuery innerJoinCcBlockcriteria($relationAlias = null) Adds a INNER JOIN clause to the query using the CcBlockcriteria relation
*
* @method CcBlock findOne(PropelPDO $con = null) Return the first CcBlock matching the query
* @method CcBlock findOneOrCreate(PropelPDO $con = null) Return the first CcBlock matching the query, or a new CcBlock object populated from the query conditions when no match is found
*
* @method CcBlock findOneByDbId(int $id) Return the first CcBlock filtered by the id column
* @method CcBlock findOneByDbName(string $name) Return the first CcBlock filtered by the name column
* @method CcBlock findOneByDbMtime(string $mtime) Return the first CcBlock filtered by the mtime column
* @method CcBlock findOneByDbUtime(string $utime) Return the first CcBlock filtered by the utime column
@ -69,7 +68,6 @@
*/
abstract class BaseCcBlockQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcBlockQuery object.
*
@ -77,8 +75,14 @@ abstract class BaseCcBlockQuery extends ModelCriteria
* @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 = 'CcBlock', $modelAlias = null)
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'airtime';
}
if (null === $modelName) {
$modelName = 'CcBlock';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
@ -86,7 +90,7 @@ abstract class BaseCcBlockQuery extends ModelCriteria
* Returns a new CcBlockQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
* @param CcBlockQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CcBlockQuery
*/
@ -95,41 +99,115 @@ abstract class BaseCcBlockQuery extends ModelCriteria
if ($criteria instanceof CcBlockQuery) {
return $criteria;
}
$query = new CcBlockQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
$query = new CcBlockQuery(null, null, $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
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <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 CcBlock|array|mixed the result, formatted by the current formatter
* @return CcBlock|CcBlock[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcBlockPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
if ($key === null) {
return null;
}
if ((null !== ($obj = CcBlockPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
// the object has not been requested yet, or the formatter is not an object formatter
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcBlock A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneByDbId($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcBlock A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "id", "name", "mtime", "utime", "creator_id", "description", "length", "type" FROM "cc_block" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CcBlock();
$obj->hydrate($row);
CcBlockPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcBlock|CcBlock[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
@ -139,14 +217,20 @@ abstract class BaseCcBlockQuery extends ModelCriteria
* @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
* @return PropelObjectCollection|CcBlock[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
$stmt = $criteria
->filterByPrimaryKeys($keys)
->find($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
@ -158,6 +242,7 @@ abstract class BaseCcBlockQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcBlockPeer::ID, $key, Criteria::EQUAL);
}
@ -170,29 +255,61 @@ abstract class BaseCcBlockQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcBlockPeer::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* @param int|array $dbId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbId(1234); // WHERE id = 1234
* $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
* $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
* </code>
*
* @param mixed $dbId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockQuery The current query, for fluid interface
*/
public function filterByDbId($dbId = null, $comparison = null)
{
if (is_array($dbId) && null === $comparison) {
if (is_array($dbId)) {
$useMinMax = false;
if (isset($dbId['min'])) {
$this->addUsingAlias(CcBlockPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbId['max'])) {
$this->addUsingAlias(CcBlockPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcBlockPeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the name column
*
* Example usage:
* <code>
* $query->filterByDbName('fooValue'); // WHERE name = 'fooValue'
* $query->filterByDbName('%fooValue%'); // WHERE name LIKE '%fooValue%'
* </code>
*
* @param string $dbName The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -209,14 +326,26 @@ abstract class BaseCcBlockQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcBlockPeer::NAME, $dbName, $comparison);
}
/**
* Filter the query on the mtime column
*
* @param string|array $dbMtime The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbMtime('2011-03-14'); // WHERE mtime = '2011-03-14'
* $query->filterByDbMtime('now'); // WHERE mtime = '2011-03-14'
* $query->filterByDbMtime(array('max' => 'yesterday')); // WHERE mtime < '2011-03-13'
* </code>
*
* @param mixed $dbMtime The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockQuery The current query, for fluid interface
@ -240,14 +369,26 @@ abstract class BaseCcBlockQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcBlockPeer::MTIME, $dbMtime, $comparison);
}
/**
* Filter the query on the utime column
*
* @param string|array $dbUtime The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbUtime('2011-03-14'); // WHERE utime = '2011-03-14'
* $query->filterByDbUtime('now'); // WHERE utime = '2011-03-14'
* $query->filterByDbUtime(array('max' => 'yesterday')); // WHERE utime < '2011-03-13'
* </code>
*
* @param mixed $dbUtime The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockQuery The current query, for fluid interface
@ -271,14 +412,27 @@ abstract class BaseCcBlockQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcBlockPeer::UTIME, $dbUtime, $comparison);
}
/**
* Filter the query on the creator_id column
*
* @param int|array $dbCreatorId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbCreatorId(1234); // WHERE creator_id = 1234
* $query->filterByDbCreatorId(array(12, 34)); // WHERE creator_id IN (12, 34)
* $query->filterByDbCreatorId(array('min' => 12)); // WHERE creator_id >= 12
* $query->filterByDbCreatorId(array('max' => 12)); // WHERE creator_id <= 12
* </code>
*
* @see filterByCcSubjs()
*
* @param mixed $dbCreatorId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockQuery The current query, for fluid interface
@ -302,12 +456,19 @@ abstract class BaseCcBlockQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcBlockPeer::CREATOR_ID, $dbCreatorId, $comparison);
}
/**
* Filter the query on the description column
*
* Example usage:
* <code>
* $query->filterByDbDescription('fooValue'); // WHERE description = 'fooValue'
* $query->filterByDbDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
* </code>
*
* @param string $dbDescription The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -324,12 +485,19 @@ abstract class BaseCcBlockQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcBlockPeer::DESCRIPTION, $dbDescription, $comparison);
}
/**
* Filter the query on the length column
*
* Example usage:
* <code>
* $query->filterByDbLength('fooValue'); // WHERE length = 'fooValue'
* $query->filterByDbLength('%fooValue%'); // WHERE length LIKE '%fooValue%'
* </code>
*
* @param string $dbLength The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -346,12 +514,19 @@ abstract class BaseCcBlockQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcBlockPeer::LENGTH, $dbLength, $comparison);
}
/**
* Filter the query on the type column
*
* Example usage:
* <code>
* $query->filterByDbType('fooValue'); // WHERE type = 'fooValue'
* $query->filterByDbType('%fooValue%'); // WHERE type LIKE '%fooValue%'
* </code>
*
* @param string $dbType The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -368,21 +543,34 @@ abstract class BaseCcBlockQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcBlockPeer::TYPE, $dbType, $comparison);
}
/**
* Filter the query by a related CcSubjs object
*
* @param CcSubjs $ccSubjs the related object to use as filter
* @param CcSubjs|PropelObjectCollection $ccSubjs The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcSubjs($ccSubjs, $comparison = null)
{
if ($ccSubjs instanceof CcSubjs) {
return $this
->addUsingAlias(CcBlockPeer::CREATOR_ID, $ccSubjs->getDbId(), $comparison);
} elseif ($ccSubjs instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CcBlockPeer::CREATOR_ID, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison);
} else {
throw new PropelException('filterByCcSubjs() only accepts arguments of type CcSubjs or PropelCollection');
}
}
/**
@ -393,7 +581,7 @@ abstract class BaseCcBlockQuery extends ModelCriteria
*
* @return CcBlockQuery The current query, for fluid interface
*/
public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function joinCcSubjs($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcSubjs');
@ -428,7 +616,7 @@ abstract class BaseCcBlockQuery extends ModelCriteria
*
* @return CcSubjsQuery A secondary query class using the current class as primary query
*/
public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function useCcSubjsQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcSubjs($relationAlias, $joinType)
@ -438,15 +626,25 @@ abstract class BaseCcBlockQuery extends ModelCriteria
/**
* Filter the query by a related CcPlaylistcontents object
*
* @param CcPlaylistcontents $ccPlaylistcontents the related object to use as filter
* @param CcPlaylistcontents|PropelObjectCollection $ccPlaylistcontents the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcPlaylistcontents($ccPlaylistcontents, $comparison = null)
{
if ($ccPlaylistcontents instanceof CcPlaylistcontents) {
return $this
->addUsingAlias(CcBlockPeer::ID, $ccPlaylistcontents->getDbBlockId(), $comparison);
} elseif ($ccPlaylistcontents instanceof PropelObjectCollection) {
return $this
->useCcPlaylistcontentsQuery()
->filterByPrimaryKeys($ccPlaylistcontents->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCcPlaylistcontents() only accepts arguments of type CcPlaylistcontents or PropelCollection');
}
}
/**
@ -457,7 +655,7 @@ abstract class BaseCcBlockQuery extends ModelCriteria
*
* @return CcBlockQuery The current query, for fluid interface
*/
public function joinCcPlaylistcontents($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function joinCcPlaylistcontents($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcPlaylistcontents');
@ -492,7 +690,7 @@ abstract class BaseCcBlockQuery extends ModelCriteria
*
* @return CcPlaylistcontentsQuery A secondary query class using the current class as primary query
*/
public function useCcPlaylistcontentsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function useCcPlaylistcontentsQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcPlaylistcontents($relationAlias, $joinType)
@ -502,15 +700,25 @@ abstract class BaseCcBlockQuery extends ModelCriteria
/**
* Filter the query by a related CcBlockcontents object
*
* @param CcBlockcontents $ccBlockcontents the related object to use as filter
* @param CcBlockcontents|PropelObjectCollection $ccBlockcontents the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcBlockcontents($ccBlockcontents, $comparison = null)
{
if ($ccBlockcontents instanceof CcBlockcontents) {
return $this
->addUsingAlias(CcBlockPeer::ID, $ccBlockcontents->getDbBlockId(), $comparison);
} elseif ($ccBlockcontents instanceof PropelObjectCollection) {
return $this
->useCcBlockcontentsQuery()
->filterByPrimaryKeys($ccBlockcontents->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCcBlockcontents() only accepts arguments of type CcBlockcontents or PropelCollection');
}
}
/**
@ -521,7 +729,7 @@ abstract class BaseCcBlockQuery extends ModelCriteria
*
* @return CcBlockQuery The current query, for fluid interface
*/
public function joinCcBlockcontents($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function joinCcBlockcontents($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcBlockcontents');
@ -556,7 +764,7 @@ abstract class BaseCcBlockQuery extends ModelCriteria
*
* @return CcBlockcontentsQuery A secondary query class using the current class as primary query
*/
public function useCcBlockcontentsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function useCcBlockcontentsQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcBlockcontents($relationAlias, $joinType)
@ -566,15 +774,25 @@ abstract class BaseCcBlockQuery extends ModelCriteria
/**
* Filter the query by a related CcBlockcriteria object
*
* @param CcBlockcriteria $ccBlockcriteria the related object to use as filter
* @param CcBlockcriteria|PropelObjectCollection $ccBlockcriteria the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcBlockcriteria($ccBlockcriteria, $comparison = null)
{
if ($ccBlockcriteria instanceof CcBlockcriteria) {
return $this
->addUsingAlias(CcBlockPeer::ID, $ccBlockcriteria->getDbBlockId(), $comparison);
} elseif ($ccBlockcriteria instanceof PropelObjectCollection) {
return $this
->useCcBlockcriteriaQuery()
->filterByPrimaryKeys($ccBlockcriteria->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCcBlockcriteria() only accepts arguments of type CcBlockcriteria or PropelCollection');
}
}
/**
@ -585,7 +803,7 @@ abstract class BaseCcBlockQuery extends ModelCriteria
*
* @return CcBlockQuery The current query, for fluid interface
*/
public function joinCcBlockcriteria($relationAlias = '', $joinType = Criteria::INNER_JOIN)
public function joinCcBlockcriteria($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcBlockcriteria');
@ -620,7 +838,7 @@ abstract class BaseCcBlockQuery extends ModelCriteria
*
* @return CcBlockcriteriaQuery A secondary query class using the current class as primary query
*/
public function useCcBlockcriteriaQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
public function useCcBlockcriteriaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcBlockcriteria($relationAlias, $joinType)
@ -643,4 +861,4 @@ abstract class BaseCcBlockQuery extends ModelCriteria
return $this;
}
} // BaseCcBlockQuery
}

View File

@ -8,7 +8,8 @@
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcBlockcontentsPeer {
abstract class BaseCcBlockcontentsPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
@ -19,9 +20,6 @@ abstract class BaseCcBlockcontentsPeer {
/** the related Propel class for this table */
const OM_CLASS = 'CcBlockcontents';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcBlockcontents';
/** the related TableMap class for this table */
const TM_CLASS = 'CcBlockcontentsTableMap';
@ -31,38 +29,44 @@ abstract class BaseCcBlockcontentsPeer {
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_blockcontents.ID';
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 10;
/** the column name for the BLOCK_ID field */
const BLOCK_ID = 'cc_blockcontents.BLOCK_ID';
/** the column name for the id field */
const ID = 'cc_blockcontents.id';
/** the column name for the FILE_ID field */
const FILE_ID = 'cc_blockcontents.FILE_ID';
/** the column name for the block_id field */
const BLOCK_ID = 'cc_blockcontents.block_id';
/** the column name for the POSITION field */
const POSITION = 'cc_blockcontents.POSITION';
/** the column name for the file_id field */
const FILE_ID = 'cc_blockcontents.file_id';
/** the column name for the TRACKOFFSET field */
const TRACKOFFSET = 'cc_blockcontents.TRACKOFFSET';
/** the column name for the position field */
const POSITION = 'cc_blockcontents.position';
/** the column name for the CLIPLENGTH field */
const CLIPLENGTH = 'cc_blockcontents.CLIPLENGTH';
/** the column name for the trackoffset field */
const TRACKOFFSET = 'cc_blockcontents.trackoffset';
/** the column name for the CUEIN field */
const CUEIN = 'cc_blockcontents.CUEIN';
/** the column name for the cliplength field */
const CLIPLENGTH = 'cc_blockcontents.cliplength';
/** the column name for the CUEOUT field */
const CUEOUT = 'cc_blockcontents.CUEOUT';
/** the column name for the cuein field */
const CUEIN = 'cc_blockcontents.cuein';
/** the column name for the FADEIN field */
const FADEIN = 'cc_blockcontents.FADEIN';
/** the column name for the cueout field */
const CUEOUT = 'cc_blockcontents.cueout';
/** the column name for the FADEOUT field */
const FADEOUT = 'cc_blockcontents.FADEOUT';
/** the column name for the fadein field */
const FADEIN = 'cc_blockcontents.fadein';
/** the column name for the fadeout field */
const FADEOUT = 'cc_blockcontents.fadeout';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CcBlockcontents objects.
* An identity map to hold any loaded instances of CcBlockcontents objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcBlockcontents[]
@ -74,12 +78,12 @@ abstract class BaseCcBlockcontentsPeer {
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
* e.g. CcBlockcontentsPeer::$fieldNames[CcBlockcontentsPeer::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbBlockId', 'DbFileId', 'DbPosition', 'DbTrackOffset', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbBlockId', 'dbFileId', 'dbPosition', 'dbTrackOffset', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::BLOCK_ID, self::FILE_ID, self::POSITION, self::TRACKOFFSET, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ),
BasePeer::TYPE_COLNAME => array (CcBlockcontentsPeer::ID, CcBlockcontentsPeer::BLOCK_ID, CcBlockcontentsPeer::FILE_ID, CcBlockcontentsPeer::POSITION, CcBlockcontentsPeer::TRACKOFFSET, CcBlockcontentsPeer::CLIPLENGTH, CcBlockcontentsPeer::CUEIN, CcBlockcontentsPeer::CUEOUT, CcBlockcontentsPeer::FADEIN, CcBlockcontentsPeer::FADEOUT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'BLOCK_ID', 'FILE_ID', 'POSITION', 'TRACKOFFSET', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'block_id', 'file_id', 'position', 'trackoffset', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
@ -89,12 +93,12 @@ abstract class BaseCcBlockcontentsPeer {
* 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
* e.g. CcBlockcontentsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbBlockId' => 1, 'DbFileId' => 2, 'DbPosition' => 3, 'DbTrackOffset' => 4, 'DbCliplength' => 5, 'DbCuein' => 6, 'DbCueout' => 7, 'DbFadein' => 8, 'DbFadeout' => 9, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbBlockId' => 1, 'dbFileId' => 2, 'dbPosition' => 3, 'dbTrackOffset' => 4, 'dbCliplength' => 5, 'dbCuein' => 6, 'dbCueout' => 7, 'dbFadein' => 8, 'dbFadeout' => 9, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::BLOCK_ID => 1, self::FILE_ID => 2, self::POSITION => 3, self::TRACKOFFSET => 4, self::CLIPLENGTH => 5, self::CUEIN => 6, self::CUEOUT => 7, self::FADEIN => 8, self::FADEOUT => 9, ),
BasePeer::TYPE_COLNAME => array (CcBlockcontentsPeer::ID => 0, CcBlockcontentsPeer::BLOCK_ID => 1, CcBlockcontentsPeer::FILE_ID => 2, CcBlockcontentsPeer::POSITION => 3, CcBlockcontentsPeer::TRACKOFFSET => 4, CcBlockcontentsPeer::CLIPLENGTH => 5, CcBlockcontentsPeer::CUEIN => 6, CcBlockcontentsPeer::CUEOUT => 7, CcBlockcontentsPeer::FADEIN => 8, CcBlockcontentsPeer::FADEOUT => 9, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'BLOCK_ID' => 1, 'FILE_ID' => 2, 'POSITION' => 3, 'TRACKOFFSET' => 4, 'CLIPLENGTH' => 5, 'CUEIN' => 6, 'CUEOUT' => 7, 'FADEIN' => 8, 'FADEOUT' => 9, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'block_id' => 1, 'file_id' => 2, 'position' => 3, 'trackoffset' => 4, 'cliplength' => 5, 'cuein' => 6, 'cueout' => 7, 'fadein' => 8, 'fadeout' => 9, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
@ -110,13 +114,14 @@ abstract class BaseCcBlockcontentsPeer {
* @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)
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = CcBlockcontentsPeer::getFieldNames($toType);
$key = isset(CcBlockcontentsPeer::$fieldKeys[$fromType][$name]) ? CcBlockcontentsPeer::$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));
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcBlockcontentsPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@ -127,14 +132,15 @@ abstract class BaseCcBlockcontentsPeer {
* 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
* @throws PropelException - if the type is not valid.
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
if (!array_key_exists($type, CcBlockcontentsPeer::$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];
return CcBlockcontentsPeer::$fieldNames[$type];
}
/**
@ -180,16 +186,16 @@ abstract class BaseCcBlockcontentsPeer {
$criteria->addSelectColumn(CcBlockcontentsPeer::FADEIN);
$criteria->addSelectColumn(CcBlockcontentsPeer::FADEOUT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.BLOCK_ID');
$criteria->addSelectColumn($alias . '.FILE_ID');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.TRACKOFFSET');
$criteria->addSelectColumn($alias . '.CLIPLENGTH');
$criteria->addSelectColumn($alias . '.CUEIN');
$criteria->addSelectColumn($alias . '.CUEOUT');
$criteria->addSelectColumn($alias . '.FADEIN');
$criteria->addSelectColumn($alias . '.FADEOUT');
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.block_id');
$criteria->addSelectColumn($alias . '.file_id');
$criteria->addSelectColumn($alias . '.position');
$criteria->addSelectColumn($alias . '.trackoffset');
$criteria->addSelectColumn($alias . '.cliplength');
$criteria->addSelectColumn($alias . '.cuein');
$criteria->addSelectColumn($alias . '.cueout');
$criteria->addSelectColumn($alias . '.fadein');
$criteria->addSelectColumn($alias . '.fadeout');
}
}
@ -220,7 +226,7 @@ abstract class BaseCcBlockcontentsPeer {
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -234,10 +240,11 @@ abstract class BaseCcBlockcontentsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
@ -253,10 +260,11 @@ abstract class BaseCcBlockcontentsPeer {
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
@ -271,7 +279,7 @@ abstract class BaseCcBlockcontentsPeer {
/**
* 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
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
@ -293,7 +301,7 @@ abstract class BaseCcBlockcontentsPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
@ -307,16 +315,16 @@ abstract class BaseCcBlockcontentsPeer {
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcBlockcontents $value A CcBlockcontents object.
* @param CcBlockcontents $obj A CcBlockcontents object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcBlockcontents $obj, $key = null)
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getDbId();
} // if key === null
self::$instances[$key] = $obj;
CcBlockcontentsPeer::$instances[$key] = $obj;
}
}
@ -329,6 +337,9 @@ abstract class BaseCcBlockcontentsPeer {
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcBlockcontents object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
@ -343,7 +354,7 @@ abstract class BaseCcBlockcontentsPeer {
throw $e;
}
unset(self::$instances[$key]);
unset(CcBlockcontentsPeer::$instances[$key]);
}
} // removeInstanceFromPool()
@ -354,16 +365,17 @@ abstract class BaseCcBlockcontentsPeer {
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return CcBlockcontents Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @return CcBlockcontents Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(self::$instances[$key])) {
return self::$instances[$key];
if (isset(CcBlockcontentsPeer::$instances[$key])) {
return CcBlockcontentsPeer::$instances[$key];
}
}
return null; // just to be explicit
}
@ -372,9 +384,14 @@ abstract class BaseCcBlockcontentsPeer {
*
* @return void
*/
public static function clearInstancePool()
public static function clearInstancePool($and_clear_all_references = false)
{
self::$instances = array();
if ($and_clear_all_references) {
foreach (CcBlockcontentsPeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcBlockcontentsPeer::$instances = array();
}
/**
@ -393,14 +410,15 @@ abstract class BaseCcBlockcontentsPeer {
*
* @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.
* @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 the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
@ -415,6 +433,7 @@ abstract class BaseCcBlockcontentsPeer {
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
@ -430,7 +449,7 @@ abstract class BaseCcBlockcontentsPeer {
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcBlockcontentsPeer::getOMClass(false);
$cls = CcBlockcontentsPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
@ -447,6 +466,7 @@ abstract class BaseCcBlockcontentsPeer {
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
@ -465,16 +485,18 @@ abstract class BaseCcBlockcontentsPeer {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + CcBlockcontentsPeer::NUM_COLUMNS;
$col = $startcol + CcBlockcontentsPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CcBlockcontentsPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcBlockcontentsPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the number of rows matching criteria, joining the related CcFiles table
*
@ -505,7 +527,7 @@ abstract class BaseCcBlockcontentsPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -521,6 +543,7 @@ abstract class BaseCcBlockcontentsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -555,7 +578,7 @@ abstract class BaseCcBlockcontentsPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -571,6 +594,7 @@ abstract class BaseCcBlockcontentsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -590,11 +614,11 @@ abstract class BaseCcBlockcontentsPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
}
CcBlockcontentsPeer::addSelectColumns($criteria);
$startcol = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol = CcBlockcontentsPeer::NUM_HYDRATE_COLUMNS;
CcFilesPeer::addSelectColumns($criteria);
$criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
@ -610,7 +634,7 @@ abstract class BaseCcBlockcontentsPeer {
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcBlockcontentsPeer::getOMClass(false);
$cls = CcBlockcontentsPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -622,7 +646,7 @@ abstract class BaseCcBlockcontentsPeer {
$obj2 = CcFilesPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcFilesPeer::getOMClass(false);
$cls = CcFilesPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
@ -637,6 +661,7 @@ abstract class BaseCcBlockcontentsPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -656,11 +681,11 @@ abstract class BaseCcBlockcontentsPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
}
CcBlockcontentsPeer::addSelectColumns($criteria);
$startcol = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol = CcBlockcontentsPeer::NUM_HYDRATE_COLUMNS;
CcBlockPeer::addSelectColumns($criteria);
$criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
@ -676,7 +701,7 @@ abstract class BaseCcBlockcontentsPeer {
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcBlockcontentsPeer::getOMClass(false);
$cls = CcBlockcontentsPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -688,7 +713,7 @@ abstract class BaseCcBlockcontentsPeer {
$obj2 = CcBlockPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcBlockPeer::getOMClass(false);
$cls = CcBlockPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
@ -703,6 +728,7 @@ abstract class BaseCcBlockcontentsPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -737,7 +763,7 @@ abstract class BaseCcBlockcontentsPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -755,6 +781,7 @@ abstract class BaseCcBlockcontentsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -774,17 +801,17 @@ abstract class BaseCcBlockcontentsPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
}
CcBlockcontentsPeer::addSelectColumns($criteria);
$startcol2 = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcBlockcontentsPeer::NUM_HYDRATE_COLUMNS;
CcFilesPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
CcBlockPeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol4 = $startcol3 + CcBlockPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
@ -800,7 +827,7 @@ abstract class BaseCcBlockcontentsPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcBlockcontentsPeer::getOMClass(false);
$cls = CcBlockcontentsPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -814,7 +841,7 @@ abstract class BaseCcBlockcontentsPeer {
$obj2 = CcFilesPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcFilesPeer::getOMClass(false);
$cls = CcFilesPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -832,7 +859,7 @@ abstract class BaseCcBlockcontentsPeer {
$obj3 = CcBlockPeer::getInstanceFromPool($key3);
if (!$obj3) {
$cls = CcBlockPeer::getOMClass(false);
$cls = CcBlockPeer::getOMClass();
$obj3 = new $cls();
$obj3->hydrate($row, $startcol3);
@ -846,6 +873,7 @@ abstract class BaseCcBlockcontentsPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -880,7 +908,7 @@ abstract class BaseCcBlockcontentsPeer {
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -896,6 +924,7 @@ abstract class BaseCcBlockcontentsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -930,7 +959,7 @@ abstract class BaseCcBlockcontentsPeer {
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -946,6 +975,7 @@ abstract class BaseCcBlockcontentsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -968,14 +998,14 @@ abstract class BaseCcBlockcontentsPeer {
// $criteria->getDbName() will return the same object if not set to another value
// so == check is okay and faster
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
}
CcBlockcontentsPeer::addSelectColumns($criteria);
$startcol2 = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcBlockcontentsPeer::NUM_HYDRATE_COLUMNS;
CcBlockPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcBlockPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
@ -990,7 +1020,7 @@ abstract class BaseCcBlockcontentsPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcBlockcontentsPeer::getOMClass(false);
$cls = CcBlockcontentsPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -1004,7 +1034,7 @@ abstract class BaseCcBlockcontentsPeer {
$obj2 = CcBlockPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcBlockPeer::getOMClass(false);
$cls = CcBlockPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -1019,6 +1049,7 @@ abstract class BaseCcBlockcontentsPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -1041,14 +1072,14 @@ abstract class BaseCcBlockcontentsPeer {
// $criteria->getDbName() will return the same object if not set to another value
// so == check is okay and faster
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
}
CcBlockcontentsPeer::addSelectColumns($criteria);
$startcol2 = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcBlockcontentsPeer::NUM_HYDRATE_COLUMNS;
CcFilesPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
@ -1063,7 +1094,7 @@ abstract class BaseCcBlockcontentsPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcBlockcontentsPeer::getOMClass(false);
$cls = CcBlockcontentsPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -1077,7 +1108,7 @@ abstract class BaseCcBlockcontentsPeer {
$obj2 = CcFilesPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcFilesPeer::getOMClass(false);
$cls = CcFilesPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -1092,6 +1123,7 @@ abstract class BaseCcBlockcontentsPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -1104,7 +1136,7 @@ abstract class BaseCcBlockcontentsPeer {
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
return Propel::getDatabaseMap(CcBlockcontentsPeer::DATABASE_NAME)->getTable(CcBlockcontentsPeer::TABLE_NAME);
}
/**
@ -1113,30 +1145,24 @@ abstract class BaseCcBlockcontentsPeer {
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcBlockcontentsPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcBlockcontentsPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcBlockcontentsTableMap());
if (!$dbMap->hasTable(BaseCcBlockcontentsPeer::TABLE_NAME)) {
$dbMap->addTableObject(new \CcBlockcontentsTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
* @return string ClassName
*/
public static function getOMClass($withPrefix = true)
public static function getOMClass($row = 0, $colnum = 0)
{
return $withPrefix ? CcBlockcontentsPeer::CLASS_DEFAULT : CcBlockcontentsPeer::OM_CLASS;
return CcBlockcontentsPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcBlockcontents or Criteria object.
* Performs an INSERT on the database, given a CcBlockcontents or Criteria object.
*
* @param mixed $values Criteria or CcBlockcontents object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
@ -1162,7 +1188,7 @@ abstract class BaseCcBlockcontentsPeer {
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
@ -1170,7 +1196,7 @@ abstract class BaseCcBlockcontentsPeer {
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -1179,7 +1205,7 @@ abstract class BaseCcBlockcontentsPeer {
}
/**
* Method perform an UPDATE on the database, given a CcBlockcontents or Criteria object.
* Performs an UPDATE on the database, given a CcBlockcontents or Criteria object.
*
* @param mixed $values Criteria or CcBlockcontents object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
@ -1193,7 +1219,7 @@ abstract class BaseCcBlockcontentsPeer {
$con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
$selectCriteria = new Criteria(CcBlockcontentsPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
@ -1212,17 +1238,19 @@ abstract class BaseCcBlockcontentsPeer {
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_blockcontents table.
* Deletes all rows from the cc_blockcontents table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll($con = null)
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
@ -1239,15 +1267,16 @@ abstract class BaseCcBlockcontentsPeer {
CcBlockcontentsPeer::clearInstancePool();
CcBlockcontentsPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcBlockcontents or Criteria object OR a primary key value.
* Performs a DELETE on the database, given a CcBlockcontents or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcBlockcontents object or primary key or array of primary keys
* which is used to create the DELETE statement
@ -1276,7 +1305,7 @@ abstract class BaseCcBlockcontentsPeer {
// 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 = new Criteria(CcBlockcontentsPeer::DATABASE_NAME);
$criteria->add(CcBlockcontentsPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
@ -1285,7 +1314,7 @@ abstract class BaseCcBlockcontentsPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@ -1297,8 +1326,9 @@ abstract class BaseCcBlockcontentsPeer {
$affectedRows += BasePeer::doDelete($criteria, $con);
CcBlockcontentsPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -1316,7 +1346,7 @@ abstract class BaseCcBlockcontentsPeer {
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(CcBlockcontents $obj, $cols = null)
public static function doValidate($obj, $cols = null)
{
$columns = array();
@ -1329,7 +1359,7 @@ abstract class BaseCcBlockcontentsPeer {
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
@ -1372,6 +1402,7 @@ abstract class BaseCcBlockcontentsPeer {
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcBlockcontents[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
@ -1389,6 +1420,7 @@ abstract class BaseCcBlockcontentsPeer {
$criteria->add(CcBlockcontentsPeer::ID, $pks, Criteria::IN);
$objs = CcBlockcontentsPeer::doSelect($criteria, $con);
}
return $objs;
}

View File

@ -32,18 +32,17 @@
* @method CcBlockcontentsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcBlockcontentsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcBlockcontentsQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation
* @method CcBlockcontentsQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
* @method CcBlockcontentsQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
* @method CcBlockcontentsQuery leftJoinCcFiles($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcFiles relation
* @method CcBlockcontentsQuery rightJoinCcFiles($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcFiles relation
* @method CcBlockcontentsQuery innerJoinCcFiles($relationAlias = null) Adds a INNER JOIN clause to the query using the CcFiles relation
*
* @method CcBlockcontentsQuery leftJoinCcBlock($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlock relation
* @method CcBlockcontentsQuery rightJoinCcBlock($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlock relation
* @method CcBlockcontentsQuery innerJoinCcBlock($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlock relation
* @method CcBlockcontentsQuery leftJoinCcBlock($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcBlock relation
* @method CcBlockcontentsQuery rightJoinCcBlock($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcBlock relation
* @method CcBlockcontentsQuery innerJoinCcBlock($relationAlias = null) Adds a INNER JOIN clause to the query using the CcBlock relation
*
* @method CcBlockcontents findOne(PropelPDO $con = null) Return the first CcBlockcontents matching the query
* @method CcBlockcontents findOneOrCreate(PropelPDO $con = null) Return the first CcBlockcontents matching the query, or a new CcBlockcontents object populated from the query conditions when no match is found
*
* @method CcBlockcontents findOneByDbId(int $id) Return the first CcBlockcontents filtered by the id column
* @method CcBlockcontents findOneByDbBlockId(int $block_id) Return the first CcBlockcontents filtered by the block_id column
* @method CcBlockcontents findOneByDbFileId(int $file_id) Return the first CcBlockcontents filtered by the file_id column
* @method CcBlockcontents findOneByDbPosition(int $position) Return the first CcBlockcontents filtered by the position column
@ -69,7 +68,6 @@
*/
abstract class BaseCcBlockcontentsQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcBlockcontentsQuery object.
*
@ -77,8 +75,14 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
* @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 = 'CcBlockcontents', $modelAlias = null)
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'airtime';
}
if (null === $modelName) {
$modelName = 'CcBlockcontents';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
@ -86,7 +90,7 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
* Returns a new CcBlockcontentsQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
* @param CcBlockcontentsQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CcBlockcontentsQuery
*/
@ -95,41 +99,115 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
if ($criteria instanceof CcBlockcontentsQuery) {
return $criteria;
}
$query = new CcBlockcontentsQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
$query = new CcBlockcontentsQuery(null, null, $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
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <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 CcBlockcontents|array|mixed the result, formatted by the current formatter
* @return CcBlockcontents|CcBlockcontents[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcBlockcontentsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
if ($key === null) {
return null;
}
if ((null !== ($obj = CcBlockcontentsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
// the object has not been requested yet, or the formatter is not an object formatter
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcBlockcontents A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneByDbId($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcBlockcontents A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "id", "block_id", "file_id", "position", "trackoffset", "cliplength", "cuein", "cueout", "fadein", "fadeout" FROM "cc_blockcontents" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CcBlockcontents();
$obj->hydrate($row);
CcBlockcontentsPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcBlockcontents|CcBlockcontents[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
@ -139,14 +217,20 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
* @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
* @return PropelObjectCollection|CcBlockcontents[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
$stmt = $criteria
->filterByPrimaryKeys($keys)
->find($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
@ -158,6 +242,7 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcBlockcontentsPeer::ID, $key, Criteria::EQUAL);
}
@ -170,31 +255,69 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcBlockcontentsPeer::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* @param int|array $dbId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbId(1234); // WHERE id = 1234
* $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
* $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
* </code>
*
* @param mixed $dbId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockcontentsQuery The current query, for fluid interface
*/
public function filterByDbId($dbId = null, $comparison = null)
{
if (is_array($dbId) && null === $comparison) {
if (is_array($dbId)) {
$useMinMax = false;
if (isset($dbId['min'])) {
$this->addUsingAlias(CcBlockcontentsPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbId['max'])) {
$this->addUsingAlias(CcBlockcontentsPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcBlockcontentsPeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the block_id column
*
* @param int|array $dbBlockId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbBlockId(1234); // WHERE block_id = 1234
* $query->filterByDbBlockId(array(12, 34)); // WHERE block_id IN (12, 34)
* $query->filterByDbBlockId(array('min' => 12)); // WHERE block_id >= 12
* $query->filterByDbBlockId(array('max' => 12)); // WHERE block_id <= 12
* </code>
*
* @see filterByCcBlock()
*
* @param mixed $dbBlockId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockcontentsQuery The current query, for fluid interface
@ -218,14 +341,27 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $dbBlockId, $comparison);
}
/**
* Filter the query on the file_id column
*
* @param int|array $dbFileId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbFileId(1234); // WHERE file_id = 1234
* $query->filterByDbFileId(array(12, 34)); // WHERE file_id IN (12, 34)
* $query->filterByDbFileId(array('min' => 12)); // WHERE file_id >= 12
* $query->filterByDbFileId(array('max' => 12)); // WHERE file_id <= 12
* </code>
*
* @see filterByCcFiles()
*
* @param mixed $dbFileId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockcontentsQuery The current query, for fluid interface
@ -249,14 +385,25 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcBlockcontentsPeer::FILE_ID, $dbFileId, $comparison);
}
/**
* Filter the query on the position column
*
* @param int|array $dbPosition The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbPosition(1234); // WHERE position = 1234
* $query->filterByDbPosition(array(12, 34)); // WHERE position IN (12, 34)
* $query->filterByDbPosition(array('min' => 12)); // WHERE position >= 12
* $query->filterByDbPosition(array('max' => 12)); // WHERE position <= 12
* </code>
*
* @param mixed $dbPosition The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockcontentsQuery The current query, for fluid interface
@ -280,14 +427,25 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcBlockcontentsPeer::POSITION, $dbPosition, $comparison);
}
/**
* Filter the query on the trackoffset column
*
* @param double|array $dbTrackOffset The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbTrackOffset(1234); // WHERE trackoffset = 1234
* $query->filterByDbTrackOffset(array(12, 34)); // WHERE trackoffset IN (12, 34)
* $query->filterByDbTrackOffset(array('min' => 12)); // WHERE trackoffset >= 12
* $query->filterByDbTrackOffset(array('max' => 12)); // WHERE trackoffset <= 12
* </code>
*
* @param mixed $dbTrackOffset The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockcontentsQuery The current query, for fluid interface
@ -311,12 +469,19 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcBlockcontentsPeer::TRACKOFFSET, $dbTrackOffset, $comparison);
}
/**
* Filter the query on the cliplength column
*
* Example usage:
* <code>
* $query->filterByDbCliplength('fooValue'); // WHERE cliplength = 'fooValue'
* $query->filterByDbCliplength('%fooValue%'); // WHERE cliplength LIKE '%fooValue%'
* </code>
*
* @param string $dbCliplength The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -333,12 +498,19 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcBlockcontentsPeer::CLIPLENGTH, $dbCliplength, $comparison);
}
/**
* Filter the query on the cuein column
*
* Example usage:
* <code>
* $query->filterByDbCuein('fooValue'); // WHERE cuein = 'fooValue'
* $query->filterByDbCuein('%fooValue%'); // WHERE cuein LIKE '%fooValue%'
* </code>
*
* @param string $dbCuein The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -355,12 +527,19 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcBlockcontentsPeer::CUEIN, $dbCuein, $comparison);
}
/**
* Filter the query on the cueout column
*
* Example usage:
* <code>
* $query->filterByDbCueout('fooValue'); // WHERE cueout = 'fooValue'
* $query->filterByDbCueout('%fooValue%'); // WHERE cueout LIKE '%fooValue%'
* </code>
*
* @param string $dbCueout The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -377,14 +556,26 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcBlockcontentsPeer::CUEOUT, $dbCueout, $comparison);
}
/**
* Filter the query on the fadein column
*
* @param string|array $dbFadein The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbFadein('2011-03-14'); // WHERE fadein = '2011-03-14'
* $query->filterByDbFadein('now'); // WHERE fadein = '2011-03-14'
* $query->filterByDbFadein(array('max' => 'yesterday')); // WHERE fadein < '2011-03-13'
* </code>
*
* @param mixed $dbFadein The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockcontentsQuery The current query, for fluid interface
@ -408,14 +599,26 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcBlockcontentsPeer::FADEIN, $dbFadein, $comparison);
}
/**
* Filter the query on the fadeout column
*
* @param string|array $dbFadeout The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbFadeout('2011-03-14'); // WHERE fadeout = '2011-03-14'
* $query->filterByDbFadeout('now'); // WHERE fadeout = '2011-03-14'
* $query->filterByDbFadeout(array('max' => 'yesterday')); // WHERE fadeout < '2011-03-13'
* </code>
*
* @param mixed $dbFadeout The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockcontentsQuery The current query, for fluid interface
@ -439,21 +642,34 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcBlockcontentsPeer::FADEOUT, $dbFadeout, $comparison);
}
/**
* Filter the query by a related CcFiles object
*
* @param CcFiles $ccFiles the related object to use as filter
* @param CcFiles|PropelObjectCollection $ccFiles The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockcontentsQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcFiles($ccFiles, $comparison = null)
{
if ($ccFiles instanceof CcFiles) {
return $this
->addUsingAlias(CcBlockcontentsPeer::FILE_ID, $ccFiles->getDbId(), $comparison);
} elseif ($ccFiles instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CcBlockcontentsPeer::FILE_ID, $ccFiles->toKeyValue('PrimaryKey', 'DbId'), $comparison);
} else {
throw new PropelException('filterByCcFiles() only accepts arguments of type CcFiles or PropelCollection');
}
}
/**
@ -464,7 +680,7 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
*
* @return CcBlockcontentsQuery The current query, for fluid interface
*/
public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function joinCcFiles($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcFiles');
@ -499,7 +715,7 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
*
* @return CcFilesQuery A secondary query class using the current class as primary query
*/
public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function useCcFilesQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcFiles($relationAlias, $joinType)
@ -509,15 +725,27 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
/**
* Filter the query by a related CcBlock object
*
* @param CcBlock $ccBlock the related object to use as filter
* @param CcBlock|PropelObjectCollection $ccBlock The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockcontentsQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcBlock($ccBlock, $comparison = null)
{
if ($ccBlock instanceof CcBlock) {
return $this
->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $ccBlock->getDbId(), $comparison);
} elseif ($ccBlock instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $ccBlock->toKeyValue('PrimaryKey', 'DbId'), $comparison);
} else {
throw new PropelException('filterByCcBlock() only accepts arguments of type CcBlock or PropelCollection');
}
}
/**
@ -528,7 +756,7 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
*
* @return CcBlockcontentsQuery The current query, for fluid interface
*/
public function joinCcBlock($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function joinCcBlock($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcBlock');
@ -563,7 +791,7 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
*
* @return CcBlockQuery A secondary query class using the current class as primary query
*/
public function useCcBlockQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function useCcBlockQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcBlock($relationAlias, $joinType)
@ -616,9 +844,9 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
/**
* Code to execute before every UPDATE statement
*
* @param array $values The associatiove array of columns and values for the update
* @param array $values The associative array of columns and values for the update
* @param PropelPDO $con The connection object used by the query
* @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), ortherwise it is a series of save() calls on all the found objects
* @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), otherwise it is a series of save() calls on all the found objects
*/
protected function basePreUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false)
{
@ -631,7 +859,7 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
/**
* Code to execute after every UPDATE statement
*
* @param int $affectedRows the number of udated rows
* @param int $affectedRows the number of updated rows
* @param PropelPDO $con The connection object used by the query
*/
protected function basePostUpdate($affectedRows, PropelPDO $con)
@ -672,4 +900,4 @@ abstract class BaseCcBlockcontentsQuery extends ModelCriteria
$this->ccBlocks = array();
}
} // BaseCcBlockcontentsQuery
}

View File

@ -10,7 +10,6 @@
*/
abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
{
/**
* Peer class name
*/
@ -24,6 +23,12 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
protected static $peer;
/**
* The flag var to prevent infinite loop in deep copy
* @var boolean
*/
protected $startCopy = false;
/**
* The value for the id field.
* @var int
@ -79,6 +84,12 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
/**
* Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
* @var boolean
*/
protected $alreadyInClearAllReferencesDeep = false;
/**
* Get the [id] column value.
*
@ -86,6 +97,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
public function getDbId()
{
return $this->id;
}
@ -96,6 +108,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
public function getDbCriteria()
{
return $this->criteria;
}
@ -106,6 +119,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
public function getDbModifier()
{
return $this->modifier;
}
@ -116,6 +130,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
public function getDbValue()
{
return $this->value;
}
@ -126,6 +141,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
public function getDbExtra()
{
return $this->extra;
}
@ -136,6 +152,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
public function getDbBlockId()
{
return $this->block_id;
}
@ -147,7 +164,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
public function setDbId($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -156,6 +173,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$this->modifiedColumns[] = CcBlockcriteriaPeer::ID;
}
return $this;
} // setDbId()
@ -167,7 +185,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
public function setDbCriteria($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -176,6 +194,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$this->modifiedColumns[] = CcBlockcriteriaPeer::CRITERIA;
}
return $this;
} // setDbCriteria()
@ -187,7 +206,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
public function setDbModifier($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -196,6 +215,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$this->modifiedColumns[] = CcBlockcriteriaPeer::MODIFIER;
}
return $this;
} // setDbModifier()
@ -207,7 +227,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
public function setDbValue($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -216,6 +236,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$this->modifiedColumns[] = CcBlockcriteriaPeer::VALUE;
}
return $this;
} // setDbValue()
@ -227,7 +248,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
public function setDbExtra($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -236,6 +257,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$this->modifiedColumns[] = CcBlockcriteriaPeer::EXTRA;
}
return $this;
} // setDbExtra()
@ -247,7 +269,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
public function setDbBlockId($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -260,6 +282,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$this->aCcBlock = null;
}
return $this;
} // setDbBlockId()
@ -273,7 +296,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
public function hasOnlyDefaultValues()
{
// otherwise, everything was equal, so return TRUE
// otherwise, everything was equal, so return true
return true;
} // hasOnlyDefaultValues()
@ -286,7 +309,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
* 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 int $startcol 0-based offset column which indicates which resultset 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.
@ -308,8 +331,9 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
if ($rehydrate) {
$this->ensureConsistency();
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 6; // 6 = CcBlockcriteriaPeer::NUM_COLUMNS - CcBlockcriteriaPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 6; // 6 = CcBlockcriteriaPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating CcBlockcriteria object", $e);
@ -384,6 +408,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
* @param PropelPDO $con
* @return void
* @throws PropelException
* @throws Exception
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
@ -399,18 +424,18 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$con->beginTransaction();
try {
$deleteQuery = CcBlockcriteriaQuery::create()
->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con);
if ($ret) {
CcBlockcriteriaQuery::create()
->filterByPrimaryKey($this->getPrimaryKey())
->delete($con);
$deleteQuery->delete($con);
$this->postDelete($con);
$con->commit();
$this->setDeleted(true);
} else {
$con->commit();
}
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -427,6 +452,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @throws Exception
* @see doSave()
*/
public function save(PropelPDO $con = null)
@ -461,8 +487,9 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$affectedRows = 0;
}
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -486,7 +513,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
@ -497,35 +524,125 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$this->setCcBlock($this->aCcBlock);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->modifiedColumns[] = CcBlockcriteriaPeer::ID;
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$criteria = $this->buildCriteria();
if ($criteria->keyContainsValue(CcBlockcriteriaPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockcriteriaPeer::ID.')');
}
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows += 1;
$this->setDbId($pk); //[IMV] update autoincrement primary key
$this->setNew(false);
$this->doInsert($con);
} else {
$affectedRows += CcBlockcriteriaPeer::doUpdate($this, $con);
$this->doUpdate($con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
$affectedRows += 1;
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Insert the row in the database.
*
* @param PropelPDO $con
*
* @throws PropelException
* @see doSave()
*/
protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = CcBlockcriteriaPeer::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcBlockcriteriaPeer::ID . ')');
}
if (null === $this->id) {
try {
$stmt = $con->query("SELECT nextval('cc_blockcriteria_id_seq')");
$row = $stmt->fetch(PDO::FETCH_NUM);
$this->id = $row[0];
} catch (Exception $e) {
throw new PropelException('Unable to get sequence id.', $e);
}
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(CcBlockcriteriaPeer::ID)) {
$modifiedColumns[':p' . $index++] = '"id"';
}
if ($this->isColumnModified(CcBlockcriteriaPeer::CRITERIA)) {
$modifiedColumns[':p' . $index++] = '"criteria"';
}
if ($this->isColumnModified(CcBlockcriteriaPeer::MODIFIER)) {
$modifiedColumns[':p' . $index++] = '"modifier"';
}
if ($this->isColumnModified(CcBlockcriteriaPeer::VALUE)) {
$modifiedColumns[':p' . $index++] = '"value"';
}
if ($this->isColumnModified(CcBlockcriteriaPeer::EXTRA)) {
$modifiedColumns[':p' . $index++] = '"extra"';
}
if ($this->isColumnModified(CcBlockcriteriaPeer::BLOCK_ID)) {
$modifiedColumns[':p' . $index++] = '"block_id"';
}
$sql = sprintf(
'INSERT INTO "cc_blockcriteria" (%s) VALUES (%s)',
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case '"id"':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case '"criteria"':
$stmt->bindValue($identifier, $this->criteria, PDO::PARAM_STR);
break;
case '"modifier"':
$stmt->bindValue($identifier, $this->modifier, PDO::PARAM_STR);
break;
case '"value"':
$stmt->bindValue($identifier, $this->value, PDO::PARAM_STR);
break;
case '"extra"':
$stmt->bindValue($identifier, $this->extra, PDO::PARAM_STR);
break;
case '"block_id"':
$stmt->bindValue($identifier, $this->block_id, PDO::PARAM_INT);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
}
$this->setNew(false);
}
/**
* Update the row in the database.
*
* @param PropelPDO $con
*
* @see doSave()
*/
protected function doUpdate(PropelPDO $con)
{
$selectCriteria = $this->buildPkeyCriteria();
$valuesCriteria = $this->buildCriteria();
BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
}
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
@ -560,11 +677,13 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
$this->validationFailures = $res;
return false;
}
/**
@ -572,10 +691,10 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*
* 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.
* an aggregated 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.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
@ -587,7 +706,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
// We call the validate method on the following object(s) if they
// were passed to this object by their coresponding set
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
@ -616,13 +735,15 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcBlockcriteriaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
$field = $this->getByPosition($pos);
return $field;
}
@ -669,13 +790,18 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
* @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 $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
* @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)
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['CcBlockcriteria'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['CcBlockcriteria'][$this->getPrimaryKey()] = true;
$keys = CcBlockcriteriaPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getDbId(),
@ -685,11 +811,17 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$keys[4] => $this->getDbExtra(),
$keys[5] => $this->getDbBlockId(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
$result[$key] = $virtualColumn;
}
if ($includeForeignObjects) {
if (null !== $this->aCcBlock) {
$result['CcBlock'] = $this->aCcBlock->toArray($keyType, $includeLazyLoadColumns, true);
$result['CcBlock'] = $this->aCcBlock->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
}
return $result;
}
@ -700,13 +832,15 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcBlockcriteriaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
$this->setByPosition($pos, $value);
}
/**
@ -752,7 +886,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
* 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')
* The default key type is the column's BasePeer::TYPE_PHPNAME
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
@ -831,6 +965,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*/
public function isPrimaryKeyNull()
{
return null === $this->getDbId();
}
@ -842,19 +977,33 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
*
* @param object $copyObj An object of CcBlockcriteria (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setDbCriteria($this->criteria);
$copyObj->setDbModifier($this->modifier);
$copyObj->setDbValue($this->value);
$copyObj->setDbExtra($this->extra);
$copyObj->setDbBlockId($this->block_id);
$copyObj->setDbCriteria($this->getDbCriteria());
$copyObj->setDbModifier($this->getDbModifier());
$copyObj->setDbValue($this->getDbValue());
$copyObj->setDbExtra($this->getDbExtra());
$copyObj->setDbBlockId($this->getDbBlockId());
if ($deepCopy && !$this->startCopy) {
// important: temporarily setNew(false) because this affects the behavior of
// the getter/setter methods for fkey referrer objects.
$copyObj->setNew(false);
// store object hash to prevent cycle
$this->startCopy = true;
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
if ($makeNew) {
$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.
@ -874,6 +1023,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
@ -891,6 +1041,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
if (self::$peer === null) {
self::$peer = new CcBlockcriteriaPeer();
}
return self::$peer;
}
@ -917,6 +1068,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$v->addCcBlockcriteria($this);
}
return $this;
}
@ -924,13 +1076,14 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
/**
* Get the associated CcBlock object
*
* @param PropelPDO Optional Connection object.
* @param PropelPDO $con Optional Connection object.
* @param $doQuery Executes a query to get the object if required
* @return CcBlock The associated CcBlock object.
* @throws PropelException
*/
public function getCcBlock(PropelPDO $con = null)
public function getCcBlock(PropelPDO $con = null, $doQuery = true)
{
if ($this->aCcBlock === null && ($this->block_id !== null)) {
if ($this->aCcBlock === null && ($this->block_id !== null) && $doQuery) {
$this->aCcBlock = CcBlockQuery::create()->findPk($this->block_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
@ -940,6 +1093,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$this->aCcBlock->addCcBlockcriterias($this);
*/
}
return $this->aCcBlock;
}
@ -956,6 +1110,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
$this->block_id = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;
$this->clearAllReferences();
$this->resetModified();
$this->setNew(true);
@ -963,39 +1118,46 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
}
/**
* Resets all collections of referencing foreign keys.
* Resets all references to other model objects or collections of model objects.
*
* 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.
* This method is a user-space workaround for PHP's inability to garbage collect
* objects with circular references (even in PHP 5.3). This is currently necessary
* when using Propel in certain daemon or large-volume/high-memory operations.
*
* @param boolean $deep Whether to also clear the references on all associated objects.
* @param boolean $deep Whether to also clear the references on all referrer objects.
*/
public function clearAllReferences($deep = false)
{
if ($deep) {
if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true;
if ($this->aCcBlock instanceof Persistent) {
$this->aCcBlock->clearAllReferences($deep);
}
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
$this->aCcBlock = null;
}
/**
* Catches calls to virtual methods
* return the string representation of this object
*
* @return string
*/
public function __call($name, $params)
public function __toString()
{
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);
return (string) $this->exportTo(CcBlockcriteriaPeer::DEFAULT_STRING_FORMAT);
}
} // BaseCcBlockcriteria
/**
* return true is the object is in saving state
*
* @return boolean
*/
public function isAlreadyInSave()
{
return $this->alreadyInSave;
}
}

View File

@ -8,7 +8,8 @@
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcBlockcriteriaPeer {
abstract class BaseCcBlockcriteriaPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
@ -19,9 +20,6 @@ abstract class BaseCcBlockcriteriaPeer {
/** the related Propel class for this table */
const OM_CLASS = 'CcBlockcriteria';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcBlockcriteria';
/** the related TableMap class for this table */
const TM_CLASS = 'CcBlockcriteriaTableMap';
@ -31,26 +29,32 @@ abstract class BaseCcBlockcriteriaPeer {
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_blockcriteria.ID';
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 6;
/** the column name for the CRITERIA field */
const CRITERIA = 'cc_blockcriteria.CRITERIA';
/** the column name for the id field */
const ID = 'cc_blockcriteria.id';
/** the column name for the MODIFIER field */
const MODIFIER = 'cc_blockcriteria.MODIFIER';
/** the column name for the criteria field */
const CRITERIA = 'cc_blockcriteria.criteria';
/** the column name for the VALUE field */
const VALUE = 'cc_blockcriteria.VALUE';
/** the column name for the modifier field */
const MODIFIER = 'cc_blockcriteria.modifier';
/** the column name for the EXTRA field */
const EXTRA = 'cc_blockcriteria.EXTRA';
/** the column name for the value field */
const VALUE = 'cc_blockcriteria.value';
/** the column name for the BLOCK_ID field */
const BLOCK_ID = 'cc_blockcriteria.BLOCK_ID';
/** the column name for the extra field */
const EXTRA = 'cc_blockcriteria.extra';
/** the column name for the block_id field */
const BLOCK_ID = 'cc_blockcriteria.block_id';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CcBlockcriteria objects.
* An identity map to hold any loaded instances of CcBlockcriteria objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcBlockcriteria[]
@ -62,12 +66,12 @@ abstract class BaseCcBlockcriteriaPeer {
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
* e.g. CcBlockcriteriaPeer::$fieldNames[CcBlockcriteriaPeer::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbCriteria', 'DbModifier', 'DbValue', 'DbExtra', 'DbBlockId', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbCriteria', 'dbModifier', 'dbValue', 'dbExtra', 'dbBlockId', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::CRITERIA, self::MODIFIER, self::VALUE, self::EXTRA, self::BLOCK_ID, ),
BasePeer::TYPE_COLNAME => array (CcBlockcriteriaPeer::ID, CcBlockcriteriaPeer::CRITERIA, CcBlockcriteriaPeer::MODIFIER, CcBlockcriteriaPeer::VALUE, CcBlockcriteriaPeer::EXTRA, CcBlockcriteriaPeer::BLOCK_ID, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CRITERIA', 'MODIFIER', 'VALUE', 'EXTRA', 'BLOCK_ID', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'criteria', 'modifier', 'value', 'extra', 'block_id', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
@ -77,12 +81,12 @@ abstract class BaseCcBlockcriteriaPeer {
* 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
* e.g. CcBlockcriteriaPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbCriteria' => 1, 'DbModifier' => 2, 'DbValue' => 3, 'DbExtra' => 4, 'DbBlockId' => 5, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbCriteria' => 1, 'dbModifier' => 2, 'dbValue' => 3, 'dbExtra' => 4, 'dbBlockId' => 5, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::CRITERIA => 1, self::MODIFIER => 2, self::VALUE => 3, self::EXTRA => 4, self::BLOCK_ID => 5, ),
BasePeer::TYPE_COLNAME => array (CcBlockcriteriaPeer::ID => 0, CcBlockcriteriaPeer::CRITERIA => 1, CcBlockcriteriaPeer::MODIFIER => 2, CcBlockcriteriaPeer::VALUE => 3, CcBlockcriteriaPeer::EXTRA => 4, CcBlockcriteriaPeer::BLOCK_ID => 5, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CRITERIA' => 1, 'MODIFIER' => 2, 'VALUE' => 3, 'EXTRA' => 4, 'BLOCK_ID' => 5, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'criteria' => 1, 'modifier' => 2, 'value' => 3, 'extra' => 4, 'block_id' => 5, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
@ -98,13 +102,14 @@ abstract class BaseCcBlockcriteriaPeer {
* @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)
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = CcBlockcriteriaPeer::getFieldNames($toType);
$key = isset(CcBlockcriteriaPeer::$fieldKeys[$fromType][$name]) ? CcBlockcriteriaPeer::$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));
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcBlockcriteriaPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@ -115,14 +120,15 @@ abstract class BaseCcBlockcriteriaPeer {
* 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
* @throws PropelException - if the type is not valid.
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
if (!array_key_exists($type, CcBlockcriteriaPeer::$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];
return CcBlockcriteriaPeer::$fieldNames[$type];
}
/**
@ -164,12 +170,12 @@ abstract class BaseCcBlockcriteriaPeer {
$criteria->addSelectColumn(CcBlockcriteriaPeer::EXTRA);
$criteria->addSelectColumn(CcBlockcriteriaPeer::BLOCK_ID);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.CRITERIA');
$criteria->addSelectColumn($alias . '.MODIFIER');
$criteria->addSelectColumn($alias . '.VALUE');
$criteria->addSelectColumn($alias . '.EXTRA');
$criteria->addSelectColumn($alias . '.BLOCK_ID');
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.criteria');
$criteria->addSelectColumn($alias . '.modifier');
$criteria->addSelectColumn($alias . '.value');
$criteria->addSelectColumn($alias . '.extra');
$criteria->addSelectColumn($alias . '.block_id');
}
}
@ -200,7 +206,7 @@ abstract class BaseCcBlockcriteriaPeer {
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
$criteria->setDbName(CcBlockcriteriaPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -214,10 +220,11 @@ abstract class BaseCcBlockcriteriaPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
@ -233,10 +240,11 @@ abstract class BaseCcBlockcriteriaPeer {
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
@ -251,7 +259,7 @@ abstract class BaseCcBlockcriteriaPeer {
/**
* 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
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
@ -273,7 +281,7 @@ abstract class BaseCcBlockcriteriaPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcriteriaPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
@ -287,16 +295,16 @@ abstract class BaseCcBlockcriteriaPeer {
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcBlockcriteria $value A CcBlockcriteria object.
* @param CcBlockcriteria $obj A CcBlockcriteria object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcBlockcriteria $obj, $key = null)
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getDbId();
} // if key === null
self::$instances[$key] = $obj;
CcBlockcriteriaPeer::$instances[$key] = $obj;
}
}
@ -309,6 +317,9 @@ abstract class BaseCcBlockcriteriaPeer {
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcBlockcriteria object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
@ -323,7 +334,7 @@ abstract class BaseCcBlockcriteriaPeer {
throw $e;
}
unset(self::$instances[$key]);
unset(CcBlockcriteriaPeer::$instances[$key]);
}
} // removeInstanceFromPool()
@ -334,16 +345,17 @@ abstract class BaseCcBlockcriteriaPeer {
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return CcBlockcriteria Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @return CcBlockcriteria Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(self::$instances[$key])) {
return self::$instances[$key];
if (isset(CcBlockcriteriaPeer::$instances[$key])) {
return CcBlockcriteriaPeer::$instances[$key];
}
}
return null; // just to be explicit
}
@ -352,9 +364,14 @@ abstract class BaseCcBlockcriteriaPeer {
*
* @return void
*/
public static function clearInstancePool()
public static function clearInstancePool($and_clear_all_references = false)
{
self::$instances = array();
if ($and_clear_all_references) {
foreach (CcBlockcriteriaPeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcBlockcriteriaPeer::$instances = array();
}
/**
@ -373,14 +390,15 @@ abstract class BaseCcBlockcriteriaPeer {
*
* @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.
* @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 the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
@ -395,6 +413,7 @@ abstract class BaseCcBlockcriteriaPeer {
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
@ -410,7 +429,7 @@ abstract class BaseCcBlockcriteriaPeer {
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcBlockcriteriaPeer::getOMClass(false);
$cls = CcBlockcriteriaPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcBlockcriteriaPeer::getPrimaryKeyHashFromRow($row, 0);
@ -427,6 +446,7 @@ abstract class BaseCcBlockcriteriaPeer {
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
@ -445,16 +465,18 @@ abstract class BaseCcBlockcriteriaPeer {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + CcBlockcriteriaPeer::NUM_COLUMNS;
$col = $startcol + CcBlockcriteriaPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CcBlockcriteriaPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcBlockcriteriaPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the number of rows matching criteria, joining the related CcBlock table
*
@ -485,7 +507,7 @@ abstract class BaseCcBlockcriteriaPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcriteriaPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -501,6 +523,7 @@ abstract class BaseCcBlockcriteriaPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -520,11 +543,11 @@ abstract class BaseCcBlockcriteriaPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcriteriaPeer::DATABASE_NAME);
}
CcBlockcriteriaPeer::addSelectColumns($criteria);
$startcol = (CcBlockcriteriaPeer::NUM_COLUMNS - CcBlockcriteriaPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol = CcBlockcriteriaPeer::NUM_HYDRATE_COLUMNS;
CcBlockPeer::addSelectColumns($criteria);
$criteria->addJoin(CcBlockcriteriaPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
@ -540,7 +563,7 @@ abstract class BaseCcBlockcriteriaPeer {
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcBlockcriteriaPeer::getOMClass(false);
$cls = CcBlockcriteriaPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -552,7 +575,7 @@ abstract class BaseCcBlockcriteriaPeer {
$obj2 = CcBlockPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcBlockPeer::getOMClass(false);
$cls = CcBlockPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
@ -567,6 +590,7 @@ abstract class BaseCcBlockcriteriaPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -601,7 +625,7 @@ abstract class BaseCcBlockcriteriaPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcriteriaPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -617,6 +641,7 @@ abstract class BaseCcBlockcriteriaPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -636,14 +661,14 @@ abstract class BaseCcBlockcriteriaPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcriteriaPeer::DATABASE_NAME);
}
CcBlockcriteriaPeer::addSelectColumns($criteria);
$startcol2 = (CcBlockcriteriaPeer::NUM_COLUMNS - CcBlockcriteriaPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcBlockcriteriaPeer::NUM_HYDRATE_COLUMNS;
CcBlockPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcBlockPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcBlockcriteriaPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
@ -657,7 +682,7 @@ abstract class BaseCcBlockcriteriaPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcBlockcriteriaPeer::getOMClass(false);
$cls = CcBlockcriteriaPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -671,7 +696,7 @@ abstract class BaseCcBlockcriteriaPeer {
$obj2 = CcBlockPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcBlockPeer::getOMClass(false);
$cls = CcBlockPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -685,6 +710,7 @@ abstract class BaseCcBlockcriteriaPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -697,7 +723,7 @@ abstract class BaseCcBlockcriteriaPeer {
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
return Propel::getDatabaseMap(CcBlockcriteriaPeer::DATABASE_NAME)->getTable(CcBlockcriteriaPeer::TABLE_NAME);
}
/**
@ -706,30 +732,24 @@ abstract class BaseCcBlockcriteriaPeer {
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcBlockcriteriaPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcBlockcriteriaPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcBlockcriteriaTableMap());
if (!$dbMap->hasTable(BaseCcBlockcriteriaPeer::TABLE_NAME)) {
$dbMap->addTableObject(new \CcBlockcriteriaTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
* @return string ClassName
*/
public static function getOMClass($withPrefix = true)
public static function getOMClass($row = 0, $colnum = 0)
{
return $withPrefix ? CcBlockcriteriaPeer::CLASS_DEFAULT : CcBlockcriteriaPeer::OM_CLASS;
return CcBlockcriteriaPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcBlockcriteria or Criteria object.
* Performs an INSERT on the database, given a CcBlockcriteria or Criteria object.
*
* @param mixed $values Criteria or CcBlockcriteria object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
@ -755,7 +775,7 @@ abstract class BaseCcBlockcriteriaPeer {
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcriteriaPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
@ -763,7 +783,7 @@ abstract class BaseCcBlockcriteriaPeer {
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -772,7 +792,7 @@ abstract class BaseCcBlockcriteriaPeer {
}
/**
* Method perform an UPDATE on the database, given a CcBlockcriteria or Criteria object.
* Performs an UPDATE on the database, given a CcBlockcriteria or Criteria object.
*
* @param mixed $values Criteria or CcBlockcriteria object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
@ -786,7 +806,7 @@ abstract class BaseCcBlockcriteriaPeer {
$con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
$selectCriteria = new Criteria(CcBlockcriteriaPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
@ -805,17 +825,19 @@ abstract class BaseCcBlockcriteriaPeer {
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcriteriaPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_blockcriteria table.
* Deletes all rows from the cc_blockcriteria table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll($con = null)
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
@ -832,15 +854,16 @@ abstract class BaseCcBlockcriteriaPeer {
CcBlockcriteriaPeer::clearInstancePool();
CcBlockcriteriaPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcBlockcriteria or Criteria object OR a primary key value.
* Performs a DELETE on the database, given a CcBlockcriteria or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcBlockcriteria object or primary key or array of primary keys
* which is used to create the DELETE statement
@ -869,7 +892,7 @@ abstract class BaseCcBlockcriteriaPeer {
// 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 = new Criteria(CcBlockcriteriaPeer::DATABASE_NAME);
$criteria->add(CcBlockcriteriaPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
@ -878,7 +901,7 @@ abstract class BaseCcBlockcriteriaPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcBlockcriteriaPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@ -890,8 +913,9 @@ abstract class BaseCcBlockcriteriaPeer {
$affectedRows += BasePeer::doDelete($criteria, $con);
CcBlockcriteriaPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -909,7 +933,7 @@ abstract class BaseCcBlockcriteriaPeer {
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(CcBlockcriteria $obj, $cols = null)
public static function doValidate($obj, $cols = null)
{
$columns = array();
@ -922,7 +946,7 @@ abstract class BaseCcBlockcriteriaPeer {
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
@ -965,6 +989,7 @@ abstract class BaseCcBlockcriteriaPeer {
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcBlockcriteria[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
@ -982,6 +1007,7 @@ abstract class BaseCcBlockcriteriaPeer {
$criteria->add(CcBlockcriteriaPeer::ID, $pks, Criteria::IN);
$objs = CcBlockcriteriaPeer::doSelect($criteria, $con);
}
return $objs;
}

View File

@ -24,14 +24,13 @@
* @method CcBlockcriteriaQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcBlockcriteriaQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcBlockcriteriaQuery leftJoinCcBlock($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlock relation
* @method CcBlockcriteriaQuery rightJoinCcBlock($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlock relation
* @method CcBlockcriteriaQuery innerJoinCcBlock($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlock relation
* @method CcBlockcriteriaQuery leftJoinCcBlock($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcBlock relation
* @method CcBlockcriteriaQuery rightJoinCcBlock($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcBlock relation
* @method CcBlockcriteriaQuery innerJoinCcBlock($relationAlias = null) Adds a INNER JOIN clause to the query using the CcBlock relation
*
* @method CcBlockcriteria findOne(PropelPDO $con = null) Return the first CcBlockcriteria matching the query
* @method CcBlockcriteria findOneOrCreate(PropelPDO $con = null) Return the first CcBlockcriteria matching the query, or a new CcBlockcriteria object populated from the query conditions when no match is found
*
* @method CcBlockcriteria findOneByDbId(int $id) Return the first CcBlockcriteria filtered by the id column
* @method CcBlockcriteria findOneByDbCriteria(string $criteria) Return the first CcBlockcriteria filtered by the criteria column
* @method CcBlockcriteria findOneByDbModifier(string $modifier) Return the first CcBlockcriteria filtered by the modifier column
* @method CcBlockcriteria findOneByDbValue(string $value) Return the first CcBlockcriteria filtered by the value column
@ -49,7 +48,6 @@
*/
abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcBlockcriteriaQuery object.
*
@ -57,8 +55,14 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
* @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 = 'CcBlockcriteria', $modelAlias = null)
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'airtime';
}
if (null === $modelName) {
$modelName = 'CcBlockcriteria';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
@ -66,7 +70,7 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
* Returns a new CcBlockcriteriaQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
* @param CcBlockcriteriaQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CcBlockcriteriaQuery
*/
@ -75,41 +79,115 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
if ($criteria instanceof CcBlockcriteriaQuery) {
return $criteria;
}
$query = new CcBlockcriteriaQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
$query = new CcBlockcriteriaQuery(null, null, $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
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <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 CcBlockcriteria|array|mixed the result, formatted by the current formatter
* @return CcBlockcriteria|CcBlockcriteria[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcBlockcriteriaPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
if ($key === null) {
return null;
}
if ((null !== ($obj = CcBlockcriteriaPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
// the object has not been requested yet, or the formatter is not an object formatter
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcBlockcriteria A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneByDbId($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcBlockcriteria A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "id", "criteria", "modifier", "value", "extra", "block_id" FROM "cc_blockcriteria" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CcBlockcriteria();
$obj->hydrate($row);
CcBlockcriteriaPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcBlockcriteria|CcBlockcriteria[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
@ -119,14 +197,20 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
* @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
* @return PropelObjectCollection|CcBlockcriteria[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
$stmt = $criteria
->filterByPrimaryKeys($keys)
->find($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
@ -138,6 +222,7 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcBlockcriteriaPeer::ID, $key, Criteria::EQUAL);
}
@ -150,29 +235,61 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcBlockcriteriaPeer::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* @param int|array $dbId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbId(1234); // WHERE id = 1234
* $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
* $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
* </code>
*
* @param mixed $dbId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockcriteriaQuery The current query, for fluid interface
*/
public function filterByDbId($dbId = null, $comparison = null)
{
if (is_array($dbId) && null === $comparison) {
if (is_array($dbId)) {
$useMinMax = false;
if (isset($dbId['min'])) {
$this->addUsingAlias(CcBlockcriteriaPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbId['max'])) {
$this->addUsingAlias(CcBlockcriteriaPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcBlockcriteriaPeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the criteria column
*
* Example usage:
* <code>
* $query->filterByDbCriteria('fooValue'); // WHERE criteria = 'fooValue'
* $query->filterByDbCriteria('%fooValue%'); // WHERE criteria LIKE '%fooValue%'
* </code>
*
* @param string $dbCriteria The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -189,12 +306,19 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcBlockcriteriaPeer::CRITERIA, $dbCriteria, $comparison);
}
/**
* Filter the query on the modifier column
*
* Example usage:
* <code>
* $query->filterByDbModifier('fooValue'); // WHERE modifier = 'fooValue'
* $query->filterByDbModifier('%fooValue%'); // WHERE modifier LIKE '%fooValue%'
* </code>
*
* @param string $dbModifier The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -211,12 +335,19 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcBlockcriteriaPeer::MODIFIER, $dbModifier, $comparison);
}
/**
* Filter the query on the value column
*
* Example usage:
* <code>
* $query->filterByDbValue('fooValue'); // WHERE value = 'fooValue'
* $query->filterByDbValue('%fooValue%'); // WHERE value LIKE '%fooValue%'
* </code>
*
* @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
@ -233,12 +364,19 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcBlockcriteriaPeer::VALUE, $dbValue, $comparison);
}
/**
* Filter the query on the extra column
*
* Example usage:
* <code>
* $query->filterByDbExtra('fooValue'); // WHERE extra = 'fooValue'
* $query->filterByDbExtra('%fooValue%'); // WHERE extra LIKE '%fooValue%'
* </code>
*
* @param string $dbExtra The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -255,14 +393,27 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcBlockcriteriaPeer::EXTRA, $dbExtra, $comparison);
}
/**
* Filter the query on the block_id column
*
* @param int|array $dbBlockId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbBlockId(1234); // WHERE block_id = 1234
* $query->filterByDbBlockId(array(12, 34)); // WHERE block_id IN (12, 34)
* $query->filterByDbBlockId(array('min' => 12)); // WHERE block_id >= 12
* $query->filterByDbBlockId(array('max' => 12)); // WHERE block_id <= 12
* </code>
*
* @see filterByCcBlock()
*
* @param mixed $dbBlockId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockcriteriaQuery The current query, for fluid interface
@ -286,21 +437,34 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $dbBlockId, $comparison);
}
/**
* Filter the query by a related CcBlock object
*
* @param CcBlock $ccBlock the related object to use as filter
* @param CcBlock|PropelObjectCollection $ccBlock The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcBlockcriteriaQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcBlock($ccBlock, $comparison = null)
{
if ($ccBlock instanceof CcBlock) {
return $this
->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $ccBlock->getDbId(), $comparison);
} elseif ($ccBlock instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $ccBlock->toKeyValue('PrimaryKey', 'DbId'), $comparison);
} else {
throw new PropelException('filterByCcBlock() only accepts arguments of type CcBlock or PropelCollection');
}
}
/**
@ -311,7 +475,7 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
*
* @return CcBlockcriteriaQuery The current query, for fluid interface
*/
public function joinCcBlock($relationAlias = '', $joinType = Criteria::INNER_JOIN)
public function joinCcBlock($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcBlock');
@ -346,7 +510,7 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
*
* @return CcBlockQuery A secondary query class using the current class as primary query
*/
public function useCcBlockQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
public function useCcBlockQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcBlock($relationAlias, $joinType)
@ -369,4 +533,4 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
return $this;
}
} // BaseCcBlockcriteriaQuery
}

View File

@ -10,7 +10,6 @@
*/
abstract class BaseCcCountry extends BaseObject implements Persistent
{
/**
* Peer class name
*/
@ -24,6 +23,12 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
*/
protected static $peer;
/**
* The flag var to prevent infinite loop in deep copy
* @var boolean
*/
protected $startCopy = false;
/**
* The value for the isocode field.
* @var string
@ -50,6 +55,12 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
/**
* Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
* @var boolean
*/
protected $alreadyInClearAllReferencesDeep = false;
/**
* Get the [isocode] column value.
*
@ -57,6 +68,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
*/
public function getDbIsoCode()
{
return $this->isocode;
}
@ -67,6 +79,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
*/
public function getDbName()
{
return $this->name;
}
@ -78,7 +91,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
*/
public function setDbIsoCode($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -87,6 +100,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
$this->modifiedColumns[] = CcCountryPeer::ISOCODE;
}
return $this;
} // setDbIsoCode()
@ -98,7 +112,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
*/
public function setDbName($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -107,6 +121,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
$this->modifiedColumns[] = CcCountryPeer::NAME;
}
return $this;
} // setDbName()
@ -120,7 +135,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
*/
public function hasOnlyDefaultValues()
{
// otherwise, everything was equal, so return TRUE
// otherwise, everything was equal, so return true
return true;
} // hasOnlyDefaultValues()
@ -133,7 +148,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
* 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 int $startcol 0-based offset column which indicates which resultset 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.
@ -151,8 +166,9 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
if ($rehydrate) {
$this->ensureConsistency();
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 2; // 2 = CcCountryPeer::NUM_COLUMNS - CcCountryPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 2; // 2 = CcCountryPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating CcCountry object", $e);
@ -223,6 +239,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
* @param PropelPDO $con
* @return void
* @throws PropelException
* @throws Exception
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
@ -238,18 +255,18 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
$con->beginTransaction();
try {
$deleteQuery = CcCountryQuery::create()
->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con);
if ($ret) {
CcCountryQuery::create()
->filterByPrimaryKey($this->getPrimaryKey())
->delete($con);
$deleteQuery->delete($con);
$this->postDelete($con);
$con->commit();
$this->setDeleted(true);
} else {
$con->commit();
}
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -266,6 +283,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @throws Exception
* @see doSave()
*/
public function save(PropelPDO $con = null)
@ -300,8 +318,9 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
$affectedRows = 0;
}
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -324,27 +343,87 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$criteria = $this->buildCriteria();
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows = 1;
$this->setNew(false);
$this->doInsert($con);
} else {
$affectedRows = CcCountryPeer::doUpdate($this, $con);
$this->doUpdate($con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
$affectedRows += 1;
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Insert the row in the database.
*
* @param PropelPDO $con
*
* @throws PropelException
* @see doSave()
*/
protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(CcCountryPeer::ISOCODE)) {
$modifiedColumns[':p' . $index++] = '"isocode"';
}
if ($this->isColumnModified(CcCountryPeer::NAME)) {
$modifiedColumns[':p' . $index++] = '"name"';
}
$sql = sprintf(
'INSERT INTO "cc_country" (%s) VALUES (%s)',
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case '"isocode"':
$stmt->bindValue($identifier, $this->isocode, PDO::PARAM_STR);
break;
case '"name"':
$stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
}
$this->setNew(false);
}
/**
* Update the row in the database.
*
* @param PropelPDO $con
*
* @see doSave()
*/
protected function doUpdate(PropelPDO $con)
{
$selectCriteria = $this->buildPkeyCriteria();
$valuesCriteria = $this->buildCriteria();
BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
}
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
@ -379,11 +458,13 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
$this->validationFailures = $res;
return false;
}
/**
@ -391,10 +472,10 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
*
* 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.
* an aggregated 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.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
@ -423,13 +504,15 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcCountryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
$field = $this->getByPosition($pos);
return $field;
}
@ -464,17 +547,28 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
* @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 $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
*
* @return array an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
{
if (isset($alreadyDumpedObjects['CcCountry'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['CcCountry'][$this->getPrimaryKey()] = true;
$keys = CcCountryPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getDbIsoCode(),
$keys[1] => $this->getDbName(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
$result[$key] = $virtualColumn;
}
return $result;
}
@ -485,13 +579,15 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcCountryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
$this->setByPosition($pos, $value);
}
/**
@ -525,7 +621,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
* 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')
* The default key type is the column's BasePeer::TYPE_PHPNAME
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
@ -596,6 +692,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
*/
public function isPrimaryKeyNull()
{
return null === $this->getDbIsoCode();
}
@ -607,14 +704,16 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
*
* @param object $copyObj An object of CcCountry (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setDbIsoCode($this->isocode);
$copyObj->setDbName($this->name);
$copyObj->setDbName($this->getDbName());
if ($makeNew) {
$copyObj->setNew(true);
$copyObj->setDbIsoCode(NULL); // this is a auto-increment column, so set to default value
}
}
/**
@ -635,6 +734,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
@ -652,6 +752,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
if (self::$peer === null) {
self::$peer = new CcCountryPeer();
}
return self::$peer;
}
@ -664,6 +765,7 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
$this->name = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;
$this->clearAllReferences();
$this->resetModified();
$this->setNew(true);
@ -671,38 +773,42 @@ abstract class BaseCcCountry extends BaseObject implements Persistent
}
/**
* Resets all collections of referencing foreign keys.
* Resets all references to other model objects or collections of model objects.
*
* 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.
* This method is a user-space workaround for PHP's inability to garbage collect
* objects with circular references (even in PHP 5.3). This is currently necessary
* when using Propel in certain daemon or large-volume/high-memory operations.
*
* @param boolean $deep Whether to also clear the references on all associated objects.
* @param boolean $deep Whether to also clear the references on all referrer objects.
*/
public function clearAllReferences($deep = false)
{
if ($deep) {
if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true;
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
}
/**
* Catches calls to virtual methods
* return the string representation of this object
*
* @return string
*/
public function __call($name, $params)
public function __toString()
{
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);
return (string) $this->exportTo(CcCountryPeer::DEFAULT_STRING_FORMAT);
}
} // BaseCcCountry
/**
* return true is the object is in saving state
*
* @return boolean
*/
public function isAlreadyInSave()
{
return $this->alreadyInSave;
}
}

View File

@ -8,7 +8,8 @@
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcCountryPeer {
abstract class BaseCcCountryPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
@ -19,9 +20,6 @@ abstract class BaseCcCountryPeer {
/** the related Propel class for this table */
const OM_CLASS = 'CcCountry';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcCountry';
/** the related TableMap class for this table */
const TM_CLASS = 'CcCountryTableMap';
@ -31,14 +29,20 @@ abstract class BaseCcCountryPeer {
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ISOCODE field */
const ISOCODE = 'cc_country.ISOCODE';
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 2;
/** the column name for the NAME field */
const NAME = 'cc_country.NAME';
/** the column name for the isocode field */
const ISOCODE = 'cc_country.isocode';
/** the column name for the name field */
const NAME = 'cc_country.name';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CcCountry objects.
* An identity map to hold any loaded instances of CcCountry objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcCountry[]
@ -50,12 +54,12 @@ abstract class BaseCcCountryPeer {
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
* e.g. CcCountryPeer::$fieldNames[CcCountryPeer::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbIsoCode', 'DbName', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbIsoCode', 'dbName', ),
BasePeer::TYPE_COLNAME => array (self::ISOCODE, self::NAME, ),
BasePeer::TYPE_COLNAME => array (CcCountryPeer::ISOCODE, CcCountryPeer::NAME, ),
BasePeer::TYPE_RAW_COLNAME => array ('ISOCODE', 'NAME', ),
BasePeer::TYPE_FIELDNAME => array ('isocode', 'name', ),
BasePeer::TYPE_NUM => array (0, 1, )
@ -65,12 +69,12 @@ abstract class BaseCcCountryPeer {
* 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
* e.g. CcCountryPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbIsoCode' => 0, 'DbName' => 1, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbIsoCode' => 0, 'dbName' => 1, ),
BasePeer::TYPE_COLNAME => array (self::ISOCODE => 0, self::NAME => 1, ),
BasePeer::TYPE_COLNAME => array (CcCountryPeer::ISOCODE => 0, CcCountryPeer::NAME => 1, ),
BasePeer::TYPE_RAW_COLNAME => array ('ISOCODE' => 0, 'NAME' => 1, ),
BasePeer::TYPE_FIELDNAME => array ('isocode' => 0, 'name' => 1, ),
BasePeer::TYPE_NUM => array (0, 1, )
@ -86,13 +90,14 @@ abstract class BaseCcCountryPeer {
* @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)
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = CcCountryPeer::getFieldNames($toType);
$key = isset(CcCountryPeer::$fieldKeys[$fromType][$name]) ? CcCountryPeer::$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));
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcCountryPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@ -103,14 +108,15 @@ abstract class BaseCcCountryPeer {
* 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
* @throws PropelException - if the type is not valid.
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
if (!array_key_exists($type, CcCountryPeer::$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];
return CcCountryPeer::$fieldNames[$type];
}
/**
@ -148,8 +154,8 @@ abstract class BaseCcCountryPeer {
$criteria->addSelectColumn(CcCountryPeer::ISOCODE);
$criteria->addSelectColumn(CcCountryPeer::NAME);
} else {
$criteria->addSelectColumn($alias . '.ISOCODE');
$criteria->addSelectColumn($alias . '.NAME');
$criteria->addSelectColumn($alias . '.isocode');
$criteria->addSelectColumn($alias . '.name');
}
}
@ -180,7 +186,7 @@ abstract class BaseCcCountryPeer {
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
$criteria->setDbName(CcCountryPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -194,10 +200,11 @@ abstract class BaseCcCountryPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
@ -213,10 +220,11 @@ abstract class BaseCcCountryPeer {
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
@ -231,7 +239,7 @@ abstract class BaseCcCountryPeer {
/**
* 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
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
@ -253,7 +261,7 @@ abstract class BaseCcCountryPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcCountryPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
@ -267,16 +275,16 @@ abstract class BaseCcCountryPeer {
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcCountry $value A CcCountry object.
* @param CcCountry $obj A CcCountry object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcCountry $obj, $key = null)
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getDbIsoCode();
} // if key === null
self::$instances[$key] = $obj;
CcCountryPeer::$instances[$key] = $obj;
}
}
@ -289,6 +297,9 @@ abstract class BaseCcCountryPeer {
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcCountry object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
@ -303,7 +314,7 @@ abstract class BaseCcCountryPeer {
throw $e;
}
unset(self::$instances[$key]);
unset(CcCountryPeer::$instances[$key]);
}
} // removeInstanceFromPool()
@ -314,16 +325,17 @@ abstract class BaseCcCountryPeer {
* 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 CcCountry Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @return CcCountry 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];
if (isset(CcCountryPeer::$instances[$key])) {
return CcCountryPeer::$instances[$key];
}
}
return null; // just to be explicit
}
@ -332,9 +344,14 @@ abstract class BaseCcCountryPeer {
*
* @return void
*/
public static function clearInstancePool()
public static function clearInstancePool($and_clear_all_references = false)
{
self::$instances = array();
if ($and_clear_all_references) {
foreach (CcCountryPeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcCountryPeer::$instances = array();
}
/**
@ -353,14 +370,15 @@ abstract class BaseCcCountryPeer {
*
* @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.
* @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 the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
@ -375,6 +393,7 @@ abstract class BaseCcCountryPeer {
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (string) $row[$startcol];
}
@ -390,7 +409,7 @@ abstract class BaseCcCountryPeer {
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcCountryPeer::getOMClass(false);
$cls = CcCountryPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcCountryPeer::getPrimaryKeyHashFromRow($row, 0);
@ -407,6 +426,7 @@ abstract class BaseCcCountryPeer {
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
@ -425,15 +445,17 @@ abstract class BaseCcCountryPeer {
// 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 + CcCountryPeer::NUM_COLUMNS;
$col = $startcol + CcCountryPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CcCountryPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcCountryPeer::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.
@ -443,7 +465,7 @@ abstract class BaseCcCountryPeer {
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
return Propel::getDatabaseMap(CcCountryPeer::DATABASE_NAME)->getTable(CcCountryPeer::TABLE_NAME);
}
/**
@ -452,30 +474,24 @@ abstract class BaseCcCountryPeer {
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcCountryPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcCountryPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcCountryTableMap());
if (!$dbMap->hasTable(BaseCcCountryPeer::TABLE_NAME)) {
$dbMap->addTableObject(new \CcCountryTableMap());
}
}
/**
* 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
* @return string ClassName
*/
public static function getOMClass($withPrefix = true)
public static function getOMClass($row = 0, $colnum = 0)
{
return $withPrefix ? CcCountryPeer::CLASS_DEFAULT : CcCountryPeer::OM_CLASS;
return CcCountryPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcCountry or Criteria object.
* Performs an INSERT on the database, given a CcCountry or Criteria object.
*
* @param mixed $values Criteria or CcCountry object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
@ -497,7 +513,7 @@ abstract class BaseCcCountryPeer {
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcCountryPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
@ -505,7 +521,7 @@ abstract class BaseCcCountryPeer {
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -514,7 +530,7 @@ abstract class BaseCcCountryPeer {
}
/**
* Method perform an UPDATE on the database, given a CcCountry or Criteria object.
* Performs an UPDATE on the database, given a CcCountry or Criteria object.
*
* @param mixed $values Criteria or CcCountry 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).
@ -528,7 +544,7 @@ abstract class BaseCcCountryPeer {
$con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
$selectCriteria = new Criteria(CcCountryPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
@ -547,17 +563,19 @@ abstract class BaseCcCountryPeer {
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcCountryPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_country table.
* Deletes all rows from the cc_country table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll($con = null)
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
@ -574,15 +592,16 @@ abstract class BaseCcCountryPeer {
CcCountryPeer::clearInstancePool();
CcCountryPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcCountry or Criteria object OR a primary key value.
* Performs a DELETE on the database, given a CcCountry or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcCountry object or primary key or array of primary keys
* which is used to create the DELETE statement
@ -611,7 +630,7 @@ abstract class BaseCcCountryPeer {
// 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 = new Criteria(CcCountryPeer::DATABASE_NAME);
$criteria->add(CcCountryPeer::ISOCODE, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
@ -620,7 +639,7 @@ abstract class BaseCcCountryPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcCountryPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@ -632,8 +651,9 @@ abstract class BaseCcCountryPeer {
$affectedRows += BasePeer::doDelete($criteria, $con);
CcCountryPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -651,7 +671,7 @@ abstract class BaseCcCountryPeer {
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(CcCountry $obj, $cols = null)
public static function doValidate($obj, $cols = null)
{
$columns = array();
@ -664,7 +684,7 @@ abstract class BaseCcCountryPeer {
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
@ -707,6 +727,7 @@ abstract class BaseCcCountryPeer {
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcCountry[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
@ -724,6 +745,7 @@ abstract class BaseCcCountryPeer {
$criteria->add(CcCountryPeer::ISOCODE, $pks, Criteria::IN);
$objs = CcCountryPeer::doSelect($criteria, $con);
}
return $objs;
}

View File

@ -19,7 +19,6 @@
* @method CcCountry findOne(PropelPDO $con = null) Return the first CcCountry matching the query
* @method CcCountry findOneOrCreate(PropelPDO $con = null) Return the first CcCountry matching the query, or a new CcCountry object populated from the query conditions when no match is found
*
* @method CcCountry findOneByDbIsoCode(string $isocode) Return the first CcCountry filtered by the isocode column
* @method CcCountry findOneByDbName(string $name) Return the first CcCountry filtered by the name column
*
* @method array findByDbIsoCode(string $isocode) Return CcCountry objects filtered by the isocode column
@ -29,7 +28,6 @@
*/
abstract class BaseCcCountryQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcCountryQuery object.
*
@ -37,8 +35,14 @@ abstract class BaseCcCountryQuery extends ModelCriteria
* @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 = 'CcCountry', $modelAlias = null)
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'airtime';
}
if (null === $modelName) {
$modelName = 'CcCountry';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
@ -46,7 +50,7 @@ abstract class BaseCcCountryQuery extends ModelCriteria
* Returns a new CcCountryQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
* @param CcCountryQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CcCountryQuery
*/
@ -55,41 +59,115 @@ abstract class BaseCcCountryQuery extends ModelCriteria
if ($criteria instanceof CcCountryQuery) {
return $criteria;
}
$query = new CcCountryQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
$query = new CcCountryQuery(null, null, $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
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <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 CcCountry|array|mixed the result, formatted by the current formatter
* @return CcCountry|CcCountry[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcCountryPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
if ($key === null) {
return null;
}
if ((null !== ($obj = CcCountryPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
// the object has not been requested yet, or the formatter is not an object formatter
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcCountry A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneByDbIsoCode($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcCountry A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "isocode", "name" FROM "cc_country" WHERE "isocode" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_STR);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CcCountry();
$obj->hydrate($row);
CcCountryPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcCountry|CcCountry[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
@ -99,14 +177,20 @@ abstract class BaseCcCountryQuery extends ModelCriteria
* @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
* @return PropelObjectCollection|CcCountry[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
$stmt = $criteria
->filterByPrimaryKeys($keys)
->find($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
@ -118,6 +202,7 @@ abstract class BaseCcCountryQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcCountryPeer::ISOCODE, $key, Criteria::EQUAL);
}
@ -130,12 +215,19 @@ abstract class BaseCcCountryQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcCountryPeer::ISOCODE, $keys, Criteria::IN);
}
/**
* Filter the query on the isocode column
*
* Example usage:
* <code>
* $query->filterByDbIsoCode('fooValue'); // WHERE isocode = 'fooValue'
* $query->filterByDbIsoCode('%fooValue%'); // WHERE isocode LIKE '%fooValue%'
* </code>
*
* @param string $dbIsoCode 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
@ -152,12 +244,19 @@ abstract class BaseCcCountryQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcCountryPeer::ISOCODE, $dbIsoCode, $comparison);
}
/**
* Filter the query on the name column
*
* Example usage:
* <code>
* $query->filterByDbName('fooValue'); // WHERE name = 'fooValue'
* $query->filterByDbName('%fooValue%'); // WHERE name LIKE '%fooValue%'
* </code>
*
* @param string $dbName The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -174,6 +273,7 @@ abstract class BaseCcCountryQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcCountryPeer::NAME, $dbName, $comparison);
}
@ -193,4 +293,4 @@ abstract class BaseCcCountryQuery extends ModelCriteria
return $this;
}
} // BaseCcCountryQuery
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,6 @@
*/
abstract class BaseCcListenerCount extends BaseObject implements Persistent
{
/**
* Peer class name
*/
@ -24,6 +23,12 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
*/
protected static $peer;
/**
* The flag var to prevent infinite loop in deep copy
* @var boolean
*/
protected $startCopy = false;
/**
* The value for the id field.
* @var int
@ -72,6 +77,12 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
/**
* Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
* @var boolean
*/
protected $alreadyInClearAllReferencesDeep = false;
/**
* Get the [id] column value.
*
@ -79,6 +90,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
*/
public function getDbId()
{
return $this->id;
}
@ -89,6 +101,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
*/
public function getDbTimestampId()
{
return $this->timestamp_id;
}
@ -99,6 +112,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
*/
public function getDbMountNameId()
{
return $this->mount_name_id;
}
@ -109,6 +123,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
*/
public function getDbListenerCount()
{
return $this->listener_count;
}
@ -120,7 +135,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
*/
public function setDbId($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -129,6 +144,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$this->modifiedColumns[] = CcListenerCountPeer::ID;
}
return $this;
} // setDbId()
@ -140,7 +156,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
*/
public function setDbTimestampId($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -153,6 +169,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$this->aCcTimestamp = null;
}
return $this;
} // setDbTimestampId()
@ -164,7 +181,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
*/
public function setDbMountNameId($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -177,6 +194,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$this->aCcMountName = null;
}
return $this;
} // setDbMountNameId()
@ -188,7 +206,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
*/
public function setDbListenerCount($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -197,6 +215,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$this->modifiedColumns[] = CcListenerCountPeer::LISTENER_COUNT;
}
return $this;
} // setDbListenerCount()
@ -210,7 +229,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
*/
public function hasOnlyDefaultValues()
{
// otherwise, everything was equal, so return TRUE
// otherwise, everything was equal, so return true
return true;
} // hasOnlyDefaultValues()
@ -223,7 +242,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
* 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 int $startcol 0-based offset column which indicates which resultset 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.
@ -243,8 +262,9 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
if ($rehydrate) {
$this->ensureConsistency();
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 4; // 4 = CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 4; // 4 = CcListenerCountPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating CcListenerCount object", $e);
@ -323,6 +343,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
* @param PropelPDO $con
* @return void
* @throws PropelException
* @throws Exception
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
@ -338,18 +359,18 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$con->beginTransaction();
try {
$deleteQuery = CcListenerCountQuery::create()
->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con);
if ($ret) {
CcListenerCountQuery::create()
->filterByPrimaryKey($this->getPrimaryKey())
->delete($con);
$deleteQuery->delete($con);
$this->postDelete($con);
$con->commit();
$this->setDeleted(true);
} else {
$con->commit();
}
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -366,6 +387,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @throws Exception
* @see doSave()
*/
public function save(PropelPDO $con = null)
@ -400,8 +422,9 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$affectedRows = 0;
}
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -425,7 +448,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
@ -443,35 +466,113 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$this->setCcMountName($this->aCcMountName);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->modifiedColumns[] = CcListenerCountPeer::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(CcListenerCountPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcListenerCountPeer::ID.')');
}
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows += 1;
$this->setDbId($pk); //[IMV] update autoincrement primary key
$this->setNew(false);
$this->doInsert($con);
} else {
$affectedRows += CcListenerCountPeer::doUpdate($this, $con);
$this->doUpdate($con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
$affectedRows += 1;
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Insert the row in the database.
*
* @param PropelPDO $con
*
* @throws PropelException
* @see doSave()
*/
protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = CcListenerCountPeer::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcListenerCountPeer::ID . ')');
}
if (null === $this->id) {
try {
$stmt = $con->query("SELECT nextval('cc_listener_count_id_seq')");
$row = $stmt->fetch(PDO::FETCH_NUM);
$this->id = $row[0];
} catch (Exception $e) {
throw new PropelException('Unable to get sequence id.', $e);
}
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(CcListenerCountPeer::ID)) {
$modifiedColumns[':p' . $index++] = '"id"';
}
if ($this->isColumnModified(CcListenerCountPeer::TIMESTAMP_ID)) {
$modifiedColumns[':p' . $index++] = '"timestamp_id"';
}
if ($this->isColumnModified(CcListenerCountPeer::MOUNT_NAME_ID)) {
$modifiedColumns[':p' . $index++] = '"mount_name_id"';
}
if ($this->isColumnModified(CcListenerCountPeer::LISTENER_COUNT)) {
$modifiedColumns[':p' . $index++] = '"listener_count"';
}
$sql = sprintf(
'INSERT INTO "cc_listener_count" (%s) VALUES (%s)',
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case '"id"':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case '"timestamp_id"':
$stmt->bindValue($identifier, $this->timestamp_id, PDO::PARAM_INT);
break;
case '"mount_name_id"':
$stmt->bindValue($identifier, $this->mount_name_id, PDO::PARAM_INT);
break;
case '"listener_count"':
$stmt->bindValue($identifier, $this->listener_count, PDO::PARAM_INT);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
}
$this->setNew(false);
}
/**
* Update the row in the database.
*
* @param PropelPDO $con
*
* @see doSave()
*/
protected function doUpdate(PropelPDO $con)
{
$selectCriteria = $this->buildPkeyCriteria();
$valuesCriteria = $this->buildCriteria();
BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
}
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
@ -506,11 +607,13 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
$this->validationFailures = $res;
return false;
}
/**
@ -518,10 +621,10 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
*
* 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.
* an aggregated 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.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
@ -533,7 +636,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
// We call the validate method on the following object(s) if they
// were passed to this object by their coresponding set
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
@ -568,13 +671,15 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcListenerCountPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
$field = $this->getByPosition($pos);
return $field;
}
@ -615,13 +720,18 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
* @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 $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
* @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)
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['CcListenerCount'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['CcListenerCount'][$this->getPrimaryKey()] = true;
$keys = CcListenerCountPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getDbId(),
@ -629,14 +739,20 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$keys[2] => $this->getDbMountNameId(),
$keys[3] => $this->getDbListenerCount(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
$result[$key] = $virtualColumn;
}
if ($includeForeignObjects) {
if (null !== $this->aCcTimestamp) {
$result['CcTimestamp'] = $this->aCcTimestamp->toArray($keyType, $includeLazyLoadColumns, true);
$result['CcTimestamp'] = $this->aCcTimestamp->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
if (null !== $this->aCcMountName) {
$result['CcMountName'] = $this->aCcMountName->toArray($keyType, $includeLazyLoadColumns, true);
$result['CcMountName'] = $this->aCcMountName->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
}
return $result;
}
@ -647,13 +763,15 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcListenerCountPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
$this->setByPosition($pos, $value);
}
/**
@ -693,7 +811,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
* 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')
* The default key type is the column's BasePeer::TYPE_PHPNAME
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
@ -768,6 +886,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
*/
public function isPrimaryKeyNull()
{
return null === $this->getDbId();
}
@ -779,17 +898,31 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
*
* @param object $copyObj An object of CcListenerCount (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setDbTimestampId($this->timestamp_id);
$copyObj->setDbMountNameId($this->mount_name_id);
$copyObj->setDbListenerCount($this->listener_count);
$copyObj->setDbTimestampId($this->getDbTimestampId());
$copyObj->setDbMountNameId($this->getDbMountNameId());
$copyObj->setDbListenerCount($this->getDbListenerCount());
if ($deepCopy && !$this->startCopy) {
// important: temporarily setNew(false) because this affects the behavior of
// the getter/setter methods for fkey referrer objects.
$copyObj->setNew(false);
// store object hash to prevent cycle
$this->startCopy = true;
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
if ($makeNew) {
$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.
@ -809,6 +942,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
@ -826,6 +960,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
if (self::$peer === null) {
self::$peer = new CcListenerCountPeer();
}
return self::$peer;
}
@ -852,6 +987,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$v->addCcListenerCount($this);
}
return $this;
}
@ -859,13 +995,14 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
/**
* Get the associated CcTimestamp object
*
* @param PropelPDO Optional Connection object.
* @param PropelPDO $con Optional Connection object.
* @param $doQuery Executes a query to get the object if required
* @return CcTimestamp The associated CcTimestamp object.
* @throws PropelException
*/
public function getCcTimestamp(PropelPDO $con = null)
public function getCcTimestamp(PropelPDO $con = null, $doQuery = true)
{
if ($this->aCcTimestamp === null && ($this->timestamp_id !== null)) {
if ($this->aCcTimestamp === null && ($this->timestamp_id !== null) && $doQuery) {
$this->aCcTimestamp = CcTimestampQuery::create()->findPk($this->timestamp_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
@ -875,6 +1012,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$this->aCcTimestamp->addCcListenerCounts($this);
*/
}
return $this->aCcTimestamp;
}
@ -901,6 +1039,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$v->addCcListenerCount($this);
}
return $this;
}
@ -908,13 +1047,14 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
/**
* Get the associated CcMountName object
*
* @param PropelPDO Optional Connection object.
* @param PropelPDO $con Optional Connection object.
* @param $doQuery Executes a query to get the object if required
* @return CcMountName The associated CcMountName object.
* @throws PropelException
*/
public function getCcMountName(PropelPDO $con = null)
public function getCcMountName(PropelPDO $con = null, $doQuery = true)
{
if ($this->aCcMountName === null && ($this->mount_name_id !== null)) {
if ($this->aCcMountName === null && ($this->mount_name_id !== null) && $doQuery) {
$this->aCcMountName = CcMountNameQuery::create()->findPk($this->mount_name_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
@ -924,6 +1064,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$this->aCcMountName->addCcListenerCounts($this);
*/
}
return $this->aCcMountName;
}
@ -938,6 +1079,7 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
$this->listener_count = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;
$this->clearAllReferences();
$this->resetModified();
$this->setNew(true);
@ -945,17 +1087,26 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
}
/**
* Resets all collections of referencing foreign keys.
* Resets all references to other model objects or collections of model objects.
*
* 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.
* This method is a user-space workaround for PHP's inability to garbage collect
* objects with circular references (even in PHP 5.3). This is currently necessary
* when using Propel in certain daemon or large-volume/high-memory operations.
*
* @param boolean $deep Whether to also clear the references on all associated objects.
* @param boolean $deep Whether to also clear the references on all referrer objects.
*/
public function clearAllReferences($deep = false)
{
if ($deep) {
if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true;
if ($this->aCcTimestamp instanceof Persistent) {
$this->aCcTimestamp->clearAllReferences($deep);
}
if ($this->aCcMountName instanceof Persistent) {
$this->aCcMountName->clearAllReferences($deep);
}
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
$this->aCcTimestamp = null;
@ -963,22 +1114,23 @@ abstract class BaseCcListenerCount extends BaseObject implements Persistent
}
/**
* Catches calls to virtual methods
* return the string representation of this object
*
* @return string
*/
public function __call($name, $params)
public function __toString()
{
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);
return (string) $this->exportTo(CcListenerCountPeer::DEFAULT_STRING_FORMAT);
}
} // BaseCcListenerCount
/**
* return true is the object is in saving state
*
* @return boolean
*/
public function isAlreadyInSave()
{
return $this->alreadyInSave;
}
}

View File

@ -8,7 +8,8 @@
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcListenerCountPeer {
abstract class BaseCcListenerCountPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
@ -19,9 +20,6 @@ abstract class BaseCcListenerCountPeer {
/** the related Propel class for this table */
const OM_CLASS = 'CcListenerCount';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcListenerCount';
/** the related TableMap class for this table */
const TM_CLASS = 'CcListenerCountTableMap';
@ -31,20 +29,26 @@ abstract class BaseCcListenerCountPeer {
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_listener_count.ID';
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 4;
/** the column name for the TIMESTAMP_ID field */
const TIMESTAMP_ID = 'cc_listener_count.TIMESTAMP_ID';
/** the column name for the id field */
const ID = 'cc_listener_count.id';
/** the column name for the MOUNT_NAME_ID field */
const MOUNT_NAME_ID = 'cc_listener_count.MOUNT_NAME_ID';
/** the column name for the timestamp_id field */
const TIMESTAMP_ID = 'cc_listener_count.timestamp_id';
/** the column name for the LISTENER_COUNT field */
const LISTENER_COUNT = 'cc_listener_count.LISTENER_COUNT';
/** the column name for the mount_name_id field */
const MOUNT_NAME_ID = 'cc_listener_count.mount_name_id';
/** the column name for the listener_count field */
const LISTENER_COUNT = 'cc_listener_count.listener_count';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CcListenerCount objects.
* An identity map to hold any loaded instances of CcListenerCount objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcListenerCount[]
@ -56,12 +60,12 @@ abstract class BaseCcListenerCountPeer {
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
* e.g. CcListenerCountPeer::$fieldNames[CcListenerCountPeer::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTimestampId', 'DbMountNameId', 'DbListenerCount', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTimestampId', 'dbMountNameId', 'dbListenerCount', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::TIMESTAMP_ID, self::MOUNT_NAME_ID, self::LISTENER_COUNT, ),
BasePeer::TYPE_COLNAME => array (CcListenerCountPeer::ID, CcListenerCountPeer::TIMESTAMP_ID, CcListenerCountPeer::MOUNT_NAME_ID, CcListenerCountPeer::LISTENER_COUNT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TIMESTAMP_ID', 'MOUNT_NAME_ID', 'LISTENER_COUNT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'timestamp_id', 'mount_name_id', 'listener_count', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
@ -71,12 +75,12 @@ abstract class BaseCcListenerCountPeer {
* 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
* e.g. CcListenerCountPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbTimestampId' => 1, 'DbMountNameId' => 2, 'DbListenerCount' => 3, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTimestampId' => 1, 'dbMountNameId' => 2, 'dbListenerCount' => 3, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TIMESTAMP_ID => 1, self::MOUNT_NAME_ID => 2, self::LISTENER_COUNT => 3, ),
BasePeer::TYPE_COLNAME => array (CcListenerCountPeer::ID => 0, CcListenerCountPeer::TIMESTAMP_ID => 1, CcListenerCountPeer::MOUNT_NAME_ID => 2, CcListenerCountPeer::LISTENER_COUNT => 3, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TIMESTAMP_ID' => 1, 'MOUNT_NAME_ID' => 2, 'LISTENER_COUNT' => 3, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'timestamp_id' => 1, 'mount_name_id' => 2, 'listener_count' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
@ -92,13 +96,14 @@ abstract class BaseCcListenerCountPeer {
* @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)
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = CcListenerCountPeer::getFieldNames($toType);
$key = isset(CcListenerCountPeer::$fieldKeys[$fromType][$name]) ? CcListenerCountPeer::$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));
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcListenerCountPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@ -109,14 +114,15 @@ abstract class BaseCcListenerCountPeer {
* 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
* @throws PropelException - if the type is not valid.
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
if (!array_key_exists($type, CcListenerCountPeer::$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];
return CcListenerCountPeer::$fieldNames[$type];
}
/**
@ -156,10 +162,10 @@ abstract class BaseCcListenerCountPeer {
$criteria->addSelectColumn(CcListenerCountPeer::MOUNT_NAME_ID);
$criteria->addSelectColumn(CcListenerCountPeer::LISTENER_COUNT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.TIMESTAMP_ID');
$criteria->addSelectColumn($alias . '.MOUNT_NAME_ID');
$criteria->addSelectColumn($alias . '.LISTENER_COUNT');
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.timestamp_id');
$criteria->addSelectColumn($alias . '.mount_name_id');
$criteria->addSelectColumn($alias . '.listener_count');
}
}
@ -190,7 +196,7 @@ abstract class BaseCcListenerCountPeer {
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -204,10 +210,11 @@ abstract class BaseCcListenerCountPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
@ -223,10 +230,11 @@ abstract class BaseCcListenerCountPeer {
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
@ -241,7 +249,7 @@ abstract class BaseCcListenerCountPeer {
/**
* 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
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
@ -263,7 +271,7 @@ abstract class BaseCcListenerCountPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
@ -277,16 +285,16 @@ abstract class BaseCcListenerCountPeer {
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcListenerCount $value A CcListenerCount object.
* @param CcListenerCount $obj A CcListenerCount object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcListenerCount $obj, $key = null)
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getDbId();
} // if key === null
self::$instances[$key] = $obj;
CcListenerCountPeer::$instances[$key] = $obj;
}
}
@ -299,6 +307,9 @@ abstract class BaseCcListenerCountPeer {
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcListenerCount object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
@ -313,7 +324,7 @@ abstract class BaseCcListenerCountPeer {
throw $e;
}
unset(self::$instances[$key]);
unset(CcListenerCountPeer::$instances[$key]);
}
} // removeInstanceFromPool()
@ -324,16 +335,17 @@ abstract class BaseCcListenerCountPeer {
* 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 CcListenerCount Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @return CcListenerCount 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];
if (isset(CcListenerCountPeer::$instances[$key])) {
return CcListenerCountPeer::$instances[$key];
}
}
return null; // just to be explicit
}
@ -342,9 +354,14 @@ abstract class BaseCcListenerCountPeer {
*
* @return void
*/
public static function clearInstancePool()
public static function clearInstancePool($and_clear_all_references = false)
{
self::$instances = array();
if ($and_clear_all_references) {
foreach (CcListenerCountPeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcListenerCountPeer::$instances = array();
}
/**
@ -363,14 +380,15 @@ abstract class BaseCcListenerCountPeer {
*
* @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.
* @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 the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
@ -385,6 +403,7 @@ abstract class BaseCcListenerCountPeer {
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
@ -400,7 +419,7 @@ abstract class BaseCcListenerCountPeer {
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcListenerCountPeer::getOMClass(false);
$cls = CcListenerCountPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, 0);
@ -417,6 +436,7 @@ abstract class BaseCcListenerCountPeer {
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
@ -435,16 +455,18 @@ abstract class BaseCcListenerCountPeer {
// 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 + CcListenerCountPeer::NUM_COLUMNS;
$col = $startcol + CcListenerCountPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CcListenerCountPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcListenerCountPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the number of rows matching criteria, joining the related CcTimestamp table
*
@ -475,7 +497,7 @@ abstract class BaseCcListenerCountPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -491,6 +513,7 @@ abstract class BaseCcListenerCountPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -525,7 +548,7 @@ abstract class BaseCcListenerCountPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -541,6 +564,7 @@ abstract class BaseCcListenerCountPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -560,11 +584,11 @@ abstract class BaseCcListenerCountPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
}
CcListenerCountPeer::addSelectColumns($criteria);
$startcol = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol = CcListenerCountPeer::NUM_HYDRATE_COLUMNS;
CcTimestampPeer::addSelectColumns($criteria);
$criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
@ -580,7 +604,7 @@ abstract class BaseCcListenerCountPeer {
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcListenerCountPeer::getOMClass(false);
$cls = CcListenerCountPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -592,7 +616,7 @@ abstract class BaseCcListenerCountPeer {
$obj2 = CcTimestampPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcTimestampPeer::getOMClass(false);
$cls = CcTimestampPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
@ -607,6 +631,7 @@ abstract class BaseCcListenerCountPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -626,11 +651,11 @@ abstract class BaseCcListenerCountPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
}
CcListenerCountPeer::addSelectColumns($criteria);
$startcol = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol = CcListenerCountPeer::NUM_HYDRATE_COLUMNS;
CcMountNamePeer::addSelectColumns($criteria);
$criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior);
@ -646,7 +671,7 @@ abstract class BaseCcListenerCountPeer {
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcListenerCountPeer::getOMClass(false);
$cls = CcListenerCountPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -658,7 +683,7 @@ abstract class BaseCcListenerCountPeer {
$obj2 = CcMountNamePeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcMountNamePeer::getOMClass(false);
$cls = CcMountNamePeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
@ -673,6 +698,7 @@ abstract class BaseCcListenerCountPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -707,7 +733,7 @@ abstract class BaseCcListenerCountPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -725,6 +751,7 @@ abstract class BaseCcListenerCountPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -744,17 +771,17 @@ abstract class BaseCcListenerCountPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
}
CcListenerCountPeer::addSelectColumns($criteria);
$startcol2 = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcListenerCountPeer::NUM_HYDRATE_COLUMNS;
CcTimestampPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcTimestampPeer::NUM_COLUMNS - CcTimestampPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcTimestampPeer::NUM_HYDRATE_COLUMNS;
CcMountNamePeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + (CcMountNamePeer::NUM_COLUMNS - CcMountNamePeer::NUM_LAZY_LOAD_COLUMNS);
$startcol4 = $startcol3 + CcMountNamePeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
@ -770,7 +797,7 @@ abstract class BaseCcListenerCountPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcListenerCountPeer::getOMClass(false);
$cls = CcListenerCountPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -784,7 +811,7 @@ abstract class BaseCcListenerCountPeer {
$obj2 = CcTimestampPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcTimestampPeer::getOMClass(false);
$cls = CcTimestampPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -802,7 +829,7 @@ abstract class BaseCcListenerCountPeer {
$obj3 = CcMountNamePeer::getInstanceFromPool($key3);
if (!$obj3) {
$cls = CcMountNamePeer::getOMClass(false);
$cls = CcMountNamePeer::getOMClass();
$obj3 = new $cls();
$obj3->hydrate($row, $startcol3);
@ -816,6 +843,7 @@ abstract class BaseCcListenerCountPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -850,7 +878,7 @@ abstract class BaseCcListenerCountPeer {
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -866,6 +894,7 @@ abstract class BaseCcListenerCountPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -900,7 +929,7 @@ abstract class BaseCcListenerCountPeer {
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -916,6 +945,7 @@ abstract class BaseCcListenerCountPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -938,14 +968,14 @@ abstract class BaseCcListenerCountPeer {
// $criteria->getDbName() will return the same object if not set to another value
// so == check is okay and faster
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
}
CcListenerCountPeer::addSelectColumns($criteria);
$startcol2 = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcListenerCountPeer::NUM_HYDRATE_COLUMNS;
CcMountNamePeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcMountNamePeer::NUM_COLUMNS - CcMountNamePeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcMountNamePeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior);
@ -960,7 +990,7 @@ abstract class BaseCcListenerCountPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcListenerCountPeer::getOMClass(false);
$cls = CcListenerCountPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -974,7 +1004,7 @@ abstract class BaseCcListenerCountPeer {
$obj2 = CcMountNamePeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcMountNamePeer::getOMClass(false);
$cls = CcMountNamePeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -989,6 +1019,7 @@ abstract class BaseCcListenerCountPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -1011,14 +1042,14 @@ abstract class BaseCcListenerCountPeer {
// $criteria->getDbName() will return the same object if not set to another value
// so == check is okay and faster
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
}
CcListenerCountPeer::addSelectColumns($criteria);
$startcol2 = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcListenerCountPeer::NUM_HYDRATE_COLUMNS;
CcTimestampPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcTimestampPeer::NUM_COLUMNS - CcTimestampPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcTimestampPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
@ -1033,7 +1064,7 @@ abstract class BaseCcListenerCountPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcListenerCountPeer::getOMClass(false);
$cls = CcListenerCountPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -1047,7 +1078,7 @@ abstract class BaseCcListenerCountPeer {
$obj2 = CcTimestampPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcTimestampPeer::getOMClass(false);
$cls = CcTimestampPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -1062,6 +1093,7 @@ abstract class BaseCcListenerCountPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -1074,7 +1106,7 @@ abstract class BaseCcListenerCountPeer {
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
return Propel::getDatabaseMap(CcListenerCountPeer::DATABASE_NAME)->getTable(CcListenerCountPeer::TABLE_NAME);
}
/**
@ -1083,30 +1115,24 @@ abstract class BaseCcListenerCountPeer {
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcListenerCountPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcListenerCountPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcListenerCountTableMap());
if (!$dbMap->hasTable(BaseCcListenerCountPeer::TABLE_NAME)) {
$dbMap->addTableObject(new \CcListenerCountTableMap());
}
}
/**
* 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
* @return string ClassName
*/
public static function getOMClass($withPrefix = true)
public static function getOMClass($row = 0, $colnum = 0)
{
return $withPrefix ? CcListenerCountPeer::CLASS_DEFAULT : CcListenerCountPeer::OM_CLASS;
return CcListenerCountPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcListenerCount or Criteria object.
* Performs an INSERT on the database, given a CcListenerCount or Criteria object.
*
* @param mixed $values Criteria or CcListenerCount object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
@ -1132,7 +1158,7 @@ abstract class BaseCcListenerCountPeer {
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
@ -1140,7 +1166,7 @@ abstract class BaseCcListenerCountPeer {
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -1149,7 +1175,7 @@ abstract class BaseCcListenerCountPeer {
}
/**
* Method perform an UPDATE on the database, given a CcListenerCount or Criteria object.
* Performs an UPDATE on the database, given a CcListenerCount or Criteria object.
*
* @param mixed $values Criteria or CcListenerCount 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).
@ -1163,7 +1189,7 @@ abstract class BaseCcListenerCountPeer {
$con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
$selectCriteria = new Criteria(CcListenerCountPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
@ -1182,17 +1208,19 @@ abstract class BaseCcListenerCountPeer {
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_listener_count table.
* Deletes all rows from the cc_listener_count table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll($con = null)
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
@ -1209,15 +1237,16 @@ abstract class BaseCcListenerCountPeer {
CcListenerCountPeer::clearInstancePool();
CcListenerCountPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcListenerCount or Criteria object OR a primary key value.
* Performs a DELETE on the database, given a CcListenerCount or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcListenerCount object or primary key or array of primary keys
* which is used to create the DELETE statement
@ -1246,7 +1275,7 @@ abstract class BaseCcListenerCountPeer {
// 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 = new Criteria(CcListenerCountPeer::DATABASE_NAME);
$criteria->add(CcListenerCountPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
@ -1255,7 +1284,7 @@ abstract class BaseCcListenerCountPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@ -1267,8 +1296,9 @@ abstract class BaseCcListenerCountPeer {
$affectedRows += BasePeer::doDelete($criteria, $con);
CcListenerCountPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -1286,7 +1316,7 @@ abstract class BaseCcListenerCountPeer {
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(CcListenerCount $obj, $cols = null)
public static function doValidate($obj, $cols = null)
{
$columns = array();
@ -1299,7 +1329,7 @@ abstract class BaseCcListenerCountPeer {
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
@ -1342,6 +1372,7 @@ abstract class BaseCcListenerCountPeer {
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcListenerCount[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
@ -1359,6 +1390,7 @@ abstract class BaseCcListenerCountPeer {
$criteria->add(CcListenerCountPeer::ID, $pks, Criteria::IN);
$objs = CcListenerCountPeer::doSelect($criteria, $con);
}
return $objs;
}

View File

@ -20,18 +20,17 @@
* @method CcListenerCountQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcListenerCountQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcListenerCountQuery leftJoinCcTimestamp($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcTimestamp relation
* @method CcListenerCountQuery rightJoinCcTimestamp($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcTimestamp relation
* @method CcListenerCountQuery innerJoinCcTimestamp($relationAlias = '') Adds a INNER JOIN clause to the query using the CcTimestamp relation
* @method CcListenerCountQuery leftJoinCcTimestamp($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcTimestamp relation
* @method CcListenerCountQuery rightJoinCcTimestamp($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcTimestamp relation
* @method CcListenerCountQuery innerJoinCcTimestamp($relationAlias = null) Adds a INNER JOIN clause to the query using the CcTimestamp relation
*
* @method CcListenerCountQuery leftJoinCcMountName($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcMountName relation
* @method CcListenerCountQuery rightJoinCcMountName($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcMountName relation
* @method CcListenerCountQuery innerJoinCcMountName($relationAlias = '') Adds a INNER JOIN clause to the query using the CcMountName relation
* @method CcListenerCountQuery leftJoinCcMountName($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcMountName relation
* @method CcListenerCountQuery rightJoinCcMountName($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcMountName relation
* @method CcListenerCountQuery innerJoinCcMountName($relationAlias = null) Adds a INNER JOIN clause to the query using the CcMountName relation
*
* @method CcListenerCount findOne(PropelPDO $con = null) Return the first CcListenerCount matching the query
* @method CcListenerCount findOneOrCreate(PropelPDO $con = null) Return the first CcListenerCount matching the query, or a new CcListenerCount object populated from the query conditions when no match is found
*
* @method CcListenerCount findOneByDbId(int $id) Return the first CcListenerCount filtered by the id column
* @method CcListenerCount findOneByDbTimestampId(int $timestamp_id) Return the first CcListenerCount filtered by the timestamp_id column
* @method CcListenerCount findOneByDbMountNameId(int $mount_name_id) Return the first CcListenerCount filtered by the mount_name_id column
* @method CcListenerCount findOneByDbListenerCount(int $listener_count) Return the first CcListenerCount filtered by the listener_count column
@ -45,7 +44,6 @@
*/
abstract class BaseCcListenerCountQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcListenerCountQuery object.
*
@ -53,8 +51,14 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
* @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 = 'CcListenerCount', $modelAlias = null)
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'airtime';
}
if (null === $modelName) {
$modelName = 'CcListenerCount';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
@ -62,7 +66,7 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
* Returns a new CcListenerCountQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
* @param CcListenerCountQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CcListenerCountQuery
*/
@ -71,41 +75,115 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
if ($criteria instanceof CcListenerCountQuery) {
return $criteria;
}
$query = new CcListenerCountQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
$query = new CcListenerCountQuery(null, null, $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
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <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 CcListenerCount|array|mixed the result, formatted by the current formatter
* @return CcListenerCount|CcListenerCount[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcListenerCountPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
if ($key === null) {
return null;
}
if ((null !== ($obj = CcListenerCountPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
// the object has not been requested yet, or the formatter is not an object formatter
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcListenerCount A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneByDbId($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcListenerCount A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "id", "timestamp_id", "mount_name_id", "listener_count" FROM "cc_listener_count" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CcListenerCount();
$obj->hydrate($row);
CcListenerCountPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcListenerCount|CcListenerCount[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
@ -115,14 +193,20 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
* @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
* @return PropelObjectCollection|CcListenerCount[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
$stmt = $criteria
->filterByPrimaryKeys($keys)
->find($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
@ -134,6 +218,7 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcListenerCountPeer::ID, $key, Criteria::EQUAL);
}
@ -146,31 +231,69 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcListenerCountPeer::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)
* Example usage:
* <code>
* $query->filterByDbId(1234); // WHERE id = 1234
* $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
* $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
* </code>
*
* @param mixed $dbId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcListenerCountQuery The current query, for fluid interface
*/
public function filterByDbId($dbId = null, $comparison = null)
{
if (is_array($dbId) && null === $comparison) {
if (is_array($dbId)) {
$useMinMax = false;
if (isset($dbId['min'])) {
$this->addUsingAlias(CcListenerCountPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbId['max'])) {
$this->addUsingAlias(CcListenerCountPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcListenerCountPeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the timestamp_id column
*
* @param int|array $dbTimestampId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbTimestampId(1234); // WHERE timestamp_id = 1234
* $query->filterByDbTimestampId(array(12, 34)); // WHERE timestamp_id IN (12, 34)
* $query->filterByDbTimestampId(array('min' => 12)); // WHERE timestamp_id >= 12
* $query->filterByDbTimestampId(array('max' => 12)); // WHERE timestamp_id <= 12
* </code>
*
* @see filterByCcTimestamp()
*
* @param mixed $dbTimestampId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcListenerCountQuery The current query, for fluid interface
@ -194,14 +317,27 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcListenerCountPeer::TIMESTAMP_ID, $dbTimestampId, $comparison);
}
/**
* Filter the query on the mount_name_id column
*
* @param int|array $dbMountNameId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbMountNameId(1234); // WHERE mount_name_id = 1234
* $query->filterByDbMountNameId(array(12, 34)); // WHERE mount_name_id IN (12, 34)
* $query->filterByDbMountNameId(array('min' => 12)); // WHERE mount_name_id >= 12
* $query->filterByDbMountNameId(array('max' => 12)); // WHERE mount_name_id <= 12
* </code>
*
* @see filterByCcMountName()
*
* @param mixed $dbMountNameId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcListenerCountQuery The current query, for fluid interface
@ -225,14 +361,25 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $dbMountNameId, $comparison);
}
/**
* Filter the query on the listener_count column
*
* @param int|array $dbListenerCount The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbListenerCount(1234); // WHERE listener_count = 1234
* $query->filterByDbListenerCount(array(12, 34)); // WHERE listener_count IN (12, 34)
* $query->filterByDbListenerCount(array('min' => 12)); // WHERE listener_count >= 12
* $query->filterByDbListenerCount(array('max' => 12)); // WHERE listener_count <= 12
* </code>
*
* @param mixed $dbListenerCount The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcListenerCountQuery The current query, for fluid interface
@ -256,21 +403,34 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcListenerCountPeer::LISTENER_COUNT, $dbListenerCount, $comparison);
}
/**
* Filter the query by a related CcTimestamp object
*
* @param CcTimestamp $ccTimestamp the related object to use as filter
* @param CcTimestamp|PropelObjectCollection $ccTimestamp The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcListenerCountQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcTimestamp($ccTimestamp, $comparison = null)
{
if ($ccTimestamp instanceof CcTimestamp) {
return $this
->addUsingAlias(CcListenerCountPeer::TIMESTAMP_ID, $ccTimestamp->getDbId(), $comparison);
} elseif ($ccTimestamp instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CcListenerCountPeer::TIMESTAMP_ID, $ccTimestamp->toKeyValue('PrimaryKey', 'DbId'), $comparison);
} else {
throw new PropelException('filterByCcTimestamp() only accepts arguments of type CcTimestamp or PropelCollection');
}
}
/**
@ -281,7 +441,7 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
*
* @return CcListenerCountQuery The current query, for fluid interface
*/
public function joinCcTimestamp($relationAlias = '', $joinType = Criteria::INNER_JOIN)
public function joinCcTimestamp($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcTimestamp');
@ -316,7 +476,7 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
*
* @return CcTimestampQuery A secondary query class using the current class as primary query
*/
public function useCcTimestampQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
public function useCcTimestampQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcTimestamp($relationAlias, $joinType)
@ -326,15 +486,27 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
/**
* Filter the query by a related CcMountName object
*
* @param CcMountName $ccMountName the related object to use as filter
* @param CcMountName|PropelObjectCollection $ccMountName The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcListenerCountQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcMountName($ccMountName, $comparison = null)
{
if ($ccMountName instanceof CcMountName) {
return $this
->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $ccMountName->getDbId(), $comparison);
} elseif ($ccMountName instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $ccMountName->toKeyValue('PrimaryKey', 'DbId'), $comparison);
} else {
throw new PropelException('filterByCcMountName() only accepts arguments of type CcMountName or PropelCollection');
}
}
/**
@ -345,7 +517,7 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
*
* @return CcListenerCountQuery The current query, for fluid interface
*/
public function joinCcMountName($relationAlias = '', $joinType = Criteria::INNER_JOIN)
public function joinCcMountName($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcMountName');
@ -380,7 +552,7 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
*
* @return CcMountNameQuery A secondary query class using the current class as primary query
*/
public function useCcMountNameQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
public function useCcMountNameQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcMountName($relationAlias, $joinType)
@ -403,4 +575,4 @@ abstract class BaseCcListenerCountQuery extends ModelCriteria
return $this;
}
} // BaseCcListenerCountQuery
}

View File

@ -10,7 +10,6 @@
*/
abstract class BaseCcLiveLog extends BaseObject implements Persistent
{
/**
* Peer class name
*/
@ -24,6 +23,12 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
*/
protected static $peer;
/**
* The flag var to prevent infinite loop in deep copy
* @var boolean
*/
protected $startCopy = false;
/**
* The value for the id field.
* @var int
@ -62,6 +67,12 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
/**
* Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
* @var boolean
*/
protected $alreadyInClearAllReferencesDeep = false;
/**
* Get the [id] column value.
*
@ -69,6 +80,7 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
*/
public function getDbId()
{
return $this->id;
}
@ -79,6 +91,7 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
*/
public function getDbState()
{
return $this->state;
}
@ -87,8 +100,8 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* If format is null, then the raw DateTime object will be returned.
* @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getDbStartTime($format = 'Y-m-d H:i:s')
@ -98,7 +111,6 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
}
try {
$dt = new DateTime($this->start_time);
} catch (Exception $x) {
@ -106,13 +118,16 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
// Because propel.useDateTimeClass is true, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
if (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
}
return $dt->format($format);
}
/**
@ -120,8 +135,8 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* If format is null, then the raw DateTime object will be returned.
* @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getDbEndTime($format = 'Y-m-d H:i:s')
@ -131,7 +146,6 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
}
try {
$dt = new DateTime($this->end_time);
} catch (Exception $x) {
@ -139,13 +153,16 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
// Because propel.useDateTimeClass is true, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
if (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
}
return $dt->format($format);
}
/**
@ -156,7 +173,7 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
*/
public function setDbId($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -165,6 +182,7 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
$this->modifiedColumns[] = CcLiveLogPeer::ID;
}
return $this;
} // setDbId()
@ -176,7 +194,7 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
*/
public function setDbState($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -185,104 +203,53 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
$this->modifiedColumns[] = CcLiveLogPeer::STATE;
}
return $this;
} // setDbState()
/**
* Sets the value of [start_time] column to a normalized version of the date/time value specified.
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @param mixed $v string, integer (timestamp), or DateTime value.
* Empty strings are treated as null.
* @return CcLiveLog The current object (for fluent API support)
*/
public function setDbStartTime($v)
{
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
// -- which is unexpected, to say the least.
if ($v === null || $v === '') {
$dt = null;
} elseif ($v instanceof DateTime) {
$dt = $v;
} else {
// some string/numeric value passed; we normalize that so that we can
// validate it.
try {
if (is_numeric($v)) { // if it's a unix timestamp
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
// We have to explicitly specify and then change the time zone because of a
// DateTime bug: http://bugs.php.net/bug.php?id=43003
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
} else {
$dt = new DateTime($v);
}
} catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
}
$dt = PropelDateTime::newInstance($v, null, 'DateTime');
if ($this->start_time !== null || $dt !== null) {
// (nested ifs are a little easier to read in this case)
$currNorm = ($this->start_time !== null && $tmpDt = new DateTime($this->start_time)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null;
$newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
)
{
$this->start_time = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
$currentDateAsString = ($this->start_time !== null && $tmpDt = new DateTime($this->start_time)) ? $tmpDt->format('Y-m-d H:i:s') : null;
$newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
if ($currentDateAsString !== $newDateAsString) {
$this->start_time = $newDateAsString;
$this->modifiedColumns[] = CcLiveLogPeer::START_TIME;
}
} // if either are not null
return $this;
} // setDbStartTime()
/**
* Sets the value of [end_time] column to a normalized version of the date/time value specified.
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @param mixed $v string, integer (timestamp), or DateTime value.
* Empty strings are treated as null.
* @return CcLiveLog The current object (for fluent API support)
*/
public function setDbEndTime($v)
{
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
// -- which is unexpected, to say the least.
if ($v === null || $v === '') {
$dt = null;
} elseif ($v instanceof DateTime) {
$dt = $v;
} else {
// some string/numeric value passed; we normalize that so that we can
// validate it.
try {
if (is_numeric($v)) { // if it's a unix timestamp
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
// We have to explicitly specify and then change the time zone because of a
// DateTime bug: http://bugs.php.net/bug.php?id=43003
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
} else {
$dt = new DateTime($v);
}
} catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
}
$dt = PropelDateTime::newInstance($v, null, 'DateTime');
if ($this->end_time !== null || $dt !== null) {
// (nested ifs are a little easier to read in this case)
$currNorm = ($this->end_time !== null && $tmpDt = new DateTime($this->end_time)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null;
$newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
)
{
$this->end_time = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
$currentDateAsString = ($this->end_time !== null && $tmpDt = new DateTime($this->end_time)) ? $tmpDt->format('Y-m-d H:i:s') : null;
$newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
if ($currentDateAsString !== $newDateAsString) {
$this->end_time = $newDateAsString;
$this->modifiedColumns[] = CcLiveLogPeer::END_TIME;
}
} // if either are not null
return $this;
} // setDbEndTime()
@ -296,7 +263,7 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
*/
public function hasOnlyDefaultValues()
{
// otherwise, everything was equal, so return TRUE
// otherwise, everything was equal, so return true
return true;
} // hasOnlyDefaultValues()
@ -309,7 +276,7 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
* 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 int $startcol 0-based offset column which indicates which resultset 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.
@ -329,8 +296,9 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
if ($rehydrate) {
$this->ensureConsistency();
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 4; // 4 = CcLiveLogPeer::NUM_COLUMNS - CcLiveLogPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 4; // 4 = CcLiveLogPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating CcLiveLog object", $e);
@ -401,6 +369,7 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
* @param PropelPDO $con
* @return void
* @throws PropelException
* @throws Exception
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
@ -416,18 +385,18 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
$con->beginTransaction();
try {
$deleteQuery = CcLiveLogQuery::create()
->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con);
if ($ret) {
CcLiveLogQuery::create()
->filterByPrimaryKey($this->getPrimaryKey())
->delete($con);
$deleteQuery->delete($con);
$this->postDelete($con);
$con->commit();
$this->setDeleted(true);
} else {
$con->commit();
}
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -444,6 +413,7 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @throws Exception
* @see doSave()
*/
public function save(PropelPDO $con = null)
@ -478,8 +448,9 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
$affectedRows = 0;
}
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -502,35 +473,113 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->modifiedColumns[] = CcLiveLogPeer::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(CcLiveLogPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcLiveLogPeer::ID.')');
}
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows = 1;
$this->setDbId($pk); //[IMV] update autoincrement primary key
$this->setNew(false);
$this->doInsert($con);
} else {
$affectedRows = CcLiveLogPeer::doUpdate($this, $con);
$this->doUpdate($con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
$affectedRows += 1;
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Insert the row in the database.
*
* @param PropelPDO $con
*
* @throws PropelException
* @see doSave()
*/
protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = CcLiveLogPeer::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcLiveLogPeer::ID . ')');
}
if (null === $this->id) {
try {
$stmt = $con->query("SELECT nextval('cc_live_log_id_seq')");
$row = $stmt->fetch(PDO::FETCH_NUM);
$this->id = $row[0];
} catch (Exception $e) {
throw new PropelException('Unable to get sequence id.', $e);
}
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(CcLiveLogPeer::ID)) {
$modifiedColumns[':p' . $index++] = '"id"';
}
if ($this->isColumnModified(CcLiveLogPeer::STATE)) {
$modifiedColumns[':p' . $index++] = '"state"';
}
if ($this->isColumnModified(CcLiveLogPeer::START_TIME)) {
$modifiedColumns[':p' . $index++] = '"start_time"';
}
if ($this->isColumnModified(CcLiveLogPeer::END_TIME)) {
$modifiedColumns[':p' . $index++] = '"end_time"';
}
$sql = sprintf(
'INSERT INTO "cc_live_log" (%s) VALUES (%s)',
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case '"id"':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case '"state"':
$stmt->bindValue($identifier, $this->state, PDO::PARAM_STR);
break;
case '"start_time"':
$stmt->bindValue($identifier, $this->start_time, PDO::PARAM_STR);
break;
case '"end_time"':
$stmt->bindValue($identifier, $this->end_time, PDO::PARAM_STR);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
}
$this->setNew(false);
}
/**
* Update the row in the database.
*
* @param PropelPDO $con
*
* @see doSave()
*/
protected function doUpdate(PropelPDO $con)
{
$selectCriteria = $this->buildPkeyCriteria();
$valuesCriteria = $this->buildCriteria();
BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
}
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
@ -565,11 +614,13 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
$this->validationFailures = $res;
return false;
}
/**
@ -577,10 +628,10 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
*
* 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.
* an aggregated 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.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
@ -609,13 +660,15 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcLiveLogPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
$field = $this->getByPosition($pos);
return $field;
}
@ -656,12 +709,17 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
* @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 $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
*
* @return array an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
{
if (isset($alreadyDumpedObjects['CcLiveLog'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['CcLiveLog'][$this->getPrimaryKey()] = true;
$keys = CcLiveLogPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getDbId(),
@ -669,6 +727,12 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
$keys[2] => $this->getDbStartTime(),
$keys[3] => $this->getDbEndTime(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
$result[$key] = $virtualColumn;
}
return $result;
}
@ -679,13 +743,15 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcLiveLogPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
$this->setByPosition($pos, $value);
}
/**
@ -725,7 +791,7 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
* 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')
* The default key type is the column's BasePeer::TYPE_PHPNAME
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
@ -800,6 +866,7 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
*/
public function isPrimaryKeyNull()
{
return null === $this->getDbId();
}
@ -811,17 +878,19 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
*
* @param object $copyObj An object of CcLiveLog (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setDbState($this->state);
$copyObj->setDbStartTime($this->start_time);
$copyObj->setDbEndTime($this->end_time);
$copyObj->setDbState($this->getDbState());
$copyObj->setDbStartTime($this->getDbStartTime());
$copyObj->setDbEndTime($this->getDbEndTime());
if ($makeNew) {
$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.
@ -841,6 +910,7 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
@ -858,6 +928,7 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
if (self::$peer === null) {
self::$peer = new CcLiveLogPeer();
}
return self::$peer;
}
@ -872,6 +943,7 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
$this->end_time = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;
$this->clearAllReferences();
$this->resetModified();
$this->setNew(true);
@ -879,38 +951,42 @@ abstract class BaseCcLiveLog extends BaseObject implements Persistent
}
/**
* Resets all collections of referencing foreign keys.
* Resets all references to other model objects or collections of model objects.
*
* 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.
* This method is a user-space workaround for PHP's inability to garbage collect
* objects with circular references (even in PHP 5.3). This is currently necessary
* when using Propel in certain daemon or large-volume/high-memory operations.
*
* @param boolean $deep Whether to also clear the references on all associated objects.
* @param boolean $deep Whether to also clear the references on all referrer objects.
*/
public function clearAllReferences($deep = false)
{
if ($deep) {
if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true;
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
}
/**
* Catches calls to virtual methods
* return the string representation of this object
*
* @return string
*/
public function __call($name, $params)
public function __toString()
{
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);
return (string) $this->exportTo(CcLiveLogPeer::DEFAULT_STRING_FORMAT);
}
} // BaseCcLiveLog
/**
* return true is the object is in saving state
*
* @return boolean
*/
public function isAlreadyInSave()
{
return $this->alreadyInSave;
}
}

View File

@ -8,7 +8,8 @@
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcLiveLogPeer {
abstract class BaseCcLiveLogPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
@ -19,9 +20,6 @@ abstract class BaseCcLiveLogPeer {
/** the related Propel class for this table */
const OM_CLASS = 'CcLiveLog';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcLiveLog';
/** the related TableMap class for this table */
const TM_CLASS = 'CcLiveLogTableMap';
@ -31,20 +29,26 @@ abstract class BaseCcLiveLogPeer {
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_live_log.ID';
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 4;
/** the column name for the STATE field */
const STATE = 'cc_live_log.STATE';
/** the column name for the id field */
const ID = 'cc_live_log.id';
/** the column name for the START_TIME field */
const START_TIME = 'cc_live_log.START_TIME';
/** the column name for the state field */
const STATE = 'cc_live_log.state';
/** the column name for the END_TIME field */
const END_TIME = 'cc_live_log.END_TIME';
/** the column name for the start_time field */
const START_TIME = 'cc_live_log.start_time';
/** the column name for the end_time field */
const END_TIME = 'cc_live_log.end_time';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CcLiveLog objects.
* An identity map to hold any loaded instances of CcLiveLog objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcLiveLog[]
@ -56,12 +60,12 @@ abstract class BaseCcLiveLogPeer {
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
* e.g. CcLiveLogPeer::$fieldNames[CcLiveLogPeer::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbState', 'DbStartTime', 'DbEndTime', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbState', 'dbStartTime', 'dbEndTime', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::STATE, self::START_TIME, self::END_TIME, ),
BasePeer::TYPE_COLNAME => array (CcLiveLogPeer::ID, CcLiveLogPeer::STATE, CcLiveLogPeer::START_TIME, CcLiveLogPeer::END_TIME, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STATE', 'START_TIME', 'END_TIME', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'state', 'start_time', 'end_time', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
@ -71,12 +75,12 @@ abstract class BaseCcLiveLogPeer {
* 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
* e.g. CcLiveLogPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbState' => 1, 'DbStartTime' => 2, 'DbEndTime' => 3, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbState' => 1, 'dbStartTime' => 2, 'dbEndTime' => 3, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STATE => 1, self::START_TIME => 2, self::END_TIME => 3, ),
BasePeer::TYPE_COLNAME => array (CcLiveLogPeer::ID => 0, CcLiveLogPeer::STATE => 1, CcLiveLogPeer::START_TIME => 2, CcLiveLogPeer::END_TIME => 3, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STATE' => 1, 'START_TIME' => 2, 'END_TIME' => 3, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'state' => 1, 'start_time' => 2, 'end_time' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
@ -92,13 +96,14 @@ abstract class BaseCcLiveLogPeer {
* @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)
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = CcLiveLogPeer::getFieldNames($toType);
$key = isset(CcLiveLogPeer::$fieldKeys[$fromType][$name]) ? CcLiveLogPeer::$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));
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcLiveLogPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@ -109,14 +114,15 @@ abstract class BaseCcLiveLogPeer {
* 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
* @throws PropelException - if the type is not valid.
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
if (!array_key_exists($type, CcLiveLogPeer::$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];
return CcLiveLogPeer::$fieldNames[$type];
}
/**
@ -156,10 +162,10 @@ abstract class BaseCcLiveLogPeer {
$criteria->addSelectColumn(CcLiveLogPeer::START_TIME);
$criteria->addSelectColumn(CcLiveLogPeer::END_TIME);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.STATE');
$criteria->addSelectColumn($alias . '.START_TIME');
$criteria->addSelectColumn($alias . '.END_TIME');
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.state');
$criteria->addSelectColumn($alias . '.start_time');
$criteria->addSelectColumn($alias . '.end_time');
}
}
@ -190,7 +196,7 @@ abstract class BaseCcLiveLogPeer {
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
$criteria->setDbName(CcLiveLogPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -204,10 +210,11 @@ abstract class BaseCcLiveLogPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
@ -223,10 +230,11 @@ abstract class BaseCcLiveLogPeer {
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
@ -241,7 +249,7 @@ abstract class BaseCcLiveLogPeer {
/**
* 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
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
@ -263,7 +271,7 @@ abstract class BaseCcLiveLogPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcLiveLogPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
@ -277,16 +285,16 @@ abstract class BaseCcLiveLogPeer {
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcLiveLog $value A CcLiveLog object.
* @param CcLiveLog $obj A CcLiveLog object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcLiveLog $obj, $key = null)
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getDbId();
} // if key === null
self::$instances[$key] = $obj;
CcLiveLogPeer::$instances[$key] = $obj;
}
}
@ -299,6 +307,9 @@ abstract class BaseCcLiveLogPeer {
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcLiveLog object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
@ -313,7 +324,7 @@ abstract class BaseCcLiveLogPeer {
throw $e;
}
unset(self::$instances[$key]);
unset(CcLiveLogPeer::$instances[$key]);
}
} // removeInstanceFromPool()
@ -324,16 +335,17 @@ abstract class BaseCcLiveLogPeer {
* 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 CcLiveLog Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @return CcLiveLog 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];
if (isset(CcLiveLogPeer::$instances[$key])) {
return CcLiveLogPeer::$instances[$key];
}
}
return null; // just to be explicit
}
@ -342,9 +354,14 @@ abstract class BaseCcLiveLogPeer {
*
* @return void
*/
public static function clearInstancePool()
public static function clearInstancePool($and_clear_all_references = false)
{
self::$instances = array();
if ($and_clear_all_references) {
foreach (CcLiveLogPeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcLiveLogPeer::$instances = array();
}
/**
@ -363,14 +380,15 @@ abstract class BaseCcLiveLogPeer {
*
* @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.
* @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 the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
@ -385,6 +403,7 @@ abstract class BaseCcLiveLogPeer {
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
@ -400,7 +419,7 @@ abstract class BaseCcLiveLogPeer {
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcLiveLogPeer::getOMClass(false);
$cls = CcLiveLogPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcLiveLogPeer::getPrimaryKeyHashFromRow($row, 0);
@ -417,6 +436,7 @@ abstract class BaseCcLiveLogPeer {
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
@ -435,15 +455,17 @@ abstract class BaseCcLiveLogPeer {
// 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 + CcLiveLogPeer::NUM_COLUMNS;
$col = $startcol + CcLiveLogPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CcLiveLogPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcLiveLogPeer::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.
@ -453,7 +475,7 @@ abstract class BaseCcLiveLogPeer {
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
return Propel::getDatabaseMap(CcLiveLogPeer::DATABASE_NAME)->getTable(CcLiveLogPeer::TABLE_NAME);
}
/**
@ -462,30 +484,24 @@ abstract class BaseCcLiveLogPeer {
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcLiveLogPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcLiveLogPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcLiveLogTableMap());
if (!$dbMap->hasTable(BaseCcLiveLogPeer::TABLE_NAME)) {
$dbMap->addTableObject(new \CcLiveLogTableMap());
}
}
/**
* 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
* @return string ClassName
*/
public static function getOMClass($withPrefix = true)
public static function getOMClass($row = 0, $colnum = 0)
{
return $withPrefix ? CcLiveLogPeer::CLASS_DEFAULT : CcLiveLogPeer::OM_CLASS;
return CcLiveLogPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcLiveLog or Criteria object.
* Performs an INSERT on the database, given a CcLiveLog or Criteria object.
*
* @param mixed $values Criteria or CcLiveLog object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
@ -511,7 +527,7 @@ abstract class BaseCcLiveLogPeer {
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcLiveLogPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
@ -519,7 +535,7 @@ abstract class BaseCcLiveLogPeer {
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -528,7 +544,7 @@ abstract class BaseCcLiveLogPeer {
}
/**
* Method perform an UPDATE on the database, given a CcLiveLog or Criteria object.
* Performs an UPDATE on the database, given a CcLiveLog or Criteria object.
*
* @param mixed $values Criteria or CcLiveLog 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).
@ -542,7 +558,7 @@ abstract class BaseCcLiveLogPeer {
$con = Propel::getConnection(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
$selectCriteria = new Criteria(CcLiveLogPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
@ -561,17 +577,19 @@ abstract class BaseCcLiveLogPeer {
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcLiveLogPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_live_log table.
* Deletes all rows from the cc_live_log table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll($con = null)
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
@ -588,15 +606,16 @@ abstract class BaseCcLiveLogPeer {
CcLiveLogPeer::clearInstancePool();
CcLiveLogPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcLiveLog or Criteria object OR a primary key value.
* Performs a DELETE on the database, given a CcLiveLog or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcLiveLog object or primary key or array of primary keys
* which is used to create the DELETE statement
@ -625,7 +644,7 @@ abstract class BaseCcLiveLogPeer {
// 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 = new Criteria(CcLiveLogPeer::DATABASE_NAME);
$criteria->add(CcLiveLogPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
@ -634,7 +653,7 @@ abstract class BaseCcLiveLogPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcLiveLogPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@ -646,8 +665,9 @@ abstract class BaseCcLiveLogPeer {
$affectedRows += BasePeer::doDelete($criteria, $con);
CcLiveLogPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -665,7 +685,7 @@ abstract class BaseCcLiveLogPeer {
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(CcLiveLog $obj, $cols = null)
public static function doValidate($obj, $cols = null)
{
$columns = array();
@ -678,7 +698,7 @@ abstract class BaseCcLiveLogPeer {
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
@ -721,6 +741,7 @@ abstract class BaseCcLiveLogPeer {
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcLiveLog[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
@ -738,6 +759,7 @@ abstract class BaseCcLiveLogPeer {
$criteria->add(CcLiveLogPeer::ID, $pks, Criteria::IN);
$objs = CcLiveLogPeer::doSelect($criteria, $con);
}
return $objs;
}

View File

@ -23,7 +23,6 @@
* @method CcLiveLog findOne(PropelPDO $con = null) Return the first CcLiveLog matching the query
* @method CcLiveLog findOneOrCreate(PropelPDO $con = null) Return the first CcLiveLog matching the query, or a new CcLiveLog object populated from the query conditions when no match is found
*
* @method CcLiveLog findOneByDbId(int $id) Return the first CcLiveLog filtered by the id column
* @method CcLiveLog findOneByDbState(string $state) Return the first CcLiveLog filtered by the state column
* @method CcLiveLog findOneByDbStartTime(string $start_time) Return the first CcLiveLog filtered by the start_time column
* @method CcLiveLog findOneByDbEndTime(string $end_time) Return the first CcLiveLog filtered by the end_time column
@ -37,7 +36,6 @@
*/
abstract class BaseCcLiveLogQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcLiveLogQuery object.
*
@ -45,8 +43,14 @@ abstract class BaseCcLiveLogQuery extends ModelCriteria
* @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 = 'CcLiveLog', $modelAlias = null)
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'airtime';
}
if (null === $modelName) {
$modelName = 'CcLiveLog';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
@ -54,7 +58,7 @@ abstract class BaseCcLiveLogQuery extends ModelCriteria
* Returns a new CcLiveLogQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
* @param CcLiveLogQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CcLiveLogQuery
*/
@ -63,41 +67,115 @@ abstract class BaseCcLiveLogQuery extends ModelCriteria
if ($criteria instanceof CcLiveLogQuery) {
return $criteria;
}
$query = new CcLiveLogQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
$query = new CcLiveLogQuery(null, null, $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
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <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 CcLiveLog|array|mixed the result, formatted by the current formatter
* @return CcLiveLog|CcLiveLog[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcLiveLogPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
if ($key === null) {
return null;
}
if ((null !== ($obj = CcLiveLogPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
// the object has not been requested yet, or the formatter is not an object formatter
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcLiveLog A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneByDbId($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcLiveLog A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "id", "state", "start_time", "end_time" FROM "cc_live_log" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CcLiveLog();
$obj->hydrate($row);
CcLiveLogPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcLiveLog|CcLiveLog[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
@ -107,14 +185,20 @@ abstract class BaseCcLiveLogQuery extends ModelCriteria
* @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
* @return PropelObjectCollection|CcLiveLog[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
$stmt = $criteria
->filterByPrimaryKeys($keys)
->find($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
@ -126,6 +210,7 @@ abstract class BaseCcLiveLogQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcLiveLogPeer::ID, $key, Criteria::EQUAL);
}
@ -138,29 +223,61 @@ abstract class BaseCcLiveLogQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcLiveLogPeer::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)
* Example usage:
* <code>
* $query->filterByDbId(1234); // WHERE id = 1234
* $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
* $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
* </code>
*
* @param mixed $dbId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcLiveLogQuery The current query, for fluid interface
*/
public function filterByDbId($dbId = null, $comparison = null)
{
if (is_array($dbId) && null === $comparison) {
if (is_array($dbId)) {
$useMinMax = false;
if (isset($dbId['min'])) {
$this->addUsingAlias(CcLiveLogPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbId['max'])) {
$this->addUsingAlias(CcLiveLogPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcLiveLogPeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the state column
*
* Example usage:
* <code>
* $query->filterByDbState('fooValue'); // WHERE state = 'fooValue'
* $query->filterByDbState('%fooValue%'); // WHERE state LIKE '%fooValue%'
* </code>
*
* @param string $dbState 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
@ -177,14 +294,26 @@ abstract class BaseCcLiveLogQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcLiveLogPeer::STATE, $dbState, $comparison);
}
/**
* Filter the query on the start_time column
*
* @param string|array $dbStartTime The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbStartTime('2011-03-14'); // WHERE start_time = '2011-03-14'
* $query->filterByDbStartTime('now'); // WHERE start_time = '2011-03-14'
* $query->filterByDbStartTime(array('max' => 'yesterday')); // WHERE start_time < '2011-03-13'
* </code>
*
* @param mixed $dbStartTime The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcLiveLogQuery The current query, for fluid interface
@ -208,14 +337,26 @@ abstract class BaseCcLiveLogQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcLiveLogPeer::START_TIME, $dbStartTime, $comparison);
}
/**
* Filter the query on the end_time column
*
* @param string|array $dbEndTime The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbEndTime('2011-03-14'); // WHERE end_time = '2011-03-14'
* $query->filterByDbEndTime('now'); // WHERE end_time = '2011-03-14'
* $query->filterByDbEndTime(array('max' => 'yesterday')); // WHERE end_time < '2011-03-13'
* </code>
*
* @param mixed $dbEndTime The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcLiveLogQuery The current query, for fluid interface
@ -239,6 +380,7 @@ abstract class BaseCcLiveLogQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcLiveLogPeer::END_TIME, $dbEndTime, $comparison);
}
@ -258,4 +400,4 @@ abstract class BaseCcLiveLogQuery extends ModelCriteria
return $this;
}
} // BaseCcLiveLogQuery
}

View File

@ -10,7 +10,6 @@
*/
abstract class BaseCcLocale extends BaseObject implements Persistent
{
/**
* Peer class name
*/
@ -24,6 +23,12 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
*/
protected static $peer;
/**
* The flag var to prevent infinite loop in deep copy
* @var boolean
*/
protected $startCopy = false;
/**
* The value for the id field.
* @var int
@ -56,6 +61,12 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
/**
* Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
* @var boolean
*/
protected $alreadyInClearAllReferencesDeep = false;
/**
* Get the [id] column value.
*
@ -63,6 +74,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
*/
public function getDbId()
{
return $this->id;
}
@ -73,6 +85,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
*/
public function getDbLocaleCode()
{
return $this->locale_code;
}
@ -83,6 +96,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
*/
public function getDbLocaleLang()
{
return $this->locale_lang;
}
@ -94,7 +108,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
*/
public function setDbId($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -103,6 +117,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
$this->modifiedColumns[] = CcLocalePeer::ID;
}
return $this;
} // setDbId()
@ -114,7 +129,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
*/
public function setDbLocaleCode($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -123,6 +138,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
$this->modifiedColumns[] = CcLocalePeer::LOCALE_CODE;
}
return $this;
} // setDbLocaleCode()
@ -134,7 +150,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
*/
public function setDbLocaleLang($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -143,6 +159,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
$this->modifiedColumns[] = CcLocalePeer::LOCALE_LANG;
}
return $this;
} // setDbLocaleLang()
@ -156,7 +173,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
*/
public function hasOnlyDefaultValues()
{
// otherwise, everything was equal, so return TRUE
// otherwise, everything was equal, so return true
return true;
} // hasOnlyDefaultValues()
@ -169,7 +186,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
* 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 int $startcol 0-based offset column which indicates which resultset 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.
@ -188,8 +205,9 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
if ($rehydrate) {
$this->ensureConsistency();
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 3; // 3 = CcLocalePeer::NUM_COLUMNS - CcLocalePeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 3; // 3 = CcLocalePeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating CcLocale object", $e);
@ -260,6 +278,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
* @param PropelPDO $con
* @return void
* @throws PropelException
* @throws Exception
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
@ -275,18 +294,18 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
$con->beginTransaction();
try {
$deleteQuery = CcLocaleQuery::create()
->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con);
if ($ret) {
CcLocaleQuery::create()
->filterByPrimaryKey($this->getPrimaryKey())
->delete($con);
$deleteQuery->delete($con);
$this->postDelete($con);
$con->commit();
$this->setDeleted(true);
} else {
$con->commit();
}
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -303,6 +322,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @throws Exception
* @see doSave()
*/
public function save(PropelPDO $con = null)
@ -337,8 +357,9 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
$affectedRows = 0;
}
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -361,35 +382,107 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->modifiedColumns[] = CcLocalePeer::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(CcLocalePeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcLocalePeer::ID.')');
}
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows = 1;
$this->setDbId($pk); //[IMV] update autoincrement primary key
$this->setNew(false);
$this->doInsert($con);
} else {
$affectedRows = CcLocalePeer::doUpdate($this, $con);
$this->doUpdate($con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
$affectedRows += 1;
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Insert the row in the database.
*
* @param PropelPDO $con
*
* @throws PropelException
* @see doSave()
*/
protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = CcLocalePeer::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcLocalePeer::ID . ')');
}
if (null === $this->id) {
try {
$stmt = $con->query("SELECT nextval('cc_locale_id_seq')");
$row = $stmt->fetch(PDO::FETCH_NUM);
$this->id = $row[0];
} catch (Exception $e) {
throw new PropelException('Unable to get sequence id.', $e);
}
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(CcLocalePeer::ID)) {
$modifiedColumns[':p' . $index++] = '"id"';
}
if ($this->isColumnModified(CcLocalePeer::LOCALE_CODE)) {
$modifiedColumns[':p' . $index++] = '"locale_code"';
}
if ($this->isColumnModified(CcLocalePeer::LOCALE_LANG)) {
$modifiedColumns[':p' . $index++] = '"locale_lang"';
}
$sql = sprintf(
'INSERT INTO "cc_locale" (%s) VALUES (%s)',
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case '"id"':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case '"locale_code"':
$stmt->bindValue($identifier, $this->locale_code, PDO::PARAM_STR);
break;
case '"locale_lang"':
$stmt->bindValue($identifier, $this->locale_lang, PDO::PARAM_STR);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
}
$this->setNew(false);
}
/**
* Update the row in the database.
*
* @param PropelPDO $con
*
* @see doSave()
*/
protected function doUpdate(PropelPDO $con)
{
$selectCriteria = $this->buildPkeyCriteria();
$valuesCriteria = $this->buildCriteria();
BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
}
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
@ -424,11 +517,13 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
$this->validationFailures = $res;
return false;
}
/**
@ -436,10 +531,10 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
*
* 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.
* an aggregated 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.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
@ -468,13 +563,15 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcLocalePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
$field = $this->getByPosition($pos);
return $field;
}
@ -512,18 +609,29 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
* @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 $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
*
* @return array an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
{
if (isset($alreadyDumpedObjects['CcLocale'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['CcLocale'][$this->getPrimaryKey()] = true;
$keys = CcLocalePeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getDbId(),
$keys[1] => $this->getDbLocaleCode(),
$keys[2] => $this->getDbLocaleLang(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
$result[$key] = $virtualColumn;
}
return $result;
}
@ -534,13 +642,15 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcLocalePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
$this->setByPosition($pos, $value);
}
/**
@ -577,7 +687,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
* 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')
* The default key type is the column's BasePeer::TYPE_PHPNAME
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
@ -650,6 +760,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
*/
public function isPrimaryKeyNull()
{
return null === $this->getDbId();
}
@ -661,16 +772,18 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
*
* @param object $copyObj An object of CcLocale (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setDbLocaleCode($this->locale_code);
$copyObj->setDbLocaleLang($this->locale_lang);
$copyObj->setDbLocaleCode($this->getDbLocaleCode());
$copyObj->setDbLocaleLang($this->getDbLocaleLang());
if ($makeNew) {
$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.
@ -690,6 +803,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
@ -707,6 +821,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
if (self::$peer === null) {
self::$peer = new CcLocalePeer();
}
return self::$peer;
}
@ -720,6 +835,7 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
$this->locale_lang = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;
$this->clearAllReferences();
$this->resetModified();
$this->setNew(true);
@ -727,38 +843,42 @@ abstract class BaseCcLocale extends BaseObject implements Persistent
}
/**
* Resets all collections of referencing foreign keys.
* Resets all references to other model objects or collections of model objects.
*
* 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.
* This method is a user-space workaround for PHP's inability to garbage collect
* objects with circular references (even in PHP 5.3). This is currently necessary
* when using Propel in certain daemon or large-volume/high-memory operations.
*
* @param boolean $deep Whether to also clear the references on all associated objects.
* @param boolean $deep Whether to also clear the references on all referrer objects.
*/
public function clearAllReferences($deep = false)
{
if ($deep) {
if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true;
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
}
/**
* Catches calls to virtual methods
* return the string representation of this object
*
* @return string
*/
public function __call($name, $params)
public function __toString()
{
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);
return (string) $this->exportTo(CcLocalePeer::DEFAULT_STRING_FORMAT);
}
} // BaseCcLocale
/**
* return true is the object is in saving state
*
* @return boolean
*/
public function isAlreadyInSave()
{
return $this->alreadyInSave;
}
}

View File

@ -8,7 +8,8 @@
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcLocalePeer {
abstract class BaseCcLocalePeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
@ -19,9 +20,6 @@ abstract class BaseCcLocalePeer {
/** the related Propel class for this table */
const OM_CLASS = 'CcLocale';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcLocale';
/** the related TableMap class for this table */
const TM_CLASS = 'CcLocaleTableMap';
@ -31,17 +29,23 @@ abstract class BaseCcLocalePeer {
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_locale.ID';
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 3;
/** the column name for the LOCALE_CODE field */
const LOCALE_CODE = 'cc_locale.LOCALE_CODE';
/** the column name for the id field */
const ID = 'cc_locale.id';
/** the column name for the LOCALE_LANG field */
const LOCALE_LANG = 'cc_locale.LOCALE_LANG';
/** the column name for the locale_code field */
const LOCALE_CODE = 'cc_locale.locale_code';
/** the column name for the locale_lang field */
const LOCALE_LANG = 'cc_locale.locale_lang';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CcLocale objects.
* An identity map to hold any loaded instances of CcLocale objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcLocale[]
@ -53,12 +57,12 @@ abstract class BaseCcLocalePeer {
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
* e.g. CcLocalePeer::$fieldNames[CcLocalePeer::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbLocaleCode', 'DbLocaleLang', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbLocaleCode', 'dbLocaleLang', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::LOCALE_CODE, self::LOCALE_LANG, ),
BasePeer::TYPE_COLNAME => array (CcLocalePeer::ID, CcLocalePeer::LOCALE_CODE, CcLocalePeer::LOCALE_LANG, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE_CODE', 'LOCALE_LANG', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'locale_code', 'locale_lang', ),
BasePeer::TYPE_NUM => array (0, 1, 2, )
@ -68,12 +72,12 @@ abstract class BaseCcLocalePeer {
* 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
* e.g. CcLocalePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbLocaleCode' => 1, 'DbLocaleLang' => 2, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbLocaleCode' => 1, 'dbLocaleLang' => 2, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::LOCALE_CODE => 1, self::LOCALE_LANG => 2, ),
BasePeer::TYPE_COLNAME => array (CcLocalePeer::ID => 0, CcLocalePeer::LOCALE_CODE => 1, CcLocalePeer::LOCALE_LANG => 2, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE_CODE' => 1, 'LOCALE_LANG' => 2, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale_code' => 1, 'locale_lang' => 2, ),
BasePeer::TYPE_NUM => array (0, 1, 2, )
@ -89,13 +93,14 @@ abstract class BaseCcLocalePeer {
* @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)
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = CcLocalePeer::getFieldNames($toType);
$key = isset(CcLocalePeer::$fieldKeys[$fromType][$name]) ? CcLocalePeer::$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));
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcLocalePeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@ -106,14 +111,15 @@ abstract class BaseCcLocalePeer {
* 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
* @throws PropelException - if the type is not valid.
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
if (!array_key_exists($type, CcLocalePeer::$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];
return CcLocalePeer::$fieldNames[$type];
}
/**
@ -152,9 +158,9 @@ abstract class BaseCcLocalePeer {
$criteria->addSelectColumn(CcLocalePeer::LOCALE_CODE);
$criteria->addSelectColumn(CcLocalePeer::LOCALE_LANG);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.LOCALE_CODE');
$criteria->addSelectColumn($alias . '.LOCALE_LANG');
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.locale_code');
$criteria->addSelectColumn($alias . '.locale_lang');
}
}
@ -185,7 +191,7 @@ abstract class BaseCcLocalePeer {
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
$criteria->setDbName(CcLocalePeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -199,10 +205,11 @@ abstract class BaseCcLocalePeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
@ -218,10 +225,11 @@ abstract class BaseCcLocalePeer {
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
@ -236,7 +244,7 @@ abstract class BaseCcLocalePeer {
/**
* 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
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
@ -258,7 +266,7 @@ abstract class BaseCcLocalePeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcLocalePeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
@ -272,16 +280,16 @@ abstract class BaseCcLocalePeer {
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcLocale $value A CcLocale object.
* @param CcLocale $obj A CcLocale object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcLocale $obj, $key = null)
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getDbId();
} // if key === null
self::$instances[$key] = $obj;
CcLocalePeer::$instances[$key] = $obj;
}
}
@ -294,6 +302,9 @@ abstract class BaseCcLocalePeer {
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcLocale object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
@ -308,7 +319,7 @@ abstract class BaseCcLocalePeer {
throw $e;
}
unset(self::$instances[$key]);
unset(CcLocalePeer::$instances[$key]);
}
} // removeInstanceFromPool()
@ -319,16 +330,17 @@ abstract class BaseCcLocalePeer {
* 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 CcLocale Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @return CcLocale 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];
if (isset(CcLocalePeer::$instances[$key])) {
return CcLocalePeer::$instances[$key];
}
}
return null; // just to be explicit
}
@ -337,9 +349,14 @@ abstract class BaseCcLocalePeer {
*
* @return void
*/
public static function clearInstancePool()
public static function clearInstancePool($and_clear_all_references = false)
{
self::$instances = array();
if ($and_clear_all_references) {
foreach (CcLocalePeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcLocalePeer::$instances = array();
}
/**
@ -358,14 +375,15 @@ abstract class BaseCcLocalePeer {
*
* @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.
* @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 the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
@ -380,6 +398,7 @@ abstract class BaseCcLocalePeer {
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
@ -395,7 +414,7 @@ abstract class BaseCcLocalePeer {
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcLocalePeer::getOMClass(false);
$cls = CcLocalePeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcLocalePeer::getPrimaryKeyHashFromRow($row, 0);
@ -412,6 +431,7 @@ abstract class BaseCcLocalePeer {
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
@ -430,15 +450,17 @@ abstract class BaseCcLocalePeer {
// 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 + CcLocalePeer::NUM_COLUMNS;
$col = $startcol + CcLocalePeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CcLocalePeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcLocalePeer::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.
@ -448,7 +470,7 @@ abstract class BaseCcLocalePeer {
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
return Propel::getDatabaseMap(CcLocalePeer::DATABASE_NAME)->getTable(CcLocalePeer::TABLE_NAME);
}
/**
@ -457,30 +479,24 @@ abstract class BaseCcLocalePeer {
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcLocalePeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcLocalePeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcLocaleTableMap());
if (!$dbMap->hasTable(BaseCcLocalePeer::TABLE_NAME)) {
$dbMap->addTableObject(new \CcLocaleTableMap());
}
}
/**
* 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
* @return string ClassName
*/
public static function getOMClass($withPrefix = true)
public static function getOMClass($row = 0, $colnum = 0)
{
return $withPrefix ? CcLocalePeer::CLASS_DEFAULT : CcLocalePeer::OM_CLASS;
return CcLocalePeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcLocale or Criteria object.
* Performs an INSERT on the database, given a CcLocale or Criteria object.
*
* @param mixed $values Criteria or CcLocale object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
@ -506,7 +522,7 @@ abstract class BaseCcLocalePeer {
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcLocalePeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
@ -514,7 +530,7 @@ abstract class BaseCcLocalePeer {
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -523,7 +539,7 @@ abstract class BaseCcLocalePeer {
}
/**
* Method perform an UPDATE on the database, given a CcLocale or Criteria object.
* Performs an UPDATE on the database, given a CcLocale or Criteria object.
*
* @param mixed $values Criteria or CcLocale 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).
@ -537,7 +553,7 @@ abstract class BaseCcLocalePeer {
$con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
$selectCriteria = new Criteria(CcLocalePeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
@ -556,17 +572,19 @@ abstract class BaseCcLocalePeer {
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcLocalePeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_locale table.
* Deletes all rows from the cc_locale table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll($con = null)
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
@ -583,15 +601,16 @@ abstract class BaseCcLocalePeer {
CcLocalePeer::clearInstancePool();
CcLocalePeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcLocale or Criteria object OR a primary key value.
* Performs a DELETE on the database, given a CcLocale or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcLocale object or primary key or array of primary keys
* which is used to create the DELETE statement
@ -620,7 +639,7 @@ abstract class BaseCcLocalePeer {
// 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 = new Criteria(CcLocalePeer::DATABASE_NAME);
$criteria->add(CcLocalePeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
@ -629,7 +648,7 @@ abstract class BaseCcLocalePeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcLocalePeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@ -641,8 +660,9 @@ abstract class BaseCcLocalePeer {
$affectedRows += BasePeer::doDelete($criteria, $con);
CcLocalePeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -660,7 +680,7 @@ abstract class BaseCcLocalePeer {
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(CcLocale $obj, $cols = null)
public static function doValidate($obj, $cols = null)
{
$columns = array();
@ -673,7 +693,7 @@ abstract class BaseCcLocalePeer {
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
@ -716,6 +736,7 @@ abstract class BaseCcLocalePeer {
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcLocale[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
@ -733,6 +754,7 @@ abstract class BaseCcLocalePeer {
$criteria->add(CcLocalePeer::ID, $pks, Criteria::IN);
$objs = CcLocalePeer::doSelect($criteria, $con);
}
return $objs;
}

View File

@ -21,7 +21,6 @@
* @method CcLocale findOne(PropelPDO $con = null) Return the first CcLocale matching the query
* @method CcLocale findOneOrCreate(PropelPDO $con = null) Return the first CcLocale matching the query, or a new CcLocale object populated from the query conditions when no match is found
*
* @method CcLocale findOneByDbId(int $id) Return the first CcLocale filtered by the id column
* @method CcLocale findOneByDbLocaleCode(string $locale_code) Return the first CcLocale filtered by the locale_code column
* @method CcLocale findOneByDbLocaleLang(string $locale_lang) Return the first CcLocale filtered by the locale_lang column
*
@ -33,7 +32,6 @@
*/
abstract class BaseCcLocaleQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcLocaleQuery object.
*
@ -41,8 +39,14 @@ abstract class BaseCcLocaleQuery extends ModelCriteria
* @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 = 'CcLocale', $modelAlias = null)
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'airtime';
}
if (null === $modelName) {
$modelName = 'CcLocale';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
@ -50,7 +54,7 @@ abstract class BaseCcLocaleQuery extends ModelCriteria
* Returns a new CcLocaleQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
* @param CcLocaleQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CcLocaleQuery
*/
@ -59,41 +63,115 @@ abstract class BaseCcLocaleQuery extends ModelCriteria
if ($criteria instanceof CcLocaleQuery) {
return $criteria;
}
$query = new CcLocaleQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
$query = new CcLocaleQuery(null, null, $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
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <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 CcLocale|array|mixed the result, formatted by the current formatter
* @return CcLocale|CcLocale[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcLocalePeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
if ($key === null) {
return null;
}
if ((null !== ($obj = CcLocalePeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
// the object has not been requested yet, or the formatter is not an object formatter
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcLocale A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneByDbId($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcLocale A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "id", "locale_code", "locale_lang" FROM "cc_locale" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CcLocale();
$obj->hydrate($row);
CcLocalePeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcLocale|CcLocale[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
@ -103,14 +181,20 @@ abstract class BaseCcLocaleQuery extends ModelCriteria
* @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
* @return PropelObjectCollection|CcLocale[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
$stmt = $criteria
->filterByPrimaryKeys($keys)
->find($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
@ -122,6 +206,7 @@ abstract class BaseCcLocaleQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcLocalePeer::ID, $key, Criteria::EQUAL);
}
@ -134,29 +219,61 @@ abstract class BaseCcLocaleQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcLocalePeer::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)
* Example usage:
* <code>
* $query->filterByDbId(1234); // WHERE id = 1234
* $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
* $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
* </code>
*
* @param mixed $dbId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcLocaleQuery The current query, for fluid interface
*/
public function filterByDbId($dbId = null, $comparison = null)
{
if (is_array($dbId) && null === $comparison) {
if (is_array($dbId)) {
$useMinMax = false;
if (isset($dbId['min'])) {
$this->addUsingAlias(CcLocalePeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbId['max'])) {
$this->addUsingAlias(CcLocalePeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcLocalePeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the locale_code column
*
* Example usage:
* <code>
* $query->filterByDbLocaleCode('fooValue'); // WHERE locale_code = 'fooValue'
* $query->filterByDbLocaleCode('%fooValue%'); // WHERE locale_code LIKE '%fooValue%'
* </code>
*
* @param string $dbLocaleCode 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
@ -173,12 +290,19 @@ abstract class BaseCcLocaleQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcLocalePeer::LOCALE_CODE, $dbLocaleCode, $comparison);
}
/**
* Filter the query on the locale_lang column
*
* Example usage:
* <code>
* $query->filterByDbLocaleLang('fooValue'); // WHERE locale_lang = 'fooValue'
* $query->filterByDbLocaleLang('%fooValue%'); // WHERE locale_lang LIKE '%fooValue%'
* </code>
*
* @param string $dbLocaleLang 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
@ -195,6 +319,7 @@ abstract class BaseCcLocaleQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcLocalePeer::LOCALE_LANG, $dbLocaleLang, $comparison);
}
@ -214,4 +339,4 @@ abstract class BaseCcLocaleQuery extends ModelCriteria
return $this;
}
} // BaseCcLocaleQuery
}

View File

@ -10,7 +10,6 @@
*/
abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
{
/**
* Peer class name
*/
@ -24,6 +23,12 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
*/
protected static $peer;
/**
* The flag var to prevent infinite loop in deep copy
* @var boolean
*/
protected $startCopy = false;
/**
* The value for the ip field.
* @var string
@ -51,6 +56,12 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
/**
* Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
* @var boolean
*/
protected $alreadyInClearAllReferencesDeep = false;
/**
* Applies default values to this object.
* This method should be called from the object's constructor (or
@ -79,6 +90,7 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
*/
public function getDbIP()
{
return $this->ip;
}
@ -89,6 +101,7 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
*/
public function getDbAttempts()
{
return $this->attempts;
}
@ -100,7 +113,7 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
*/
public function setDbIP($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -109,6 +122,7 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
$this->modifiedColumns[] = CcLoginAttemptsPeer::IP;
}
return $this;
} // setDbIP()
@ -120,15 +134,16 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
*/
public function setDbAttempts($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
if ($this->attempts !== $v || $this->isNew()) {
if ($this->attempts !== $v) {
$this->attempts = $v;
$this->modifiedColumns[] = CcLoginAttemptsPeer::ATTEMPTS;
}
return $this;
} // setDbAttempts()
@ -146,7 +161,7 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
return false;
}
// otherwise, everything was equal, so return TRUE
// otherwise, everything was equal, so return true
return true;
} // hasOnlyDefaultValues()
@ -159,7 +174,7 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
* 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 int $startcol 0-based offset column which indicates which resultset 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.
@ -177,8 +192,9 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
if ($rehydrate) {
$this->ensureConsistency();
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 2; // 2 = CcLoginAttemptsPeer::NUM_COLUMNS - CcLoginAttemptsPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 2; // 2 = CcLoginAttemptsPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating CcLoginAttempts object", $e);
@ -249,6 +265,7 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
* @param PropelPDO $con
* @return void
* @throws PropelException
* @throws Exception
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
@ -264,18 +281,18 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
$con->beginTransaction();
try {
$deleteQuery = CcLoginAttemptsQuery::create()
->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con);
if ($ret) {
CcLoginAttemptsQuery::create()
->filterByPrimaryKey($this->getPrimaryKey())
->delete($con);
$deleteQuery->delete($con);
$this->postDelete($con);
$con->commit();
$this->setDeleted(true);
} else {
$con->commit();
}
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -292,6 +309,7 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @throws Exception
* @see doSave()
*/
public function save(PropelPDO $con = null)
@ -326,8 +344,9 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
$affectedRows = 0;
}
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -350,27 +369,87 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$criteria = $this->buildCriteria();
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows = 1;
$this->setNew(false);
$this->doInsert($con);
} else {
$affectedRows = CcLoginAttemptsPeer::doUpdate($this, $con);
$this->doUpdate($con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
$affectedRows += 1;
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Insert the row in the database.
*
* @param PropelPDO $con
*
* @throws PropelException
* @see doSave()
*/
protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(CcLoginAttemptsPeer::IP)) {
$modifiedColumns[':p' . $index++] = '"ip"';
}
if ($this->isColumnModified(CcLoginAttemptsPeer::ATTEMPTS)) {
$modifiedColumns[':p' . $index++] = '"attempts"';
}
$sql = sprintf(
'INSERT INTO "cc_login_attempts" (%s) VALUES (%s)',
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case '"ip"':
$stmt->bindValue($identifier, $this->ip, PDO::PARAM_STR);
break;
case '"attempts"':
$stmt->bindValue($identifier, $this->attempts, PDO::PARAM_INT);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
}
$this->setNew(false);
}
/**
* Update the row in the database.
*
* @param PropelPDO $con
*
* @see doSave()
*/
protected function doUpdate(PropelPDO $con)
{
$selectCriteria = $this->buildPkeyCriteria();
$valuesCriteria = $this->buildCriteria();
BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
}
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
@ -405,11 +484,13 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
$this->validationFailures = $res;
return false;
}
/**
@ -417,10 +498,10 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
*
* 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.
* an aggregated 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.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
@ -449,13 +530,15 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcLoginAttemptsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
$field = $this->getByPosition($pos);
return $field;
}
@ -490,17 +573,28 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
* @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 $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
*
* @return array an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
{
if (isset($alreadyDumpedObjects['CcLoginAttempts'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['CcLoginAttempts'][$this->getPrimaryKey()] = true;
$keys = CcLoginAttemptsPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getDbIP(),
$keys[1] => $this->getDbAttempts(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
$result[$key] = $virtualColumn;
}
return $result;
}
@ -511,13 +605,15 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcLoginAttemptsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
$this->setByPosition($pos, $value);
}
/**
@ -551,7 +647,7 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
* 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')
* The default key type is the column's BasePeer::TYPE_PHPNAME
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
@ -622,6 +718,7 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
*/
public function isPrimaryKeyNull()
{
return null === $this->getDbIP();
}
@ -633,14 +730,16 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
*
* @param object $copyObj An object of CcLoginAttempts (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setDbIP($this->ip);
$copyObj->setDbAttempts($this->attempts);
$copyObj->setDbAttempts($this->getDbAttempts());
if ($makeNew) {
$copyObj->setNew(true);
$copyObj->setDbIP(NULL); // this is a auto-increment column, so set to default value
}
}
/**
@ -661,6 +760,7 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
@ -678,6 +778,7 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
if (self::$peer === null) {
self::$peer = new CcLoginAttemptsPeer();
}
return self::$peer;
}
@ -690,6 +791,7 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
$this->attempts = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;
$this->clearAllReferences();
$this->applyDefaultValues();
$this->resetModified();
@ -698,38 +800,42 @@ abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
}
/**
* Resets all collections of referencing foreign keys.
* Resets all references to other model objects or collections of model objects.
*
* 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.
* This method is a user-space workaround for PHP's inability to garbage collect
* objects with circular references (even in PHP 5.3). This is currently necessary
* when using Propel in certain daemon or large-volume/high-memory operations.
*
* @param boolean $deep Whether to also clear the references on all associated objects.
* @param boolean $deep Whether to also clear the references on all referrer objects.
*/
public function clearAllReferences($deep = false)
{
if ($deep) {
if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true;
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
}
/**
* Catches calls to virtual methods
* return the string representation of this object
*
* @return string
*/
public function __call($name, $params)
public function __toString()
{
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);
return (string) $this->exportTo(CcLoginAttemptsPeer::DEFAULT_STRING_FORMAT);
}
} // BaseCcLoginAttempts
/**
* return true is the object is in saving state
*
* @return boolean
*/
public function isAlreadyInSave()
{
return $this->alreadyInSave;
}
}

View File

@ -8,7 +8,8 @@
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcLoginAttemptsPeer {
abstract class BaseCcLoginAttemptsPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
@ -19,9 +20,6 @@ abstract class BaseCcLoginAttemptsPeer {
/** the related Propel class for this table */
const OM_CLASS = 'CcLoginAttempts';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcLoginAttempts';
/** the related TableMap class for this table */
const TM_CLASS = 'CcLoginAttemptsTableMap';
@ -31,14 +29,20 @@ abstract class BaseCcLoginAttemptsPeer {
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the IP field */
const IP = 'cc_login_attempts.IP';
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 2;
/** the column name for the ATTEMPTS field */
const ATTEMPTS = 'cc_login_attempts.ATTEMPTS';
/** the column name for the ip field */
const IP = 'cc_login_attempts.ip';
/** the column name for the attempts field */
const ATTEMPTS = 'cc_login_attempts.attempts';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CcLoginAttempts objects.
* An identity map to hold any loaded instances of CcLoginAttempts objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcLoginAttempts[]
@ -50,12 +54,12 @@ abstract class BaseCcLoginAttemptsPeer {
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
* e.g. CcLoginAttemptsPeer::$fieldNames[CcLoginAttemptsPeer::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbIP', 'DbAttempts', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbIP', 'dbAttempts', ),
BasePeer::TYPE_COLNAME => array (self::IP, self::ATTEMPTS, ),
BasePeer::TYPE_COLNAME => array (CcLoginAttemptsPeer::IP, CcLoginAttemptsPeer::ATTEMPTS, ),
BasePeer::TYPE_RAW_COLNAME => array ('IP', 'ATTEMPTS', ),
BasePeer::TYPE_FIELDNAME => array ('ip', 'attempts', ),
BasePeer::TYPE_NUM => array (0, 1, )
@ -65,12 +69,12 @@ abstract class BaseCcLoginAttemptsPeer {
* 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
* e.g. CcLoginAttemptsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbIP' => 0, 'DbAttempts' => 1, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbIP' => 0, 'dbAttempts' => 1, ),
BasePeer::TYPE_COLNAME => array (self::IP => 0, self::ATTEMPTS => 1, ),
BasePeer::TYPE_COLNAME => array (CcLoginAttemptsPeer::IP => 0, CcLoginAttemptsPeer::ATTEMPTS => 1, ),
BasePeer::TYPE_RAW_COLNAME => array ('IP' => 0, 'ATTEMPTS' => 1, ),
BasePeer::TYPE_FIELDNAME => array ('ip' => 0, 'attempts' => 1, ),
BasePeer::TYPE_NUM => array (0, 1, )
@ -86,13 +90,14 @@ abstract class BaseCcLoginAttemptsPeer {
* @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)
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = CcLoginAttemptsPeer::getFieldNames($toType);
$key = isset(CcLoginAttemptsPeer::$fieldKeys[$fromType][$name]) ? CcLoginAttemptsPeer::$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));
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcLoginAttemptsPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@ -103,14 +108,15 @@ abstract class BaseCcLoginAttemptsPeer {
* 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
* @throws PropelException - if the type is not valid.
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
if (!array_key_exists($type, CcLoginAttemptsPeer::$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];
return CcLoginAttemptsPeer::$fieldNames[$type];
}
/**
@ -148,8 +154,8 @@ abstract class BaseCcLoginAttemptsPeer {
$criteria->addSelectColumn(CcLoginAttemptsPeer::IP);
$criteria->addSelectColumn(CcLoginAttemptsPeer::ATTEMPTS);
} else {
$criteria->addSelectColumn($alias . '.IP');
$criteria->addSelectColumn($alias . '.ATTEMPTS');
$criteria->addSelectColumn($alias . '.ip');
$criteria->addSelectColumn($alias . '.attempts');
}
}
@ -180,7 +186,7 @@ abstract class BaseCcLoginAttemptsPeer {
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
$criteria->setDbName(CcLoginAttemptsPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -194,10 +200,11 @@ abstract class BaseCcLoginAttemptsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
@ -213,10 +220,11 @@ abstract class BaseCcLoginAttemptsPeer {
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
@ -231,7 +239,7 @@ abstract class BaseCcLoginAttemptsPeer {
/**
* 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
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
@ -253,7 +261,7 @@ abstract class BaseCcLoginAttemptsPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcLoginAttemptsPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
@ -267,16 +275,16 @@ abstract class BaseCcLoginAttemptsPeer {
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcLoginAttempts $value A CcLoginAttempts object.
* @param CcLoginAttempts $obj A CcLoginAttempts object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcLoginAttempts $obj, $key = null)
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getDbIP();
} // if key === null
self::$instances[$key] = $obj;
CcLoginAttemptsPeer::$instances[$key] = $obj;
}
}
@ -289,6 +297,9 @@ abstract class BaseCcLoginAttemptsPeer {
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcLoginAttempts object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
@ -303,7 +314,7 @@ abstract class BaseCcLoginAttemptsPeer {
throw $e;
}
unset(self::$instances[$key]);
unset(CcLoginAttemptsPeer::$instances[$key]);
}
} // removeInstanceFromPool()
@ -314,16 +325,17 @@ abstract class BaseCcLoginAttemptsPeer {
* 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 CcLoginAttempts Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @return CcLoginAttempts 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];
if (isset(CcLoginAttemptsPeer::$instances[$key])) {
return CcLoginAttemptsPeer::$instances[$key];
}
}
return null; // just to be explicit
}
@ -332,9 +344,14 @@ abstract class BaseCcLoginAttemptsPeer {
*
* @return void
*/
public static function clearInstancePool()
public static function clearInstancePool($and_clear_all_references = false)
{
self::$instances = array();
if ($and_clear_all_references) {
foreach (CcLoginAttemptsPeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcLoginAttemptsPeer::$instances = array();
}
/**
@ -353,14 +370,15 @@ abstract class BaseCcLoginAttemptsPeer {
*
* @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.
* @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 the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
@ -375,6 +393,7 @@ abstract class BaseCcLoginAttemptsPeer {
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (string) $row[$startcol];
}
@ -390,7 +409,7 @@ abstract class BaseCcLoginAttemptsPeer {
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcLoginAttemptsPeer::getOMClass(false);
$cls = CcLoginAttemptsPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcLoginAttemptsPeer::getPrimaryKeyHashFromRow($row, 0);
@ -407,6 +426,7 @@ abstract class BaseCcLoginAttemptsPeer {
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
@ -425,15 +445,17 @@ abstract class BaseCcLoginAttemptsPeer {
// 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 + CcLoginAttemptsPeer::NUM_COLUMNS;
$col = $startcol + CcLoginAttemptsPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CcLoginAttemptsPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcLoginAttemptsPeer::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.
@ -443,7 +465,7 @@ abstract class BaseCcLoginAttemptsPeer {
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
return Propel::getDatabaseMap(CcLoginAttemptsPeer::DATABASE_NAME)->getTable(CcLoginAttemptsPeer::TABLE_NAME);
}
/**
@ -452,30 +474,24 @@ abstract class BaseCcLoginAttemptsPeer {
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcLoginAttemptsPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcLoginAttemptsPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcLoginAttemptsTableMap());
if (!$dbMap->hasTable(BaseCcLoginAttemptsPeer::TABLE_NAME)) {
$dbMap->addTableObject(new \CcLoginAttemptsTableMap());
}
}
/**
* 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
* @return string ClassName
*/
public static function getOMClass($withPrefix = true)
public static function getOMClass($row = 0, $colnum = 0)
{
return $withPrefix ? CcLoginAttemptsPeer::CLASS_DEFAULT : CcLoginAttemptsPeer::OM_CLASS;
return CcLoginAttemptsPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcLoginAttempts or Criteria object.
* Performs an INSERT on the database, given a CcLoginAttempts or Criteria object.
*
* @param mixed $values Criteria or CcLoginAttempts object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
@ -497,7 +513,7 @@ abstract class BaseCcLoginAttemptsPeer {
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcLoginAttemptsPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
@ -505,7 +521,7 @@ abstract class BaseCcLoginAttemptsPeer {
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -514,7 +530,7 @@ abstract class BaseCcLoginAttemptsPeer {
}
/**
* Method perform an UPDATE on the database, given a CcLoginAttempts or Criteria object.
* Performs an UPDATE on the database, given a CcLoginAttempts or Criteria object.
*
* @param mixed $values Criteria or CcLoginAttempts 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).
@ -528,7 +544,7 @@ abstract class BaseCcLoginAttemptsPeer {
$con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
$selectCriteria = new Criteria(CcLoginAttemptsPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
@ -547,17 +563,19 @@ abstract class BaseCcLoginAttemptsPeer {
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcLoginAttemptsPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_login_attempts table.
* Deletes all rows from the cc_login_attempts table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll($con = null)
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
@ -574,15 +592,16 @@ abstract class BaseCcLoginAttemptsPeer {
CcLoginAttemptsPeer::clearInstancePool();
CcLoginAttemptsPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcLoginAttempts or Criteria object OR a primary key value.
* Performs a DELETE on the database, given a CcLoginAttempts or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcLoginAttempts object or primary key or array of primary keys
* which is used to create the DELETE statement
@ -611,7 +630,7 @@ abstract class BaseCcLoginAttemptsPeer {
// 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 = new Criteria(CcLoginAttemptsPeer::DATABASE_NAME);
$criteria->add(CcLoginAttemptsPeer::IP, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
@ -620,7 +639,7 @@ abstract class BaseCcLoginAttemptsPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcLoginAttemptsPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@ -632,8 +651,9 @@ abstract class BaseCcLoginAttemptsPeer {
$affectedRows += BasePeer::doDelete($criteria, $con);
CcLoginAttemptsPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -651,7 +671,7 @@ abstract class BaseCcLoginAttemptsPeer {
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(CcLoginAttempts $obj, $cols = null)
public static function doValidate($obj, $cols = null)
{
$columns = array();
@ -664,7 +684,7 @@ abstract class BaseCcLoginAttemptsPeer {
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
@ -707,6 +727,7 @@ abstract class BaseCcLoginAttemptsPeer {
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcLoginAttempts[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
@ -724,6 +745,7 @@ abstract class BaseCcLoginAttemptsPeer {
$criteria->add(CcLoginAttemptsPeer::IP, $pks, Criteria::IN);
$objs = CcLoginAttemptsPeer::doSelect($criteria, $con);
}
return $objs;
}

View File

@ -19,7 +19,6 @@
* @method CcLoginAttempts findOne(PropelPDO $con = null) Return the first CcLoginAttempts matching the query
* @method CcLoginAttempts findOneOrCreate(PropelPDO $con = null) Return the first CcLoginAttempts matching the query, or a new CcLoginAttempts object populated from the query conditions when no match is found
*
* @method CcLoginAttempts findOneByDbIP(string $ip) Return the first CcLoginAttempts filtered by the ip column
* @method CcLoginAttempts findOneByDbAttempts(int $attempts) Return the first CcLoginAttempts filtered by the attempts column
*
* @method array findByDbIP(string $ip) Return CcLoginAttempts objects filtered by the ip column
@ -29,7 +28,6 @@
*/
abstract class BaseCcLoginAttemptsQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcLoginAttemptsQuery object.
*
@ -37,8 +35,14 @@ abstract class BaseCcLoginAttemptsQuery extends ModelCriteria
* @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 = 'CcLoginAttempts', $modelAlias = null)
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'airtime';
}
if (null === $modelName) {
$modelName = 'CcLoginAttempts';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
@ -46,7 +50,7 @@ abstract class BaseCcLoginAttemptsQuery extends ModelCriteria
* Returns a new CcLoginAttemptsQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
* @param CcLoginAttemptsQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CcLoginAttemptsQuery
*/
@ -55,41 +59,115 @@ abstract class BaseCcLoginAttemptsQuery extends ModelCriteria
if ($criteria instanceof CcLoginAttemptsQuery) {
return $criteria;
}
$query = new CcLoginAttemptsQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
$query = new CcLoginAttemptsQuery(null, null, $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
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <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 CcLoginAttempts|array|mixed the result, formatted by the current formatter
* @return CcLoginAttempts|CcLoginAttempts[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcLoginAttemptsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
if ($key === null) {
return null;
}
if ((null !== ($obj = CcLoginAttemptsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
// the object has not been requested yet, or the formatter is not an object formatter
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcLoginAttempts A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneByDbIP($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcLoginAttempts A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "ip", "attempts" FROM "cc_login_attempts" WHERE "ip" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_STR);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CcLoginAttempts();
$obj->hydrate($row);
CcLoginAttemptsPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcLoginAttempts|CcLoginAttempts[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
@ -99,14 +177,20 @@ abstract class BaseCcLoginAttemptsQuery extends ModelCriteria
* @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
* @return PropelObjectCollection|CcLoginAttempts[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
$stmt = $criteria
->filterByPrimaryKeys($keys)
->find($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
@ -118,6 +202,7 @@ abstract class BaseCcLoginAttemptsQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcLoginAttemptsPeer::IP, $key, Criteria::EQUAL);
}
@ -130,12 +215,19 @@ abstract class BaseCcLoginAttemptsQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcLoginAttemptsPeer::IP, $keys, Criteria::IN);
}
/**
* Filter the query on the ip column
*
* Example usage:
* <code>
* $query->filterByDbIP('fooValue'); // WHERE ip = 'fooValue'
* $query->filterByDbIP('%fooValue%'); // WHERE ip LIKE '%fooValue%'
* </code>
*
* @param string $dbIP 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
@ -152,14 +244,25 @@ abstract class BaseCcLoginAttemptsQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcLoginAttemptsPeer::IP, $dbIP, $comparison);
}
/**
* Filter the query on the attempts column
*
* @param int|array $dbAttempts The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbAttempts(1234); // WHERE attempts = 1234
* $query->filterByDbAttempts(array(12, 34)); // WHERE attempts IN (12, 34)
* $query->filterByDbAttempts(array('min' => 12)); // WHERE attempts >= 12
* $query->filterByDbAttempts(array('max' => 12)); // WHERE attempts <= 12
* </code>
*
* @param mixed $dbAttempts The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcLoginAttemptsQuery The current query, for fluid interface
@ -183,6 +286,7 @@ abstract class BaseCcLoginAttemptsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcLoginAttemptsPeer::ATTEMPTS, $dbAttempts, $comparison);
}
@ -202,4 +306,4 @@ abstract class BaseCcLoginAttemptsQuery extends ModelCriteria
return $this;
}
} // BaseCcLoginAttemptsQuery
}

View File

@ -10,7 +10,6 @@
*/
abstract class BaseCcMountName extends BaseObject implements Persistent
{
/**
* Peer class name
*/
@ -24,6 +23,12 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
*/
protected static $peer;
/**
* The flag var to prevent infinite loop in deep copy
* @var boolean
*/
protected $startCopy = false;
/**
* The value for the id field.
* @var int
@ -37,9 +42,10 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
protected $mount_name;
/**
* @var array CcListenerCount[] Collection to store aggregation of CcListenerCount objects.
* @var PropelObjectCollection|CcListenerCount[] Collection to store aggregation of CcListenerCount objects.
*/
protected $collCcListenerCounts;
protected $collCcListenerCountsPartial;
/**
* Flag to prevent endless save loop, if this object is referenced
@ -55,6 +61,18 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
/**
* Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
* @var boolean
*/
protected $alreadyInClearAllReferencesDeep = false;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
protected $ccListenerCountsScheduledForDeletion = null;
/**
* Get the [id] column value.
*
@ -62,6 +80,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
*/
public function getDbId()
{
return $this->id;
}
@ -72,6 +91,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
*/
public function getDbMountName()
{
return $this->mount_name;
}
@ -83,7 +103,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
*/
public function setDbId($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -92,6 +112,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
$this->modifiedColumns[] = CcMountNamePeer::ID;
}
return $this;
} // setDbId()
@ -103,7 +124,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
*/
public function setDbMountName($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -112,6 +133,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
$this->modifiedColumns[] = CcMountNamePeer::MOUNT_NAME;
}
return $this;
} // setDbMountName()
@ -125,7 +147,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
*/
public function hasOnlyDefaultValues()
{
// otherwise, everything was equal, so return TRUE
// otherwise, everything was equal, so return true
return true;
} // hasOnlyDefaultValues()
@ -138,7 +160,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
* 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 int $startcol 0-based offset column which indicates which resultset 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.
@ -156,8 +178,9 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
if ($rehydrate) {
$this->ensureConsistency();
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 2; // 2 = CcMountNamePeer::NUM_COLUMNS - CcMountNamePeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 2; // 2 = CcMountNamePeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating CcMountName object", $e);
@ -230,6 +253,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
* @param PropelPDO $con
* @return void
* @throws PropelException
* @throws Exception
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
@ -245,18 +269,18 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
$con->beginTransaction();
try {
$deleteQuery = CcMountNameQuery::create()
->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con);
if ($ret) {
CcMountNameQuery::create()
->filterByPrimaryKey($this->getPrimaryKey())
->delete($con);
$deleteQuery->delete($con);
$this->postDelete($con);
$con->commit();
$this->setDeleted(true);
} else {
$con->commit();
}
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -273,6 +297,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @throws Exception
* @see doSave()
*/
public function save(PropelPDO $con = null)
@ -307,8 +332,9 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
$affectedRows = 0;
}
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -331,32 +357,29 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->modifiedColumns[] = CcMountNamePeer::ID;
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$criteria = $this->buildCriteria();
if ($criteria->keyContainsValue(CcMountNamePeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcMountNamePeer::ID.')');
}
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows = 1;
$this->setDbId($pk); //[IMV] update autoincrement primary key
$this->setNew(false);
$this->doInsert($con);
} else {
$affectedRows = CcMountNamePeer::doUpdate($this, $con);
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
if ($this->ccListenerCountsScheduledForDeletion !== null) {
if (!$this->ccListenerCountsScheduledForDeletion->isEmpty()) {
CcListenerCountQuery::create()
->filterByPrimaryKeys($this->ccListenerCountsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->ccListenerCountsScheduledForDeletion = null;
}
}
if ($this->collCcListenerCounts !== null) {
foreach ($this->collCcListenerCounts as $referrerFK) {
if (!$referrerFK->isDeleted()) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
@ -365,9 +388,87 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Insert the row in the database.
*
* @param PropelPDO $con
*
* @throws PropelException
* @see doSave()
*/
protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = CcMountNamePeer::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcMountNamePeer::ID . ')');
}
if (null === $this->id) {
try {
$stmt = $con->query("SELECT nextval('cc_mount_name_id_seq')");
$row = $stmt->fetch(PDO::FETCH_NUM);
$this->id = $row[0];
} catch (Exception $e) {
throw new PropelException('Unable to get sequence id.', $e);
}
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(CcMountNamePeer::ID)) {
$modifiedColumns[':p' . $index++] = '"id"';
}
if ($this->isColumnModified(CcMountNamePeer::MOUNT_NAME)) {
$modifiedColumns[':p' . $index++] = '"mount_name"';
}
$sql = sprintf(
'INSERT INTO "cc_mount_name" (%s) VALUES (%s)',
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case '"id"':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case '"mount_name"':
$stmt->bindValue($identifier, $this->mount_name, PDO::PARAM_STR);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
}
$this->setNew(false);
}
/**
* Update the row in the database.
*
* @param PropelPDO $con
*
* @see doSave()
*/
protected function doUpdate(PropelPDO $con)
{
$selectCriteria = $this->buildPkeyCriteria();
$valuesCriteria = $this->buildCriteria();
BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
}
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
@ -402,11 +503,13 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
$this->validationFailures = $res;
return false;
}
/**
@ -414,10 +517,10 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
*
* 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.
* an aggregated 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.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
@ -454,13 +557,15 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcMountNamePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
$field = $this->getByPosition($pos);
return $field;
}
@ -495,17 +600,34 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
* @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 $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
* @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)
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['CcMountName'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['CcMountName'][$this->getPrimaryKey()] = true;
$keys = CcMountNamePeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getDbId(),
$keys[1] => $this->getDbMountName(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
$result[$key] = $virtualColumn;
}
if ($includeForeignObjects) {
if (null !== $this->collCcListenerCounts) {
$result['CcListenerCounts'] = $this->collCcListenerCounts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
}
return $result;
}
@ -516,13 +638,15 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcMountNamePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
$this->setByPosition($pos, $value);
}
/**
@ -556,7 +680,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
* 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')
* The default key type is the column's BasePeer::TYPE_PHPNAME
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
@ -627,6 +751,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
*/
public function isPrimaryKeyNull()
{
return null === $this->getDbId();
}
@ -638,16 +763,19 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
*
* @param object $copyObj An object of CcMountName (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setDbMountName($this->mount_name);
$copyObj->setDbMountName($this->getDbMountName());
if ($deepCopy) {
if ($deepCopy && !$this->startCopy) {
// important: temporarily setNew(false) because this affects the behavior of
// the getter/setter methods for fkey referrer objects.
$copyObj->setNew(false);
// store object hash to prevent cycle
$this->startCopy = true;
foreach ($this->getCcListenerCounts() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
@ -655,12 +783,15 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
}
}
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
if ($makeNew) {
$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.
@ -680,6 +811,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
@ -697,21 +829,51 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
if (self::$peer === null) {
self::$peer = new CcMountNamePeer();
}
return self::$peer;
}
/**
* Initializes a collection based on the name of a relation.
* Avoids crafting an 'init[$relationName]s' method name
* that wouldn't work when StandardEnglishPluralizer is used.
*
* @param string $relationName The name of the relation to initialize
* @return void
*/
public function initRelation($relationName)
{
if ('CcListenerCount' == $relationName) {
$this->initCcListenerCounts();
}
}
/**
* Clears out the collCcListenerCounts collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
* @return CcMountName The current object (for fluent API support)
* @see addCcListenerCounts()
*/
public function clearCcListenerCounts()
{
$this->collCcListenerCounts = null; // important to set this to NULL since that means it is uninitialized
$this->collCcListenerCounts = null; // important to set this to null since that means it is uninitialized
$this->collCcListenerCountsPartial = null;
return $this;
}
/**
* reset is the collCcListenerCounts collection loaded partially
*
* @return void
*/
public function resetPartialCcListenerCounts($v = true)
{
$this->collCcListenerCountsPartial = $v;
}
/**
@ -721,10 +883,16 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
* 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.
*
* @param boolean $overrideExisting If set to true, the method call initializes
* the collection even if it is not empty
*
* @return void
*/
public function initCcListenerCounts()
public function initCcListenerCounts($overrideExisting = true)
{
if (null !== $this->collCcListenerCounts && !$overrideExisting) {
return;
}
$this->collCcListenerCounts = new PropelObjectCollection();
$this->collCcListenerCounts->setModel('CcListenerCount');
}
@ -740,12 +908,13 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @return PropelCollection|array CcListenerCount[] List of CcListenerCount objects
* @return PropelObjectCollection|CcListenerCount[] List of CcListenerCount objects
* @throws PropelException
*/
public function getCcListenerCounts($criteria = null, PropelPDO $con = null)
{
if(null === $this->collCcListenerCounts || null !== $criteria) {
$partial = $this->collCcListenerCountsPartial && !$this->isNew();
if (null === $this->collCcListenerCounts || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collCcListenerCounts) {
// return empty collection
$this->initCcListenerCounts();
@ -754,14 +923,71 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
->filterByCcMountName($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collCcListenerCountsPartial && count($collCcListenerCounts)) {
$this->initCcListenerCounts(false);
foreach ($collCcListenerCounts as $obj) {
if (false == $this->collCcListenerCounts->contains($obj)) {
$this->collCcListenerCounts->append($obj);
}
}
$this->collCcListenerCountsPartial = true;
}
$collCcListenerCounts->getInternalIterator()->rewind();
return $collCcListenerCounts;
}
if ($partial && $this->collCcListenerCounts) {
foreach ($this->collCcListenerCounts as $obj) {
if ($obj->isNew()) {
$collCcListenerCounts[] = $obj;
}
}
}
$this->collCcListenerCounts = $collCcListenerCounts;
$this->collCcListenerCountsPartial = false;
}
}
return $this->collCcListenerCounts;
}
/**
* Sets a collection of CcListenerCount objects related by a one-to-many relationship
* to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
* @param PropelCollection $ccListenerCounts A Propel collection.
* @param PropelPDO $con Optional connection object
* @return CcMountName The current object (for fluent API support)
*/
public function setCcListenerCounts(PropelCollection $ccListenerCounts, PropelPDO $con = null)
{
$ccListenerCountsToDelete = $this->getCcListenerCounts(new Criteria(), $con)->diff($ccListenerCounts);
$this->ccListenerCountsScheduledForDeletion = $ccListenerCountsToDelete;
foreach ($ccListenerCountsToDelete as $ccListenerCountRemoved) {
$ccListenerCountRemoved->setCcMountName(null);
}
$this->collCcListenerCounts = null;
foreach ($ccListenerCounts as $ccListenerCount) {
$this->addCcListenerCount($ccListenerCount);
}
$this->collCcListenerCounts = $ccListenerCounts;
$this->collCcListenerCountsPartial = false;
return $this;
}
/**
* Returns the number of related CcListenerCount objects.
*
@ -773,42 +999,81 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
*/
public function countCcListenerCounts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
if(null === $this->collCcListenerCounts || null !== $criteria) {
$partial = $this->collCcListenerCountsPartial && !$this->isNew();
if (null === $this->collCcListenerCounts || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collCcListenerCounts) {
return 0;
} else {
}
if ($partial && !$criteria) {
return count($this->getCcListenerCounts());
}
$query = CcListenerCountQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByCcMountName($this)
->count($con);
}
} else {
return count($this->collCcListenerCounts);
}
}
/**
* Method called to associate a CcListenerCount object to this object
* through the CcListenerCount foreign key attribute.
*
* @param CcListenerCount $l CcListenerCount
* @return void
* @throws PropelException
* @return CcMountName The current object (for fluent API support)
*/
public function addCcListenerCount(CcListenerCount $l)
{
if ($this->collCcListenerCounts === null) {
$this->initCcListenerCounts();
$this->collCcListenerCountsPartial = true;
}
if (!$this->collCcListenerCounts->contains($l)) { // only add it if the **same** object is not already associated
$this->collCcListenerCounts[]= $l;
$l->setCcMountName($this);
if (!in_array($l, $this->collCcListenerCounts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddCcListenerCount($l);
if ($this->ccListenerCountsScheduledForDeletion and $this->ccListenerCountsScheduledForDeletion->contains($l)) {
$this->ccListenerCountsScheduledForDeletion->remove($this->ccListenerCountsScheduledForDeletion->search($l));
}
}
return $this;
}
/**
* @param CcListenerCount $ccListenerCount The ccListenerCount object to add.
*/
protected function doAddCcListenerCount($ccListenerCount)
{
$this->collCcListenerCounts[]= $ccListenerCount;
$ccListenerCount->setCcMountName($this);
}
/**
* @param CcListenerCount $ccListenerCount The ccListenerCount object to remove.
* @return CcMountName The current object (for fluent API support)
*/
public function removeCcListenerCount($ccListenerCount)
{
if ($this->getCcListenerCounts()->contains($ccListenerCount)) {
$this->collCcListenerCounts->remove($this->collCcListenerCounts->search($ccListenerCount));
if (null === $this->ccListenerCountsScheduledForDeletion) {
$this->ccListenerCountsScheduledForDeletion = clone $this->collCcListenerCounts;
$this->ccListenerCountsScheduledForDeletion->clear();
}
$this->ccListenerCountsScheduledForDeletion[]= clone $ccListenerCount;
$ccListenerCount->setCcMountName(null);
}
return $this;
}
/**
* If this collection has already been initialized with
@ -824,7 +1089,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return PropelCollection|array CcListenerCount[] List of CcListenerCount objects
* @return PropelObjectCollection|CcListenerCount[] List of CcListenerCount objects
*/
public function getCcListenerCountsJoinCcTimestamp($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
@ -843,6 +1108,7 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
$this->mount_name = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;
$this->clearAllReferences();
$this->resetModified();
$this->setNew(true);
@ -850,44 +1116,51 @@ abstract class BaseCcMountName extends BaseObject implements Persistent
}
/**
* Resets all collections of referencing foreign keys.
* Resets all references to other model objects or collections of model objects.
*
* 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.
* This method is a user-space workaround for PHP's inability to garbage collect
* objects with circular references (even in PHP 5.3). This is currently necessary
* when using Propel in certain daemon or large-volume/high-memory operations.
*
* @param boolean $deep Whether to also clear the references on all associated objects.
* @param boolean $deep Whether to also clear the references on all referrer objects.
*/
public function clearAllReferences($deep = false)
{
if ($deep) {
if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true;
if ($this->collCcListenerCounts) {
foreach ((array) $this->collCcListenerCounts as $o) {
foreach ($this->collCcListenerCounts as $o) {
$o->clearAllReferences($deep);
}
}
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
if ($this->collCcListenerCounts instanceof PropelCollection) {
$this->collCcListenerCounts->clearIterator();
}
$this->collCcListenerCounts = null;
}
/**
* Catches calls to virtual methods
* return the string representation of this object
*
* @return string
*/
public function __call($name, $params)
public function __toString()
{
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);
return (string) $this->exportTo(CcMountNamePeer::DEFAULT_STRING_FORMAT);
}
} // BaseCcMountName
/**
* return true is the object is in saving state
*
* @return boolean
*/
public function isAlreadyInSave()
{
return $this->alreadyInSave;
}
}

View File

@ -8,7 +8,8 @@
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcMountNamePeer {
abstract class BaseCcMountNamePeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
@ -19,9 +20,6 @@ abstract class BaseCcMountNamePeer {
/** the related Propel class for this table */
const OM_CLASS = 'CcMountName';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcMountName';
/** the related TableMap class for this table */
const TM_CLASS = 'CcMountNameTableMap';
@ -31,14 +29,20 @@ abstract class BaseCcMountNamePeer {
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_mount_name.ID';
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 2;
/** the column name for the MOUNT_NAME field */
const MOUNT_NAME = 'cc_mount_name.MOUNT_NAME';
/** the column name for the id field */
const ID = 'cc_mount_name.id';
/** the column name for the mount_name field */
const MOUNT_NAME = 'cc_mount_name.mount_name';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CcMountName objects.
* An identity map to hold any loaded instances of CcMountName objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcMountName[]
@ -50,12 +54,12 @@ abstract class BaseCcMountNamePeer {
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
* e.g. CcMountNamePeer::$fieldNames[CcMountNamePeer::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbMountName', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbMountName', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::MOUNT_NAME, ),
BasePeer::TYPE_COLNAME => array (CcMountNamePeer::ID, CcMountNamePeer::MOUNT_NAME, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'MOUNT_NAME', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'mount_name', ),
BasePeer::TYPE_NUM => array (0, 1, )
@ -65,12 +69,12 @@ abstract class BaseCcMountNamePeer {
* 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
* e.g. CcMountNamePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbMountName' => 1, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbMountName' => 1, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::MOUNT_NAME => 1, ),
BasePeer::TYPE_COLNAME => array (CcMountNamePeer::ID => 0, CcMountNamePeer::MOUNT_NAME => 1, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'MOUNT_NAME' => 1, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'mount_name' => 1, ),
BasePeer::TYPE_NUM => array (0, 1, )
@ -86,13 +90,14 @@ abstract class BaseCcMountNamePeer {
* @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)
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = CcMountNamePeer::getFieldNames($toType);
$key = isset(CcMountNamePeer::$fieldKeys[$fromType][$name]) ? CcMountNamePeer::$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));
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcMountNamePeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@ -103,14 +108,15 @@ abstract class BaseCcMountNamePeer {
* 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
* @throws PropelException - if the type is not valid.
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
if (!array_key_exists($type, CcMountNamePeer::$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];
return CcMountNamePeer::$fieldNames[$type];
}
/**
@ -148,8 +154,8 @@ abstract class BaseCcMountNamePeer {
$criteria->addSelectColumn(CcMountNamePeer::ID);
$criteria->addSelectColumn(CcMountNamePeer::MOUNT_NAME);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.MOUNT_NAME');
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.mount_name');
}
}
@ -180,7 +186,7 @@ abstract class BaseCcMountNamePeer {
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
$criteria->setDbName(CcMountNamePeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -194,10 +200,11 @@ abstract class BaseCcMountNamePeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
@ -213,10 +220,11 @@ abstract class BaseCcMountNamePeer {
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
@ -231,7 +239,7 @@ abstract class BaseCcMountNamePeer {
/**
* 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
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
@ -253,7 +261,7 @@ abstract class BaseCcMountNamePeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcMountNamePeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
@ -267,16 +275,16 @@ abstract class BaseCcMountNamePeer {
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcMountName $value A CcMountName object.
* @param CcMountName $obj A CcMountName object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcMountName $obj, $key = null)
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getDbId();
} // if key === null
self::$instances[$key] = $obj;
CcMountNamePeer::$instances[$key] = $obj;
}
}
@ -289,6 +297,9 @@ abstract class BaseCcMountNamePeer {
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcMountName object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
@ -303,7 +314,7 @@ abstract class BaseCcMountNamePeer {
throw $e;
}
unset(self::$instances[$key]);
unset(CcMountNamePeer::$instances[$key]);
}
} // removeInstanceFromPool()
@ -314,16 +325,17 @@ abstract class BaseCcMountNamePeer {
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return CcMountName Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @return CcMountName Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(self::$instances[$key])) {
return self::$instances[$key];
if (isset(CcMountNamePeer::$instances[$key])) {
return CcMountNamePeer::$instances[$key];
}
}
return null; // just to be explicit
}
@ -332,9 +344,14 @@ abstract class BaseCcMountNamePeer {
*
* @return void
*/
public static function clearInstancePool()
public static function clearInstancePool($and_clear_all_references = false)
{
self::$instances = array();
if ($and_clear_all_references) {
foreach (CcMountNamePeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcMountNamePeer::$instances = array();
}
/**
@ -356,14 +373,15 @@ abstract class BaseCcMountNamePeer {
*
* @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.
* @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 the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
@ -378,6 +396,7 @@ abstract class BaseCcMountNamePeer {
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
@ -393,7 +412,7 @@ abstract class BaseCcMountNamePeer {
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcMountNamePeer::getOMClass(false);
$cls = CcMountNamePeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcMountNamePeer::getPrimaryKeyHashFromRow($row, 0);
@ -410,6 +429,7 @@ abstract class BaseCcMountNamePeer {
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
@ -428,15 +448,17 @@ abstract class BaseCcMountNamePeer {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + CcMountNamePeer::NUM_COLUMNS;
$col = $startcol + CcMountNamePeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CcMountNamePeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcMountNamePeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
@ -446,7 +468,7 @@ abstract class BaseCcMountNamePeer {
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
return Propel::getDatabaseMap(CcMountNamePeer::DATABASE_NAME)->getTable(CcMountNamePeer::TABLE_NAME);
}
/**
@ -455,30 +477,24 @@ abstract class BaseCcMountNamePeer {
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcMountNamePeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcMountNamePeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcMountNameTableMap());
if (!$dbMap->hasTable(BaseCcMountNamePeer::TABLE_NAME)) {
$dbMap->addTableObject(new \CcMountNameTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
* @return string ClassName
*/
public static function getOMClass($withPrefix = true)
public static function getOMClass($row = 0, $colnum = 0)
{
return $withPrefix ? CcMountNamePeer::CLASS_DEFAULT : CcMountNamePeer::OM_CLASS;
return CcMountNamePeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcMountName or Criteria object.
* Performs an INSERT on the database, given a CcMountName or Criteria object.
*
* @param mixed $values Criteria or CcMountName object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
@ -504,7 +520,7 @@ abstract class BaseCcMountNamePeer {
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcMountNamePeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
@ -512,7 +528,7 @@ abstract class BaseCcMountNamePeer {
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -521,7 +537,7 @@ abstract class BaseCcMountNamePeer {
}
/**
* Method perform an UPDATE on the database, given a CcMountName or Criteria object.
* Performs an UPDATE on the database, given a CcMountName or Criteria object.
*
* @param mixed $values Criteria or CcMountName object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
@ -535,7 +551,7 @@ abstract class BaseCcMountNamePeer {
$con = Propel::getConnection(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
$selectCriteria = new Criteria(CcMountNamePeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
@ -554,17 +570,19 @@ abstract class BaseCcMountNamePeer {
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcMountNamePeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_mount_name table.
* Deletes all rows from the cc_mount_name table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll($con = null)
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
@ -581,15 +599,16 @@ abstract class BaseCcMountNamePeer {
CcMountNamePeer::clearInstancePool();
CcMountNamePeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcMountName or Criteria object OR a primary key value.
* Performs a DELETE on the database, given a CcMountName or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcMountName object or primary key or array of primary keys
* which is used to create the DELETE statement
@ -618,7 +637,7 @@ abstract class BaseCcMountNamePeer {
// 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 = new Criteria(CcMountNamePeer::DATABASE_NAME);
$criteria->add(CcMountNamePeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
@ -627,7 +646,7 @@ abstract class BaseCcMountNamePeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcMountNamePeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@ -639,8 +658,9 @@ abstract class BaseCcMountNamePeer {
$affectedRows += BasePeer::doDelete($criteria, $con);
CcMountNamePeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -658,7 +678,7 @@ abstract class BaseCcMountNamePeer {
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(CcMountName $obj, $cols = null)
public static function doValidate($obj, $cols = null)
{
$columns = array();
@ -671,7 +691,7 @@ abstract class BaseCcMountNamePeer {
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
@ -714,6 +734,7 @@ abstract class BaseCcMountNamePeer {
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcMountName[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
@ -731,6 +752,7 @@ abstract class BaseCcMountNamePeer {
$criteria->add(CcMountNamePeer::ID, $pks, Criteria::IN);
$objs = CcMountNamePeer::doSelect($criteria, $con);
}
return $objs;
}

View File

@ -16,14 +16,13 @@
* @method CcMountNameQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcMountNameQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcMountNameQuery leftJoinCcListenerCount($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcListenerCount relation
* @method CcMountNameQuery rightJoinCcListenerCount($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcListenerCount relation
* @method CcMountNameQuery innerJoinCcListenerCount($relationAlias = '') Adds a INNER JOIN clause to the query using the CcListenerCount relation
* @method CcMountNameQuery leftJoinCcListenerCount($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcListenerCount relation
* @method CcMountNameQuery rightJoinCcListenerCount($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcListenerCount relation
* @method CcMountNameQuery innerJoinCcListenerCount($relationAlias = null) Adds a INNER JOIN clause to the query using the CcListenerCount relation
*
* @method CcMountName findOne(PropelPDO $con = null) Return the first CcMountName matching the query
* @method CcMountName findOneOrCreate(PropelPDO $con = null) Return the first CcMountName matching the query, or a new CcMountName object populated from the query conditions when no match is found
*
* @method CcMountName findOneByDbId(int $id) Return the first CcMountName filtered by the id column
* @method CcMountName findOneByDbMountName(string $mount_name) Return the first CcMountName filtered by the mount_name column
*
* @method array findByDbId(int $id) Return CcMountName objects filtered by the id column
@ -33,7 +32,6 @@
*/
abstract class BaseCcMountNameQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcMountNameQuery object.
*
@ -41,8 +39,14 @@ abstract class BaseCcMountNameQuery extends ModelCriteria
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'airtime', $modelName = 'CcMountName', $modelAlias = null)
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'airtime';
}
if (null === $modelName) {
$modelName = 'CcMountName';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
@ -50,7 +54,7 @@ abstract class BaseCcMountNameQuery extends ModelCriteria
* Returns a new CcMountNameQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
* @param CcMountNameQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CcMountNameQuery
*/
@ -59,41 +63,115 @@ abstract class BaseCcMountNameQuery extends ModelCriteria
if ($criteria instanceof CcMountNameQuery) {
return $criteria;
}
$query = new CcMountNameQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
$query = new CcMountNameQuery(null, null, $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
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con an optional connection object
*
* @return CcMountName|array|mixed the result, formatted by the current formatter
* @return CcMountName|CcMountName[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcMountNamePeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
if ($key === null) {
return null;
}
if ((null !== ($obj = CcMountNamePeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
// the object has not been requested yet, or the formatter is not an object formatter
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcMountName A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneByDbId($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcMountName A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "id", "mount_name" FROM "cc_mount_name" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CcMountName();
$obj->hydrate($row);
CcMountNamePeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcMountName|CcMountName[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
@ -103,14 +181,20 @@ abstract class BaseCcMountNameQuery extends ModelCriteria
* @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
* @return PropelObjectCollection|CcMountName[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
$stmt = $criteria
->filterByPrimaryKeys($keys)
->find($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
@ -122,6 +206,7 @@ abstract class BaseCcMountNameQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcMountNamePeer::ID, $key, Criteria::EQUAL);
}
@ -134,29 +219,61 @@ abstract class BaseCcMountNameQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcMountNamePeer::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* @param int|array $dbId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbId(1234); // WHERE id = 1234
* $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
* $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
* </code>
*
* @param mixed $dbId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcMountNameQuery The current query, for fluid interface
*/
public function filterByDbId($dbId = null, $comparison = null)
{
if (is_array($dbId) && null === $comparison) {
if (is_array($dbId)) {
$useMinMax = false;
if (isset($dbId['min'])) {
$this->addUsingAlias(CcMountNamePeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbId['max'])) {
$this->addUsingAlias(CcMountNamePeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcMountNamePeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the mount_name column
*
* Example usage:
* <code>
* $query->filterByDbMountName('fooValue'); // WHERE mount_name = 'fooValue'
* $query->filterByDbMountName('%fooValue%'); // WHERE mount_name LIKE '%fooValue%'
* </code>
*
* @param string $dbMountName The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -173,21 +290,32 @@ abstract class BaseCcMountNameQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcMountNamePeer::MOUNT_NAME, $dbMountName, $comparison);
}
/**
* Filter the query by a related CcListenerCount object
*
* @param CcListenerCount $ccListenerCount the related object to use as filter
* @param CcListenerCount|PropelObjectCollection $ccListenerCount the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcMountNameQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcListenerCount($ccListenerCount, $comparison = null)
{
if ($ccListenerCount instanceof CcListenerCount) {
return $this
->addUsingAlias(CcMountNamePeer::ID, $ccListenerCount->getDbMountNameId(), $comparison);
} elseif ($ccListenerCount instanceof PropelObjectCollection) {
return $this
->useCcListenerCountQuery()
->filterByPrimaryKeys($ccListenerCount->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCcListenerCount() only accepts arguments of type CcListenerCount or PropelCollection');
}
}
/**
@ -198,7 +326,7 @@ abstract class BaseCcMountNameQuery extends ModelCriteria
*
* @return CcMountNameQuery The current query, for fluid interface
*/
public function joinCcListenerCount($relationAlias = '', $joinType = Criteria::INNER_JOIN)
public function joinCcListenerCount($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcListenerCount');
@ -233,7 +361,7 @@ abstract class BaseCcMountNameQuery extends ModelCriteria
*
* @return CcListenerCountQuery A secondary query class using the current class as primary query
*/
public function useCcListenerCountQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
public function useCcListenerCountQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcListenerCount($relationAlias, $joinType)
@ -256,4 +384,4 @@ abstract class BaseCcMountNameQuery extends ModelCriteria
return $this;
}
} // BaseCcMountNameQuery
}

View File

@ -10,7 +10,6 @@
*/
abstract class BaseCcMusicDirs extends BaseObject implements Persistent
{
/**
* Peer class name
*/
@ -24,6 +23,12 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*/
protected static $peer;
/**
* The flag var to prevent infinite loop in deep copy
* @var boolean
*/
protected $startCopy = false;
/**
* The value for the id field.
* @var int
@ -57,9 +62,10 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
protected $watched;
/**
* @var array CcFiles[] Collection to store aggregation of CcFiles objects.
* @var PropelObjectCollection|CcFiles[] Collection to store aggregation of CcFiles objects.
*/
protected $collCcFiless;
protected $collCcFilessPartial;
/**
* Flag to prevent endless save loop, if this object is referenced
@ -75,6 +81,18 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
/**
* Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
* @var boolean
*/
protected $alreadyInClearAllReferencesDeep = false;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
protected $ccFilessScheduledForDeletion = null;
/**
* Applies default values to this object.
* This method should be called from the object's constructor (or
@ -104,6 +122,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*/
public function getId()
{
return $this->id;
}
@ -114,6 +133,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*/
public function getDirectory()
{
return $this->directory;
}
@ -124,6 +144,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*/
public function getType()
{
return $this->type;
}
@ -134,6 +155,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*/
public function getExists()
{
return $this->exists;
}
@ -144,6 +166,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*/
public function getWatched()
{
return $this->watched;
}
@ -155,7 +178,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*/
public function setId($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -164,6 +187,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
$this->modifiedColumns[] = CcMusicDirsPeer::ID;
}
return $this;
} // setId()
@ -175,7 +199,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*/
public function setDirectory($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -184,6 +208,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
$this->modifiedColumns[] = CcMusicDirsPeer::DIRECTORY;
}
return $this;
} // setDirectory()
@ -195,7 +220,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*/
public function setType($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -204,46 +229,65 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
$this->modifiedColumns[] = CcMusicDirsPeer::TYPE;
}
return $this;
} // setType()
/**
* Set the value of [exists] column.
* Sets the value of the [exists] column.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
*
* @param boolean $v new value
* @param boolean|integer|string $v The new value
* @return CcMusicDirs The current object (for fluent API support)
*/
public function setExists($v)
{
if ($v !== null) {
if (is_string($v)) {
$v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
} else {
$v = (boolean) $v;
}
}
if ($this->exists !== $v || $this->isNew()) {
if ($this->exists !== $v) {
$this->exists = $v;
$this->modifiedColumns[] = CcMusicDirsPeer::EXISTS;
}
return $this;
} // setExists()
/**
* Set the value of [watched] column.
* Sets the value of the [watched] column.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
*
* @param boolean $v new value
* @param boolean|integer|string $v The new value
* @return CcMusicDirs The current object (for fluent API support)
*/
public function setWatched($v)
{
if ($v !== null) {
if (is_string($v)) {
$v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
} else {
$v = (boolean) $v;
}
}
if ($this->watched !== $v || $this->isNew()) {
if ($this->watched !== $v) {
$this->watched = $v;
$this->modifiedColumns[] = CcMusicDirsPeer::WATCHED;
}
return $this;
} // setWatched()
@ -265,7 +309,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
return false;
}
// otherwise, everything was equal, so return TRUE
// otherwise, everything was equal, so return true
return true;
} // hasOnlyDefaultValues()
@ -278,7 +322,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
* 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 int $startcol 0-based offset column which indicates which resultset 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.
@ -299,8 +343,9 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
if ($rehydrate) {
$this->ensureConsistency();
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 5; // 5 = CcMusicDirsPeer::NUM_COLUMNS - CcMusicDirsPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 5; // 5 = CcMusicDirsPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating CcMusicDirs object", $e);
@ -373,6 +418,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
* @param PropelPDO $con
* @return void
* @throws PropelException
* @throws Exception
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
@ -388,18 +434,18 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
$con->beginTransaction();
try {
$deleteQuery = CcMusicDirsQuery::create()
->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con);
if ($ret) {
CcMusicDirsQuery::create()
->filterByPrimaryKey($this->getPrimaryKey())
->delete($con);
$deleteQuery->delete($con);
$this->postDelete($con);
$con->commit();
$this->setDeleted(true);
} else {
$con->commit();
}
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -416,6 +462,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @throws Exception
* @see doSave()
*/
public function save(PropelPDO $con = null)
@ -450,8 +497,9 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
$affectedRows = 0;
}
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -474,32 +522,30 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->modifiedColumns[] = CcMusicDirsPeer::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(CcMusicDirsPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcMusicDirsPeer::ID.')');
}
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows = 1;
$this->setId($pk); //[IMV] update autoincrement primary key
$this->setNew(false);
$this->doInsert($con);
} else {
$affectedRows = CcMusicDirsPeer::doUpdate($this, $con);
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
if ($this->ccFilessScheduledForDeletion !== null) {
if (!$this->ccFilessScheduledForDeletion->isEmpty()) {
foreach ($this->ccFilessScheduledForDeletion as $ccFiles) {
// need to save related object because we set the relation to null
$ccFiles->save($con);
}
$this->ccFilessScheduledForDeletion = null;
}
}
if ($this->collCcFiless !== null) {
foreach ($this->collCcFiless as $referrerFK) {
if (!$referrerFK->isDeleted()) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
@ -508,9 +554,105 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Insert the row in the database.
*
* @param PropelPDO $con
*
* @throws PropelException
* @see doSave()
*/
protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = CcMusicDirsPeer::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcMusicDirsPeer::ID . ')');
}
if (null === $this->id) {
try {
$stmt = $con->query("SELECT nextval('cc_music_dirs_id_seq')");
$row = $stmt->fetch(PDO::FETCH_NUM);
$this->id = $row[0];
} catch (Exception $e) {
throw new PropelException('Unable to get sequence id.', $e);
}
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(CcMusicDirsPeer::ID)) {
$modifiedColumns[':p' . $index++] = '"id"';
}
if ($this->isColumnModified(CcMusicDirsPeer::DIRECTORY)) {
$modifiedColumns[':p' . $index++] = '"directory"';
}
if ($this->isColumnModified(CcMusicDirsPeer::TYPE)) {
$modifiedColumns[':p' . $index++] = '"type"';
}
if ($this->isColumnModified(CcMusicDirsPeer::EXISTS)) {
$modifiedColumns[':p' . $index++] = '"exists"';
}
if ($this->isColumnModified(CcMusicDirsPeer::WATCHED)) {
$modifiedColumns[':p' . $index++] = '"watched"';
}
$sql = sprintf(
'INSERT INTO "cc_music_dirs" (%s) VALUES (%s)',
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case '"id"':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case '"directory"':
$stmt->bindValue($identifier, $this->directory, PDO::PARAM_STR);
break;
case '"type"':
$stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
break;
case '"exists"':
$stmt->bindValue($identifier, $this->exists, PDO::PARAM_BOOL);
break;
case '"watched"':
$stmt->bindValue($identifier, $this->watched, PDO::PARAM_BOOL);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
}
$this->setNew(false);
}
/**
* Update the row in the database.
*
* @param PropelPDO $con
*
* @see doSave()
*/
protected function doUpdate(PropelPDO $con)
{
$selectCriteria = $this->buildPkeyCriteria();
$valuesCriteria = $this->buildCriteria();
BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
}
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
@ -545,11 +687,13 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
$this->validationFailures = $res;
return false;
}
/**
@ -557,10 +701,10 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*
* 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.
* an aggregated 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.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
@ -597,13 +741,15 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcMusicDirsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
$field = $this->getByPosition($pos);
return $field;
}
@ -647,12 +793,18 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
* @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 $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
* @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)
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['CcMusicDirs'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['CcMusicDirs'][$this->getPrimaryKey()] = true;
$keys = CcMusicDirsPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getId(),
@ -661,6 +813,17 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
$keys[3] => $this->getExists(),
$keys[4] => $this->getWatched(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
$result[$key] = $virtualColumn;
}
if ($includeForeignObjects) {
if (null !== $this->collCcFiless) {
$result['CcFiless'] = $this->collCcFiless->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
}
return $result;
}
@ -671,13 +834,15 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcMusicDirsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
$this->setByPosition($pos, $value);
}
/**
@ -720,7 +885,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
* 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')
* The default key type is the column's BasePeer::TYPE_PHPNAME
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
@ -797,6 +962,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*/
public function isPrimaryKeyNull()
{
return null === $this->getId();
}
@ -808,19 +974,22 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*
* @param object $copyObj An object of CcMusicDirs (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setDirectory($this->directory);
$copyObj->setType($this->type);
$copyObj->setExists($this->exists);
$copyObj->setWatched($this->watched);
$copyObj->setDirectory($this->getDirectory());
$copyObj->setType($this->getType());
$copyObj->setExists($this->getExists());
$copyObj->setWatched($this->getWatched());
if ($deepCopy) {
if ($deepCopy && !$this->startCopy) {
// important: temporarily setNew(false) because this affects the behavior of
// the getter/setter methods for fkey referrer objects.
$copyObj->setNew(false);
// store object hash to prevent cycle
$this->startCopy = true;
foreach ($this->getCcFiless() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
@ -828,12 +997,15 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
}
}
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
if ($makeNew) {
$copyObj->setNew(true);
$copyObj->setId(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.
@ -853,6 +1025,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
@ -870,21 +1043,51 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
if (self::$peer === null) {
self::$peer = new CcMusicDirsPeer();
}
return self::$peer;
}
/**
* Initializes a collection based on the name of a relation.
* Avoids crafting an 'init[$relationName]s' method name
* that wouldn't work when StandardEnglishPluralizer is used.
*
* @param string $relationName The name of the relation to initialize
* @return void
*/
public function initRelation($relationName)
{
if ('CcFiles' == $relationName) {
$this->initCcFiless();
}
}
/**
* Clears out the collCcFiless 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
* @return CcMusicDirs The current object (for fluent API support)
* @see addCcFiless()
*/
public function clearCcFiless()
{
$this->collCcFiless = null; // important to set this to NULL since that means it is uninitialized
$this->collCcFiless = null; // important to set this to null since that means it is uninitialized
$this->collCcFilessPartial = null;
return $this;
}
/**
* reset is the collCcFiless collection loaded partially
*
* @return void
*/
public function resetPartialCcFiless($v = true)
{
$this->collCcFilessPartial = $v;
}
/**
@ -894,10 +1097,16 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
* 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.
*
* @param boolean $overrideExisting If set to true, the method call initializes
* the collection even if it is not empty
*
* @return void
*/
public function initCcFiless()
public function initCcFiless($overrideExisting = true)
{
if (null !== $this->collCcFiless && !$overrideExisting) {
return;
}
$this->collCcFiless = new PropelObjectCollection();
$this->collCcFiless->setModel('CcFiles');
}
@ -913,12 +1122,13 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @return PropelCollection|array CcFiles[] List of CcFiles objects
* @return PropelObjectCollection|CcFiles[] List of CcFiles objects
* @throws PropelException
*/
public function getCcFiless($criteria = null, PropelPDO $con = null)
{
if(null === $this->collCcFiless || null !== $criteria) {
$partial = $this->collCcFilessPartial && !$this->isNew();
if (null === $this->collCcFiless || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collCcFiless) {
// return empty collection
$this->initCcFiless();
@ -927,14 +1137,71 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
->filterByCcMusicDirs($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collCcFilessPartial && count($collCcFiless)) {
$this->initCcFiless(false);
foreach ($collCcFiless as $obj) {
if (false == $this->collCcFiless->contains($obj)) {
$this->collCcFiless->append($obj);
}
}
$this->collCcFilessPartial = true;
}
$collCcFiless->getInternalIterator()->rewind();
return $collCcFiless;
}
if ($partial && $this->collCcFiless) {
foreach ($this->collCcFiless as $obj) {
if ($obj->isNew()) {
$collCcFiless[] = $obj;
}
}
}
$this->collCcFiless = $collCcFiless;
$this->collCcFilessPartial = false;
}
}
return $this->collCcFiless;
}
/**
* Sets a collection of CcFiles objects related by a one-to-many relationship
* to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
* @param PropelCollection $ccFiless A Propel collection.
* @param PropelPDO $con Optional connection object
* @return CcMusicDirs The current object (for fluent API support)
*/
public function setCcFiless(PropelCollection $ccFiless, PropelPDO $con = null)
{
$ccFilessToDelete = $this->getCcFiless(new Criteria(), $con)->diff($ccFiless);
$this->ccFilessScheduledForDeletion = $ccFilessToDelete;
foreach ($ccFilessToDelete as $ccFilesRemoved) {
$ccFilesRemoved->setCcMusicDirs(null);
}
$this->collCcFiless = null;
foreach ($ccFiless as $ccFiles) {
$this->addCcFiles($ccFiles);
}
$this->collCcFiless = $ccFiless;
$this->collCcFilessPartial = false;
return $this;
}
/**
* Returns the number of related CcFiles objects.
*
@ -946,42 +1213,81 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
*/
public function countCcFiless(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
if(null === $this->collCcFiless || null !== $criteria) {
$partial = $this->collCcFilessPartial && !$this->isNew();
if (null === $this->collCcFiless || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collCcFiless) {
return 0;
} else {
}
if ($partial && !$criteria) {
return count($this->getCcFiless());
}
$query = CcFilesQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByCcMusicDirs($this)
->count($con);
}
} else {
return count($this->collCcFiless);
}
}
/**
* Method called to associate a CcFiles object to this object
* through the CcFiles foreign key attribute.
*
* @param CcFiles $l CcFiles
* @return void
* @throws PropelException
* @return CcMusicDirs The current object (for fluent API support)
*/
public function addCcFiles(CcFiles $l)
{
if ($this->collCcFiless === null) {
$this->initCcFiless();
$this->collCcFilessPartial = true;
}
if (!$this->collCcFiless->contains($l)) { // only add it if the **same** object is not already associated
$this->collCcFiless[]= $l;
$l->setCcMusicDirs($this);
if (!in_array($l, $this->collCcFiless->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddCcFiles($l);
if ($this->ccFilessScheduledForDeletion and $this->ccFilessScheduledForDeletion->contains($l)) {
$this->ccFilessScheduledForDeletion->remove($this->ccFilessScheduledForDeletion->search($l));
}
}
return $this;
}
/**
* @param CcFiles $ccFiles The ccFiles object to add.
*/
protected function doAddCcFiles($ccFiles)
{
$this->collCcFiless[]= $ccFiles;
$ccFiles->setCcMusicDirs($this);
}
/**
* @param CcFiles $ccFiles The ccFiles object to remove.
* @return CcMusicDirs The current object (for fluent API support)
*/
public function removeCcFiles($ccFiles)
{
if ($this->getCcFiless()->contains($ccFiles)) {
$this->collCcFiless->remove($this->collCcFiless->search($ccFiles));
if (null === $this->ccFilessScheduledForDeletion) {
$this->ccFilessScheduledForDeletion = clone $this->collCcFiless;
$this->ccFilessScheduledForDeletion->clear();
}
$this->ccFilessScheduledForDeletion[]= $ccFiles;
$ccFiles->setCcMusicDirs(null);
}
return $this;
}
/**
* If this collection has already been initialized with
@ -997,7 +1303,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
* @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 CcFiles[] List of CcFiles objects
* @return PropelObjectCollection|CcFiles[] List of CcFiles objects
*/
public function getCcFilessJoinFkOwner($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
@ -1022,7 +1328,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
* @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 CcFiles[] List of CcFiles objects
* @return PropelObjectCollection|CcFiles[] List of CcFiles objects
*/
public function getCcFilessJoinCcSubjsRelatedByDbEditedby($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
@ -1044,6 +1350,7 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
$this->watched = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;
$this->clearAllReferences();
$this->applyDefaultValues();
$this->resetModified();
@ -1052,44 +1359,51 @@ abstract class BaseCcMusicDirs extends BaseObject implements Persistent
}
/**
* Resets all collections of referencing foreign keys.
* Resets all references to other model objects or collections of model objects.
*
* 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.
* This method is a user-space workaround for PHP's inability to garbage collect
* objects with circular references (even in PHP 5.3). This is currently necessary
* when using Propel in certain daemon or large-volume/high-memory operations.
*
* @param boolean $deep Whether to also clear the references on all associated objects.
* @param boolean $deep Whether to also clear the references on all referrer objects.
*/
public function clearAllReferences($deep = false)
{
if ($deep) {
if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true;
if ($this->collCcFiless) {
foreach ((array) $this->collCcFiless as $o) {
foreach ($this->collCcFiless as $o) {
$o->clearAllReferences($deep);
}
}
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
if ($this->collCcFiless instanceof PropelCollection) {
$this->collCcFiless->clearIterator();
}
$this->collCcFiless = null;
}
/**
* Catches calls to virtual methods
* return the string representation of this object
*
* @return string
*/
public function __call($name, $params)
public function __toString()
{
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);
return (string) $this->exportTo(CcMusicDirsPeer::DEFAULT_STRING_FORMAT);
}
} // BaseCcMusicDirs
/**
* return true is the object is in saving state
*
* @return boolean
*/
public function isAlreadyInSave()
{
return $this->alreadyInSave;
}
}

View File

@ -8,7 +8,8 @@
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcMusicDirsPeer {
abstract class BaseCcMusicDirsPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
@ -19,9 +20,6 @@ abstract class BaseCcMusicDirsPeer {
/** the related Propel class for this table */
const OM_CLASS = 'CcMusicDirs';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcMusicDirs';
/** the related TableMap class for this table */
const TM_CLASS = 'CcMusicDirsTableMap';
@ -31,23 +29,29 @@ abstract class BaseCcMusicDirsPeer {
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_music_dirs.ID';
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 5;
/** the column name for the DIRECTORY field */
const DIRECTORY = 'cc_music_dirs.DIRECTORY';
/** the column name for the id field */
const ID = 'cc_music_dirs.id';
/** the column name for the TYPE field */
const TYPE = 'cc_music_dirs.TYPE';
/** the column name for the directory field */
const DIRECTORY = 'cc_music_dirs.directory';
/** the column name for the EXISTS field */
const EXISTS = 'cc_music_dirs.EXISTS';
/** the column name for the type field */
const TYPE = 'cc_music_dirs.type';
/** the column name for the WATCHED field */
const WATCHED = 'cc_music_dirs.WATCHED';
/** the column name for the exists field */
const EXISTS = 'cc_music_dirs.exists';
/** the column name for the watched field */
const WATCHED = 'cc_music_dirs.watched';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CcMusicDirs objects.
* An identity map to hold any loaded instances of CcMusicDirs objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcMusicDirs[]
@ -59,12 +63,12 @@ abstract class BaseCcMusicDirsPeer {
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
* e.g. CcMusicDirsPeer::$fieldNames[CcMusicDirsPeer::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Directory', 'Type', 'Exists', 'Watched', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'directory', 'type', 'exists', 'watched', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::DIRECTORY, self::TYPE, self::EXISTS, self::WATCHED, ),
BasePeer::TYPE_COLNAME => array (CcMusicDirsPeer::ID, CcMusicDirsPeer::DIRECTORY, CcMusicDirsPeer::TYPE, CcMusicDirsPeer::EXISTS, CcMusicDirsPeer::WATCHED, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'DIRECTORY', 'TYPE', 'EXISTS', 'WATCHED', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'directory', 'type', 'exists', 'watched', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
@ -74,12 +78,12 @@ abstract class BaseCcMusicDirsPeer {
* 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
* e.g. CcMusicDirsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Directory' => 1, 'Type' => 2, 'Exists' => 3, 'Watched' => 4, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'directory' => 1, 'type' => 2, 'exists' => 3, 'watched' => 4, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::DIRECTORY => 1, self::TYPE => 2, self::EXISTS => 3, self::WATCHED => 4, ),
BasePeer::TYPE_COLNAME => array (CcMusicDirsPeer::ID => 0, CcMusicDirsPeer::DIRECTORY => 1, CcMusicDirsPeer::TYPE => 2, CcMusicDirsPeer::EXISTS => 3, CcMusicDirsPeer::WATCHED => 4, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'DIRECTORY' => 1, 'TYPE' => 2, 'EXISTS' => 3, 'WATCHED' => 4, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'directory' => 1, 'type' => 2, 'exists' => 3, 'watched' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
@ -95,13 +99,14 @@ abstract class BaseCcMusicDirsPeer {
* @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)
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = CcMusicDirsPeer::getFieldNames($toType);
$key = isset(CcMusicDirsPeer::$fieldKeys[$fromType][$name]) ? CcMusicDirsPeer::$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));
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcMusicDirsPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@ -112,14 +117,15 @@ abstract class BaseCcMusicDirsPeer {
* 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
* @throws PropelException - if the type is not valid.
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
if (!array_key_exists($type, CcMusicDirsPeer::$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];
return CcMusicDirsPeer::$fieldNames[$type];
}
/**
@ -160,11 +166,11 @@ abstract class BaseCcMusicDirsPeer {
$criteria->addSelectColumn(CcMusicDirsPeer::EXISTS);
$criteria->addSelectColumn(CcMusicDirsPeer::WATCHED);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.DIRECTORY');
$criteria->addSelectColumn($alias . '.TYPE');
$criteria->addSelectColumn($alias . '.EXISTS');
$criteria->addSelectColumn($alias . '.WATCHED');
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.directory');
$criteria->addSelectColumn($alias . '.type');
$criteria->addSelectColumn($alias . '.exists');
$criteria->addSelectColumn($alias . '.watched');
}
}
@ -195,7 +201,7 @@ abstract class BaseCcMusicDirsPeer {
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
$criteria->setDbName(CcMusicDirsPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -209,10 +215,11 @@ abstract class BaseCcMusicDirsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
@ -228,10 +235,11 @@ abstract class BaseCcMusicDirsPeer {
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
@ -246,7 +254,7 @@ abstract class BaseCcMusicDirsPeer {
/**
* 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
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
@ -268,7 +276,7 @@ abstract class BaseCcMusicDirsPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcMusicDirsPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
@ -282,16 +290,16 @@ abstract class BaseCcMusicDirsPeer {
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcMusicDirs $value A CcMusicDirs object.
* @param CcMusicDirs $obj A CcMusicDirs object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcMusicDirs $obj, $key = null)
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
} // if key === null
self::$instances[$key] = $obj;
CcMusicDirsPeer::$instances[$key] = $obj;
}
}
@ -304,6 +312,9 @@ abstract class BaseCcMusicDirsPeer {
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcMusicDirs object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
@ -318,7 +329,7 @@ abstract class BaseCcMusicDirsPeer {
throw $e;
}
unset(self::$instances[$key]);
unset(CcMusicDirsPeer::$instances[$key]);
}
} // removeInstanceFromPool()
@ -329,16 +340,17 @@ abstract class BaseCcMusicDirsPeer {
* 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 CcMusicDirs Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @return CcMusicDirs 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];
if (isset(CcMusicDirsPeer::$instances[$key])) {
return CcMusicDirsPeer::$instances[$key];
}
}
return null; // just to be explicit
}
@ -347,9 +359,14 @@ abstract class BaseCcMusicDirsPeer {
*
* @return void
*/
public static function clearInstancePool()
public static function clearInstancePool($and_clear_all_references = false)
{
self::$instances = array();
if ($and_clear_all_references) {
foreach (CcMusicDirsPeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcMusicDirsPeer::$instances = array();
}
/**
@ -368,14 +385,15 @@ abstract class BaseCcMusicDirsPeer {
*
* @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.
* @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 the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
@ -390,6 +408,7 @@ abstract class BaseCcMusicDirsPeer {
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
@ -405,7 +424,7 @@ abstract class BaseCcMusicDirsPeer {
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcMusicDirsPeer::getOMClass(false);
$cls = CcMusicDirsPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, 0);
@ -422,6 +441,7 @@ abstract class BaseCcMusicDirsPeer {
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
@ -440,15 +460,17 @@ abstract class BaseCcMusicDirsPeer {
// 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 + CcMusicDirsPeer::NUM_COLUMNS;
$col = $startcol + CcMusicDirsPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CcMusicDirsPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcMusicDirsPeer::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.
@ -458,7 +480,7 @@ abstract class BaseCcMusicDirsPeer {
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
return Propel::getDatabaseMap(CcMusicDirsPeer::DATABASE_NAME)->getTable(CcMusicDirsPeer::TABLE_NAME);
}
/**
@ -467,30 +489,24 @@ abstract class BaseCcMusicDirsPeer {
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcMusicDirsPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcMusicDirsPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcMusicDirsTableMap());
if (!$dbMap->hasTable(BaseCcMusicDirsPeer::TABLE_NAME)) {
$dbMap->addTableObject(new \CcMusicDirsTableMap());
}
}
/**
* 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
* @return string ClassName
*/
public static function getOMClass($withPrefix = true)
public static function getOMClass($row = 0, $colnum = 0)
{
return $withPrefix ? CcMusicDirsPeer::CLASS_DEFAULT : CcMusicDirsPeer::OM_CLASS;
return CcMusicDirsPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcMusicDirs or Criteria object.
* Performs an INSERT on the database, given a CcMusicDirs or Criteria object.
*
* @param mixed $values Criteria or CcMusicDirs object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
@ -516,7 +532,7 @@ abstract class BaseCcMusicDirsPeer {
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcMusicDirsPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
@ -524,7 +540,7 @@ abstract class BaseCcMusicDirsPeer {
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -533,7 +549,7 @@ abstract class BaseCcMusicDirsPeer {
}
/**
* Method perform an UPDATE on the database, given a CcMusicDirs or Criteria object.
* Performs an UPDATE on the database, given a CcMusicDirs or Criteria object.
*
* @param mixed $values Criteria or CcMusicDirs 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).
@ -547,7 +563,7 @@ abstract class BaseCcMusicDirsPeer {
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
$selectCriteria = new Criteria(CcMusicDirsPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
@ -566,17 +582,19 @@ abstract class BaseCcMusicDirsPeer {
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcMusicDirsPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_music_dirs table.
* Deletes all rows from the cc_music_dirs table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll($con = null)
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
@ -593,15 +611,16 @@ abstract class BaseCcMusicDirsPeer {
CcMusicDirsPeer::clearInstancePool();
CcMusicDirsPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcMusicDirs or Criteria object OR a primary key value.
* Performs a DELETE on the database, given a CcMusicDirs or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcMusicDirs object or primary key or array of primary keys
* which is used to create the DELETE statement
@ -630,7 +649,7 @@ abstract class BaseCcMusicDirsPeer {
// 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 = new Criteria(CcMusicDirsPeer::DATABASE_NAME);
$criteria->add(CcMusicDirsPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
@ -639,7 +658,7 @@ abstract class BaseCcMusicDirsPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcMusicDirsPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@ -651,8 +670,9 @@ abstract class BaseCcMusicDirsPeer {
$affectedRows += BasePeer::doDelete($criteria, $con);
CcMusicDirsPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -670,7 +690,7 @@ abstract class BaseCcMusicDirsPeer {
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(CcMusicDirs $obj, $cols = null)
public static function doValidate($obj, $cols = null)
{
$columns = array();
@ -683,7 +703,7 @@ abstract class BaseCcMusicDirsPeer {
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
@ -726,6 +746,7 @@ abstract class BaseCcMusicDirsPeer {
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcMusicDirs[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
@ -743,6 +764,7 @@ abstract class BaseCcMusicDirsPeer {
$criteria->add(CcMusicDirsPeer::ID, $pks, Criteria::IN);
$objs = CcMusicDirsPeer::doSelect($criteria, $con);
}
return $objs;
}

View File

@ -22,14 +22,13 @@
* @method CcMusicDirsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcMusicDirsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcMusicDirsQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation
* @method CcMusicDirsQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
* @method CcMusicDirsQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
* @method CcMusicDirsQuery leftJoinCcFiles($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcFiles relation
* @method CcMusicDirsQuery rightJoinCcFiles($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcFiles relation
* @method CcMusicDirsQuery innerJoinCcFiles($relationAlias = null) Adds a INNER JOIN clause to the query using the CcFiles relation
*
* @method CcMusicDirs findOne(PropelPDO $con = null) Return the first CcMusicDirs matching the query
* @method CcMusicDirs findOneOrCreate(PropelPDO $con = null) Return the first CcMusicDirs matching the query, or a new CcMusicDirs object populated from the query conditions when no match is found
*
* @method CcMusicDirs findOneById(int $id) Return the first CcMusicDirs filtered by the id column
* @method CcMusicDirs findOneByDirectory(string $directory) Return the first CcMusicDirs filtered by the directory column
* @method CcMusicDirs findOneByType(string $type) Return the first CcMusicDirs filtered by the type column
* @method CcMusicDirs findOneByExists(boolean $exists) Return the first CcMusicDirs filtered by the exists column
@ -45,7 +44,6 @@
*/
abstract class BaseCcMusicDirsQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcMusicDirsQuery object.
*
@ -53,8 +51,14 @@ abstract class BaseCcMusicDirsQuery extends ModelCriteria
* @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 = 'CcMusicDirs', $modelAlias = null)
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'airtime';
}
if (null === $modelName) {
$modelName = 'CcMusicDirs';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
@ -62,7 +66,7 @@ abstract class BaseCcMusicDirsQuery extends ModelCriteria
* Returns a new CcMusicDirsQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
* @param CcMusicDirsQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CcMusicDirsQuery
*/
@ -71,41 +75,115 @@ abstract class BaseCcMusicDirsQuery extends ModelCriteria
if ($criteria instanceof CcMusicDirsQuery) {
return $criteria;
}
$query = new CcMusicDirsQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
$query = new CcMusicDirsQuery(null, null, $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
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <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 CcMusicDirs|array|mixed the result, formatted by the current formatter
* @return CcMusicDirs|CcMusicDirs[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcMusicDirsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
if ($key === null) {
return null;
}
if ((null !== ($obj = CcMusicDirsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
// the object has not been requested yet, or the formatter is not an object formatter
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcMusicDirs A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneById($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcMusicDirs A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "id", "directory", "type", "exists", "watched" FROM "cc_music_dirs" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CcMusicDirs();
$obj->hydrate($row);
CcMusicDirsPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcMusicDirs|CcMusicDirs[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
@ -115,14 +193,20 @@ abstract class BaseCcMusicDirsQuery extends ModelCriteria
* @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
* @return PropelObjectCollection|CcMusicDirs[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
$stmt = $criteria
->filterByPrimaryKeys($keys)
->find($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
@ -134,6 +218,7 @@ abstract class BaseCcMusicDirsQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcMusicDirsPeer::ID, $key, Criteria::EQUAL);
}
@ -146,29 +231,61 @@ abstract class BaseCcMusicDirsQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcMusicDirsPeer::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* @param int|array $id The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id >= 12
* $query->filterById(array('max' => 12)); // WHERE id <= 12
* </code>
*
* @param mixed $id The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcMusicDirsQuery The current query, for fluid interface
*/
public function filterById($id = null, $comparison = null)
{
if (is_array($id) && null === $comparison) {
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
$this->addUsingAlias(CcMusicDirsPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
$this->addUsingAlias(CcMusicDirsPeer::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcMusicDirsPeer::ID, $id, $comparison);
}
/**
* Filter the query on the directory column
*
* Example usage:
* <code>
* $query->filterByDirectory('fooValue'); // WHERE directory = 'fooValue'
* $query->filterByDirectory('%fooValue%'); // WHERE directory LIKE '%fooValue%'
* </code>
*
* @param string $directory 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
@ -185,12 +302,19 @@ abstract class BaseCcMusicDirsQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcMusicDirsPeer::DIRECTORY, $directory, $comparison);
}
/**
* Filter the query on the type column
*
* Example usage:
* <code>
* $query->filterByType('fooValue'); // WHERE type = 'fooValue'
* $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%'
* </code>
*
* @param string $type 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
@ -207,14 +331,24 @@ abstract class BaseCcMusicDirsQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcMusicDirsPeer::TYPE, $type, $comparison);
}
/**
* Filter the query on the exists column
*
* Example usage:
* <code>
* $query->filterByExists(true); // WHERE exists = true
* $query->filterByExists('yes'); // WHERE exists = true
* </code>
*
* @param boolean|string $exists The value to use as filter.
* Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true)
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcMusicDirsQuery The current query, for fluid interface
@ -222,16 +356,26 @@ abstract class BaseCcMusicDirsQuery extends ModelCriteria
public function filterByExists($exists = null, $comparison = null)
{
if (is_string($exists)) {
$exists = in_array(strtolower($exists), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
$exists = in_array(strtolower($exists), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(CcMusicDirsPeer::EXISTS, $exists, $comparison);
}
/**
* Filter the query on the watched column
*
* Example usage:
* <code>
* $query->filterByWatched(true); // WHERE watched = true
* $query->filterByWatched('yes'); // WHERE watched = true
* </code>
*
* @param boolean|string $watched The value to use as filter.
* Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true)
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcMusicDirsQuery The current query, for fluid interface
@ -239,23 +383,34 @@ abstract class BaseCcMusicDirsQuery extends ModelCriteria
public function filterByWatched($watched = null, $comparison = null)
{
if (is_string($watched)) {
$watched = in_array(strtolower($watched), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
$watched = in_array(strtolower($watched), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(CcMusicDirsPeer::WATCHED, $watched, $comparison);
}
/**
* Filter the query by a related CcFiles object
*
* @param CcFiles $ccFiles the related object to use as filter
* @param CcFiles|PropelObjectCollection $ccFiles the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcMusicDirsQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcFiles($ccFiles, $comparison = null)
{
if ($ccFiles instanceof CcFiles) {
return $this
->addUsingAlias(CcMusicDirsPeer::ID, $ccFiles->getDbDirectory(), $comparison);
} elseif ($ccFiles instanceof PropelObjectCollection) {
return $this
->useCcFilesQuery()
->filterByPrimaryKeys($ccFiles->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCcFiles() only accepts arguments of type CcFiles or PropelCollection');
}
}
/**
@ -266,7 +421,7 @@ abstract class BaseCcMusicDirsQuery extends ModelCriteria
*
* @return CcMusicDirsQuery The current query, for fluid interface
*/
public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function joinCcFiles($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcFiles');
@ -301,7 +456,7 @@ abstract class BaseCcMusicDirsQuery extends ModelCriteria
*
* @return CcFilesQuery A secondary query class using the current class as primary query
*/
public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function useCcFilesQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcFiles($relationAlias, $joinType)
@ -324,4 +479,4 @@ abstract class BaseCcMusicDirsQuery extends ModelCriteria
return $this;
}
} // BaseCcMusicDirsQuery
}

View File

@ -10,7 +10,6 @@
*/
abstract class BaseCcPerms extends BaseObject implements Persistent
{
/**
* Peer class name
*/
@ -24,6 +23,12 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*/
protected static $peer;
/**
* The flag var to prevent infinite loop in deep copy
* @var boolean
*/
protected $startCopy = false;
/**
* The value for the permid field.
* @var int
@ -73,6 +78,12 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
/**
* Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
* @var boolean
*/
protected $alreadyInClearAllReferencesDeep = false;
/**
* Get the [permid] column value.
*
@ -80,6 +91,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*/
public function getPermid()
{
return $this->permid;
}
@ -90,6 +102,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*/
public function getSubj()
{
return $this->subj;
}
@ -100,6 +113,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*/
public function getAction()
{
return $this->action;
}
@ -110,6 +124,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*/
public function getObj()
{
return $this->obj;
}
@ -120,6 +135,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*/
public function getType()
{
return $this->type;
}
@ -131,7 +147,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*/
public function setPermid($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -140,6 +156,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$this->modifiedColumns[] = CcPermsPeer::PERMID;
}
return $this;
} // setPermid()
@ -151,7 +168,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*/
public function setSubj($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -164,6 +181,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$this->aCcSubjs = null;
}
return $this;
} // setSubj()
@ -175,7 +193,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*/
public function setAction($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -184,6 +202,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$this->modifiedColumns[] = CcPermsPeer::ACTION;
}
return $this;
} // setAction()
@ -195,7 +214,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*/
public function setObj($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -204,6 +223,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$this->modifiedColumns[] = CcPermsPeer::OBJ;
}
return $this;
} // setObj()
@ -215,7 +235,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*/
public function setType($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -224,6 +244,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$this->modifiedColumns[] = CcPermsPeer::TYPE;
}
return $this;
} // setType()
@ -237,7 +258,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*/
public function hasOnlyDefaultValues()
{
// otherwise, everything was equal, so return TRUE
// otherwise, everything was equal, so return true
return true;
} // hasOnlyDefaultValues()
@ -250,7 +271,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
* 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 int $startcol 0-based offset column which indicates which resultset 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.
@ -271,8 +292,9 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
if ($rehydrate) {
$this->ensureConsistency();
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 5; // 5 = CcPermsPeer::NUM_COLUMNS - CcPermsPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 5; // 5 = CcPermsPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating CcPerms object", $e);
@ -347,6 +369,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
* @param PropelPDO $con
* @return void
* @throws PropelException
* @throws Exception
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
@ -362,18 +385,18 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$con->beginTransaction();
try {
$deleteQuery = CcPermsQuery::create()
->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con);
if ($ret) {
CcPermsQuery::create()
->filterByPrimaryKey($this->getPrimaryKey())
->delete($con);
$deleteQuery->delete($con);
$this->postDelete($con);
$con->commit();
$this->setDeleted(true);
} else {
$con->commit();
}
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -390,6 +413,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @throws Exception
* @see doSave()
*/
public function save(PropelPDO $con = null)
@ -424,8 +448,9 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$affectedRows = 0;
}
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -449,7 +474,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
@ -460,27 +485,105 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$this->setCcSubjs($this->aCcSubjs);
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$criteria = $this->buildCriteria();
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows += 1;
$this->setNew(false);
$this->doInsert($con);
} else {
$affectedRows += CcPermsPeer::doUpdate($this, $con);
$this->doUpdate($con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
$affectedRows += 1;
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Insert the row in the database.
*
* @param PropelPDO $con
*
* @throws PropelException
* @see doSave()
*/
protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(CcPermsPeer::PERMID)) {
$modifiedColumns[':p' . $index++] = '"permid"';
}
if ($this->isColumnModified(CcPermsPeer::SUBJ)) {
$modifiedColumns[':p' . $index++] = '"subj"';
}
if ($this->isColumnModified(CcPermsPeer::ACTION)) {
$modifiedColumns[':p' . $index++] = '"action"';
}
if ($this->isColumnModified(CcPermsPeer::OBJ)) {
$modifiedColumns[':p' . $index++] = '"obj"';
}
if ($this->isColumnModified(CcPermsPeer::TYPE)) {
$modifiedColumns[':p' . $index++] = '"type"';
}
$sql = sprintf(
'INSERT INTO "cc_perms" (%s) VALUES (%s)',
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case '"permid"':
$stmt->bindValue($identifier, $this->permid, PDO::PARAM_INT);
break;
case '"subj"':
$stmt->bindValue($identifier, $this->subj, PDO::PARAM_INT);
break;
case '"action"':
$stmt->bindValue($identifier, $this->action, PDO::PARAM_STR);
break;
case '"obj"':
$stmt->bindValue($identifier, $this->obj, PDO::PARAM_INT);
break;
case '"type"':
$stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
}
$this->setNew(false);
}
/**
* Update the row in the database.
*
* @param PropelPDO $con
*
* @see doSave()
*/
protected function doUpdate(PropelPDO $con)
{
$selectCriteria = $this->buildPkeyCriteria();
$valuesCriteria = $this->buildCriteria();
BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
}
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
@ -515,11 +618,13 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
$this->validationFailures = $res;
return false;
}
/**
@ -527,10 +632,10 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*
* 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.
* an aggregated 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.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
@ -542,7 +647,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
// We call the validate method on the following object(s) if they
// were passed to this object by their coresponding set
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
@ -571,13 +676,15 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcPermsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
$field = $this->getByPosition($pos);
return $field;
}
@ -621,13 +728,18 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
* @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 $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
* @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)
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['CcPerms'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['CcPerms'][$this->getPrimaryKey()] = true;
$keys = CcPermsPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getPermid(),
@ -636,11 +748,17 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$keys[3] => $this->getObj(),
$keys[4] => $this->getType(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
$result[$key] = $virtualColumn;
}
if ($includeForeignObjects) {
if (null !== $this->aCcSubjs) {
$result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true);
$result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
}
return $result;
}
@ -651,13 +769,15 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcPermsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
$this->setByPosition($pos, $value);
}
/**
@ -700,7 +820,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
* 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')
* The default key type is the column's BasePeer::TYPE_PHPNAME
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
@ -777,6 +897,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*/
public function isPrimaryKeyNull()
{
return null === $this->getPermid();
}
@ -788,17 +909,31 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
*
* @param object $copyObj An object of CcPerms (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setPermid($this->permid);
$copyObj->setSubj($this->subj);
$copyObj->setAction($this->action);
$copyObj->setObj($this->obj);
$copyObj->setType($this->type);
$copyObj->setSubj($this->getSubj());
$copyObj->setAction($this->getAction());
$copyObj->setObj($this->getObj());
$copyObj->setType($this->getType());
if ($deepCopy && !$this->startCopy) {
// important: temporarily setNew(false) because this affects the behavior of
// the getter/setter methods for fkey referrer objects.
$copyObj->setNew(false);
// store object hash to prevent cycle
$this->startCopy = true;
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
if ($makeNew) {
$copyObj->setNew(true);
$copyObj->setPermid(NULL); // this is a auto-increment column, so set to default value
}
}
/**
@ -819,6 +954,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
@ -836,6 +972,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
if (self::$peer === null) {
self::$peer = new CcPermsPeer();
}
return self::$peer;
}
@ -862,6 +999,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$v->addCcPerms($this);
}
return $this;
}
@ -869,13 +1007,14 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
/**
* Get the associated CcSubjs object
*
* @param PropelPDO Optional Connection object.
* @param PropelPDO $con Optional Connection object.
* @param $doQuery Executes a query to get the object if required
* @return CcSubjs The associated CcSubjs object.
* @throws PropelException
*/
public function getCcSubjs(PropelPDO $con = null)
public function getCcSubjs(PropelPDO $con = null, $doQuery = true)
{
if ($this->aCcSubjs === null && ($this->subj !== null)) {
if ($this->aCcSubjs === null && ($this->subj !== null) && $doQuery) {
$this->aCcSubjs = CcSubjsQuery::create()->findPk($this->subj, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
@ -885,6 +1024,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$this->aCcSubjs->addCcPermss($this);
*/
}
return $this->aCcSubjs;
}
@ -900,6 +1040,7 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
$this->type = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;
$this->clearAllReferences();
$this->resetModified();
$this->setNew(true);
@ -907,39 +1048,46 @@ abstract class BaseCcPerms extends BaseObject implements Persistent
}
/**
* Resets all collections of referencing foreign keys.
* Resets all references to other model objects or collections of model objects.
*
* 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.
* This method is a user-space workaround for PHP's inability to garbage collect
* objects with circular references (even in PHP 5.3). This is currently necessary
* when using Propel in certain daemon or large-volume/high-memory operations.
*
* @param boolean $deep Whether to also clear the references on all associated objects.
* @param boolean $deep Whether to also clear the references on all referrer objects.
*/
public function clearAllReferences($deep = false)
{
if ($deep) {
if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true;
if ($this->aCcSubjs instanceof Persistent) {
$this->aCcSubjs->clearAllReferences($deep);
}
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
$this->aCcSubjs = null;
}
/**
* Catches calls to virtual methods
* return the string representation of this object
*
* @return string
*/
public function __call($name, $params)
public function __toString()
{
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);
return (string) $this->exportTo(CcPermsPeer::DEFAULT_STRING_FORMAT);
}
} // BaseCcPerms
/**
* return true is the object is in saving state
*
* @return boolean
*/
public function isAlreadyInSave()
{
return $this->alreadyInSave;
}
}

View File

@ -8,7 +8,8 @@
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPermsPeer {
abstract class BaseCcPermsPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
@ -19,9 +20,6 @@ abstract class BaseCcPermsPeer {
/** the related Propel class for this table */
const OM_CLASS = 'CcPerms';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcPerms';
/** the related TableMap class for this table */
const TM_CLASS = 'CcPermsTableMap';
@ -31,23 +29,29 @@ abstract class BaseCcPermsPeer {
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the PERMID field */
const PERMID = 'cc_perms.PERMID';
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 5;
/** the column name for the SUBJ field */
const SUBJ = 'cc_perms.SUBJ';
/** the column name for the permid field */
const PERMID = 'cc_perms.permid';
/** the column name for the ACTION field */
const ACTION = 'cc_perms.ACTION';
/** the column name for the subj field */
const SUBJ = 'cc_perms.subj';
/** the column name for the OBJ field */
const OBJ = 'cc_perms.OBJ';
/** the column name for the action field */
const ACTION = 'cc_perms.action';
/** the column name for the TYPE field */
const TYPE = 'cc_perms.TYPE';
/** the column name for the obj field */
const OBJ = 'cc_perms.obj';
/** the column name for the type field */
const TYPE = 'cc_perms.type';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CcPerms objects.
* An identity map to hold any loaded instances of CcPerms objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcPerms[]
@ -59,12 +63,12 @@ abstract class BaseCcPermsPeer {
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
* e.g. CcPermsPeer::$fieldNames[CcPermsPeer::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Permid', 'Subj', 'Action', 'Obj', 'Type', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('permid', 'subj', 'action', 'obj', 'type', ),
BasePeer::TYPE_COLNAME => array (self::PERMID, self::SUBJ, self::ACTION, self::OBJ, self::TYPE, ),
BasePeer::TYPE_COLNAME => array (CcPermsPeer::PERMID, CcPermsPeer::SUBJ, CcPermsPeer::ACTION, CcPermsPeer::OBJ, CcPermsPeer::TYPE, ),
BasePeer::TYPE_RAW_COLNAME => array ('PERMID', 'SUBJ', 'ACTION', 'OBJ', 'TYPE', ),
BasePeer::TYPE_FIELDNAME => array ('permid', 'subj', 'action', 'obj', 'type', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
@ -74,12 +78,12 @@ abstract class BaseCcPermsPeer {
* 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
* e.g. CcPermsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Permid' => 0, 'Subj' => 1, 'Action' => 2, 'Obj' => 3, 'Type' => 4, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('permid' => 0, 'subj' => 1, 'action' => 2, 'obj' => 3, 'type' => 4, ),
BasePeer::TYPE_COLNAME => array (self::PERMID => 0, self::SUBJ => 1, self::ACTION => 2, self::OBJ => 3, self::TYPE => 4, ),
BasePeer::TYPE_COLNAME => array (CcPermsPeer::PERMID => 0, CcPermsPeer::SUBJ => 1, CcPermsPeer::ACTION => 2, CcPermsPeer::OBJ => 3, CcPermsPeer::TYPE => 4, ),
BasePeer::TYPE_RAW_COLNAME => array ('PERMID' => 0, 'SUBJ' => 1, 'ACTION' => 2, 'OBJ' => 3, 'TYPE' => 4, ),
BasePeer::TYPE_FIELDNAME => array ('permid' => 0, 'subj' => 1, 'action' => 2, 'obj' => 3, 'type' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
@ -95,13 +99,14 @@ abstract class BaseCcPermsPeer {
* @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)
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = CcPermsPeer::getFieldNames($toType);
$key = isset(CcPermsPeer::$fieldKeys[$fromType][$name]) ? CcPermsPeer::$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));
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcPermsPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@ -112,14 +117,15 @@ abstract class BaseCcPermsPeer {
* 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
* @throws PropelException - if the type is not valid.
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
if (!array_key_exists($type, CcPermsPeer::$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];
return CcPermsPeer::$fieldNames[$type];
}
/**
@ -160,11 +166,11 @@ abstract class BaseCcPermsPeer {
$criteria->addSelectColumn(CcPermsPeer::OBJ);
$criteria->addSelectColumn(CcPermsPeer::TYPE);
} else {
$criteria->addSelectColumn($alias . '.PERMID');
$criteria->addSelectColumn($alias . '.SUBJ');
$criteria->addSelectColumn($alias . '.ACTION');
$criteria->addSelectColumn($alias . '.OBJ');
$criteria->addSelectColumn($alias . '.TYPE');
$criteria->addSelectColumn($alias . '.permid');
$criteria->addSelectColumn($alias . '.subj');
$criteria->addSelectColumn($alias . '.action');
$criteria->addSelectColumn($alias . '.obj');
$criteria->addSelectColumn($alias . '.type');
}
}
@ -195,7 +201,7 @@ abstract class BaseCcPermsPeer {
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
$criteria->setDbName(CcPermsPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -209,10 +215,11 @@ abstract class BaseCcPermsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
@ -228,10 +235,11 @@ abstract class BaseCcPermsPeer {
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
@ -246,7 +254,7 @@ abstract class BaseCcPermsPeer {
/**
* 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
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
@ -268,7 +276,7 @@ abstract class BaseCcPermsPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPermsPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
@ -282,16 +290,16 @@ abstract class BaseCcPermsPeer {
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcPerms $value A CcPerms object.
* @param CcPerms $obj A CcPerms object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcPerms $obj, $key = null)
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getPermid();
} // if key === null
self::$instances[$key] = $obj;
CcPermsPeer::$instances[$key] = $obj;
}
}
@ -304,6 +312,9 @@ abstract class BaseCcPermsPeer {
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcPerms object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
@ -318,7 +329,7 @@ abstract class BaseCcPermsPeer {
throw $e;
}
unset(self::$instances[$key]);
unset(CcPermsPeer::$instances[$key]);
}
} // removeInstanceFromPool()
@ -329,16 +340,17 @@ abstract class BaseCcPermsPeer {
* 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 CcPerms Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @return CcPerms 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];
if (isset(CcPermsPeer::$instances[$key])) {
return CcPermsPeer::$instances[$key];
}
}
return null; // just to be explicit
}
@ -347,9 +359,14 @@ abstract class BaseCcPermsPeer {
*
* @return void
*/
public static function clearInstancePool()
public static function clearInstancePool($and_clear_all_references = false)
{
self::$instances = array();
if ($and_clear_all_references) {
foreach (CcPermsPeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcPermsPeer::$instances = array();
}
/**
@ -368,14 +385,15 @@ abstract class BaseCcPermsPeer {
*
* @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.
* @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 the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
@ -390,6 +408,7 @@ abstract class BaseCcPermsPeer {
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
@ -405,7 +424,7 @@ abstract class BaseCcPermsPeer {
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcPermsPeer::getOMClass(false);
$cls = CcPermsPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcPermsPeer::getPrimaryKeyHashFromRow($row, 0);
@ -422,6 +441,7 @@ abstract class BaseCcPermsPeer {
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
@ -440,16 +460,18 @@ abstract class BaseCcPermsPeer {
// 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 + CcPermsPeer::NUM_COLUMNS;
$col = $startcol + CcPermsPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CcPermsPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcPermsPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the number of rows matching criteria, joining the related CcSubjs table
*
@ -480,7 +502,7 @@ abstract class BaseCcPermsPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPermsPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -496,6 +518,7 @@ abstract class BaseCcPermsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -515,11 +538,11 @@ abstract class BaseCcPermsPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPermsPeer::DATABASE_NAME);
}
CcPermsPeer::addSelectColumns($criteria);
$startcol = (CcPermsPeer::NUM_COLUMNS - CcPermsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol = CcPermsPeer::NUM_HYDRATE_COLUMNS;
CcSubjsPeer::addSelectColumns($criteria);
$criteria->addJoin(CcPermsPeer::SUBJ, CcSubjsPeer::ID, $join_behavior);
@ -535,7 +558,7 @@ abstract class BaseCcPermsPeer {
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPermsPeer::getOMClass(false);
$cls = CcPermsPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -547,7 +570,7 @@ abstract class BaseCcPermsPeer {
$obj2 = CcSubjsPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcSubjsPeer::getOMClass(false);
$cls = CcSubjsPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
@ -562,6 +585,7 @@ abstract class BaseCcPermsPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -596,7 +620,7 @@ abstract class BaseCcPermsPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPermsPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -612,6 +636,7 @@ abstract class BaseCcPermsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -631,14 +656,14 @@ abstract class BaseCcPermsPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPermsPeer::DATABASE_NAME);
}
CcPermsPeer::addSelectColumns($criteria);
$startcol2 = (CcPermsPeer::NUM_COLUMNS - CcPermsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcPermsPeer::NUM_HYDRATE_COLUMNS;
CcSubjsPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcPermsPeer::SUBJ, CcSubjsPeer::ID, $join_behavior);
@ -652,7 +677,7 @@ abstract class BaseCcPermsPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPermsPeer::getOMClass(false);
$cls = CcPermsPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -666,7 +691,7 @@ abstract class BaseCcPermsPeer {
$obj2 = CcSubjsPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcSubjsPeer::getOMClass(false);
$cls = CcSubjsPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -680,6 +705,7 @@ abstract class BaseCcPermsPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -692,7 +718,7 @@ abstract class BaseCcPermsPeer {
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
return Propel::getDatabaseMap(CcPermsPeer::DATABASE_NAME)->getTable(CcPermsPeer::TABLE_NAME);
}
/**
@ -701,30 +727,24 @@ abstract class BaseCcPermsPeer {
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcPermsPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcPermsPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcPermsTableMap());
if (!$dbMap->hasTable(BaseCcPermsPeer::TABLE_NAME)) {
$dbMap->addTableObject(new \CcPermsTableMap());
}
}
/**
* 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
* @return string ClassName
*/
public static function getOMClass($withPrefix = true)
public static function getOMClass($row = 0, $colnum = 0)
{
return $withPrefix ? CcPermsPeer::CLASS_DEFAULT : CcPermsPeer::OM_CLASS;
return CcPermsPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcPerms or Criteria object.
* Performs an INSERT on the database, given a CcPerms or Criteria object.
*
* @param mixed $values Criteria or CcPerms object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
@ -746,7 +766,7 @@ abstract class BaseCcPermsPeer {
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPermsPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
@ -754,7 +774,7 @@ abstract class BaseCcPermsPeer {
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -763,7 +783,7 @@ abstract class BaseCcPermsPeer {
}
/**
* Method perform an UPDATE on the database, given a CcPerms or Criteria object.
* Performs an UPDATE on the database, given a CcPerms or Criteria object.
*
* @param mixed $values Criteria or CcPerms 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).
@ -777,7 +797,7 @@ abstract class BaseCcPermsPeer {
$con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
$selectCriteria = new Criteria(CcPermsPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
@ -796,17 +816,19 @@ abstract class BaseCcPermsPeer {
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPermsPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_perms table.
* Deletes all rows from the cc_perms table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll($con = null)
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
@ -823,15 +845,16 @@ abstract class BaseCcPermsPeer {
CcPermsPeer::clearInstancePool();
CcPermsPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcPerms or Criteria object OR a primary key value.
* Performs a DELETE on the database, given a CcPerms or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcPerms object or primary key or array of primary keys
* which is used to create the DELETE statement
@ -860,7 +883,7 @@ abstract class BaseCcPermsPeer {
// 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 = new Criteria(CcPermsPeer::DATABASE_NAME);
$criteria->add(CcPermsPeer::PERMID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
@ -869,7 +892,7 @@ abstract class BaseCcPermsPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPermsPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@ -881,8 +904,9 @@ abstract class BaseCcPermsPeer {
$affectedRows += BasePeer::doDelete($criteria, $con);
CcPermsPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -900,7 +924,7 @@ abstract class BaseCcPermsPeer {
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(CcPerms $obj, $cols = null)
public static function doValidate($obj, $cols = null)
{
$columns = array();
@ -913,7 +937,7 @@ abstract class BaseCcPermsPeer {
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
@ -956,6 +980,7 @@ abstract class BaseCcPermsPeer {
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcPerms[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
@ -973,6 +998,7 @@ abstract class BaseCcPermsPeer {
$criteria->add(CcPermsPeer::PERMID, $pks, Criteria::IN);
$objs = CcPermsPeer::doSelect($criteria, $con);
}
return $objs;
}

View File

@ -22,14 +22,13 @@
* @method CcPermsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcPermsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcPermsQuery leftJoinCcSubjs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjs relation
* @method CcPermsQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation
* @method CcPermsQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation
* @method CcPermsQuery leftJoinCcSubjs($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjs relation
* @method CcPermsQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation
* @method CcPermsQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs relation
*
* @method CcPerms findOne(PropelPDO $con = null) Return the first CcPerms matching the query
* @method CcPerms findOneOrCreate(PropelPDO $con = null) Return the first CcPerms matching the query, or a new CcPerms object populated from the query conditions when no match is found
*
* @method CcPerms findOneByPermid(int $permid) Return the first CcPerms filtered by the permid column
* @method CcPerms findOneBySubj(int $subj) Return the first CcPerms filtered by the subj column
* @method CcPerms findOneByAction(string $action) Return the first CcPerms filtered by the action column
* @method CcPerms findOneByObj(int $obj) Return the first CcPerms filtered by the obj column
@ -45,7 +44,6 @@
*/
abstract class BaseCcPermsQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcPermsQuery object.
*
@ -53,8 +51,14 @@ abstract class BaseCcPermsQuery extends ModelCriteria
* @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 = 'CcPerms', $modelAlias = null)
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'airtime';
}
if (null === $modelName) {
$modelName = 'CcPerms';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
@ -62,7 +66,7 @@ abstract class BaseCcPermsQuery extends ModelCriteria
* Returns a new CcPermsQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
* @param CcPermsQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CcPermsQuery
*/
@ -71,41 +75,115 @@ abstract class BaseCcPermsQuery extends ModelCriteria
if ($criteria instanceof CcPermsQuery) {
return $criteria;
}
$query = new CcPermsQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
$query = new CcPermsQuery(null, null, $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
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <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 CcPerms|array|mixed the result, formatted by the current formatter
* @return CcPerms|CcPerms[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcPermsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
if ($key === null) {
return null;
}
if ((null !== ($obj = CcPermsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
// the object has not been requested yet, or the formatter is not an object formatter
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcPerms A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneByPermid($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcPerms A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "permid", "subj", "action", "obj", "type" FROM "cc_perms" WHERE "permid" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CcPerms();
$obj->hydrate($row);
CcPermsPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcPerms|CcPerms[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
@ -115,14 +193,20 @@ abstract class BaseCcPermsQuery extends ModelCriteria
* @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
* @return PropelObjectCollection|CcPerms[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
$stmt = $criteria
->filterByPrimaryKeys($keys)
->find($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
@ -134,6 +218,7 @@ abstract class BaseCcPermsQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcPermsPeer::PERMID, $key, Criteria::EQUAL);
}
@ -146,31 +231,69 @@ abstract class BaseCcPermsQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcPermsPeer::PERMID, $keys, Criteria::IN);
}
/**
* Filter the query on the permid column
*
* @param int|array $permid The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByPermid(1234); // WHERE permid = 1234
* $query->filterByPermid(array(12, 34)); // WHERE permid IN (12, 34)
* $query->filterByPermid(array('min' => 12)); // WHERE permid >= 12
* $query->filterByPermid(array('max' => 12)); // WHERE permid <= 12
* </code>
*
* @param mixed $permid The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPermsQuery The current query, for fluid interface
*/
public function filterByPermid($permid = null, $comparison = null)
{
if (is_array($permid) && null === $comparison) {
if (is_array($permid)) {
$useMinMax = false;
if (isset($permid['min'])) {
$this->addUsingAlias(CcPermsPeer::PERMID, $permid['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($permid['max'])) {
$this->addUsingAlias(CcPermsPeer::PERMID, $permid['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPermsPeer::PERMID, $permid, $comparison);
}
/**
* Filter the query on the subj column
*
* @param int|array $subj The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterBySubj(1234); // WHERE subj = 1234
* $query->filterBySubj(array(12, 34)); // WHERE subj IN (12, 34)
* $query->filterBySubj(array('min' => 12)); // WHERE subj >= 12
* $query->filterBySubj(array('max' => 12)); // WHERE subj <= 12
* </code>
*
* @see filterByCcSubjs()
*
* @param mixed $subj The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPermsQuery The current query, for fluid interface
@ -194,12 +317,19 @@ abstract class BaseCcPermsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPermsPeer::SUBJ, $subj, $comparison);
}
/**
* Filter the query on the action column
*
* Example usage:
* <code>
* $query->filterByAction('fooValue'); // WHERE action = 'fooValue'
* $query->filterByAction('%fooValue%'); // WHERE action LIKE '%fooValue%'
* </code>
*
* @param string $action 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
@ -216,14 +346,25 @@ abstract class BaseCcPermsQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPermsPeer::ACTION, $action, $comparison);
}
/**
* Filter the query on the obj column
*
* @param int|array $obj The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByObj(1234); // WHERE obj = 1234
* $query->filterByObj(array(12, 34)); // WHERE obj IN (12, 34)
* $query->filterByObj(array('min' => 12)); // WHERE obj >= 12
* $query->filterByObj(array('max' => 12)); // WHERE obj <= 12
* </code>
*
* @param mixed $obj The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPermsQuery The current query, for fluid interface
@ -247,12 +388,19 @@ abstract class BaseCcPermsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPermsPeer::OBJ, $obj, $comparison);
}
/**
* Filter the query on the type column
*
* Example usage:
* <code>
* $query->filterByType('fooValue'); // WHERE type = 'fooValue'
* $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%'
* </code>
*
* @param string $type 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
@ -269,21 +417,34 @@ abstract class BaseCcPermsQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPermsPeer::TYPE, $type, $comparison);
}
/**
* Filter the query by a related CcSubjs object
*
* @param CcSubjs $ccSubjs the related object to use as filter
* @param CcSubjs|PropelObjectCollection $ccSubjs The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPermsQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcSubjs($ccSubjs, $comparison = null)
{
if ($ccSubjs instanceof CcSubjs) {
return $this
->addUsingAlias(CcPermsPeer::SUBJ, $ccSubjs->getDbId(), $comparison);
} elseif ($ccSubjs instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CcPermsPeer::SUBJ, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison);
} else {
throw new PropelException('filterByCcSubjs() only accepts arguments of type CcSubjs or PropelCollection');
}
}
/**
@ -294,7 +455,7 @@ abstract class BaseCcPermsQuery extends ModelCriteria
*
* @return CcPermsQuery The current query, for fluid interface
*/
public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function joinCcSubjs($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcSubjs');
@ -329,7 +490,7 @@ abstract class BaseCcPermsQuery extends ModelCriteria
*
* @return CcSubjsQuery A secondary query class using the current class as primary query
*/
public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function useCcSubjsQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcSubjs($relationAlias, $joinType)
@ -352,4 +513,4 @@ abstract class BaseCcPermsQuery extends ModelCriteria
return $this;
}
} // BaseCcPermsQuery
}

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,8 @@
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlaylistPeer {
abstract class BaseCcPlaylistPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
@ -19,9 +20,6 @@ abstract class BaseCcPlaylistPeer {
/** the related Propel class for this table */
const OM_CLASS = 'CcPlaylist';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcPlaylist';
/** the related TableMap class for this table */
const TM_CLASS = 'CcPlaylistTableMap';
@ -31,29 +29,35 @@ abstract class BaseCcPlaylistPeer {
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_playlist.ID';
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 7;
/** the column name for the NAME field */
const NAME = 'cc_playlist.NAME';
/** the column name for the id field */
const ID = 'cc_playlist.id';
/** the column name for the MTIME field */
const MTIME = 'cc_playlist.MTIME';
/** the column name for the name field */
const NAME = 'cc_playlist.name';
/** the column name for the UTIME field */
const UTIME = 'cc_playlist.UTIME';
/** the column name for the mtime field */
const MTIME = 'cc_playlist.mtime';
/** the column name for the CREATOR_ID field */
const CREATOR_ID = 'cc_playlist.CREATOR_ID';
/** the column name for the utime field */
const UTIME = 'cc_playlist.utime';
/** the column name for the DESCRIPTION field */
const DESCRIPTION = 'cc_playlist.DESCRIPTION';
/** the column name for the creator_id field */
const CREATOR_ID = 'cc_playlist.creator_id';
/** the column name for the LENGTH field */
const LENGTH = 'cc_playlist.LENGTH';
/** the column name for the description field */
const DESCRIPTION = 'cc_playlist.description';
/** the column name for the length field */
const LENGTH = 'cc_playlist.length';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CcPlaylist objects.
* An identity map to hold any loaded instances of CcPlaylist objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcPlaylist[]
@ -65,12 +69,12 @@ abstract class BaseCcPlaylistPeer {
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
* e.g. CcPlaylistPeer::$fieldNames[CcPlaylistPeer::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMtime', 'DbUtime', 'DbCreatorId', 'DbDescription', 'DbLength', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMtime', 'dbUtime', 'dbCreatorId', 'dbDescription', 'dbLength', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::MTIME, self::UTIME, self::CREATOR_ID, self::DESCRIPTION, self::LENGTH, ),
BasePeer::TYPE_COLNAME => array (CcPlaylistPeer::ID, CcPlaylistPeer::NAME, CcPlaylistPeer::MTIME, CcPlaylistPeer::UTIME, CcPlaylistPeer::CREATOR_ID, CcPlaylistPeer::DESCRIPTION, CcPlaylistPeer::LENGTH, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MTIME', 'UTIME', 'CREATOR_ID', 'DESCRIPTION', 'LENGTH', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mtime', 'utime', 'creator_id', 'description', 'length', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
@ -80,12 +84,12 @@ abstract class BaseCcPlaylistPeer {
* 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
* e.g. CcPlaylistPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMtime' => 2, 'DbUtime' => 3, 'DbCreatorId' => 4, 'DbDescription' => 5, 'DbLength' => 6, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMtime' => 2, 'dbUtime' => 3, 'dbCreatorId' => 4, 'dbDescription' => 5, 'dbLength' => 6, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::MTIME => 2, self::UTIME => 3, self::CREATOR_ID => 4, self::DESCRIPTION => 5, self::LENGTH => 6, ),
BasePeer::TYPE_COLNAME => array (CcPlaylistPeer::ID => 0, CcPlaylistPeer::NAME => 1, CcPlaylistPeer::MTIME => 2, CcPlaylistPeer::UTIME => 3, CcPlaylistPeer::CREATOR_ID => 4, CcPlaylistPeer::DESCRIPTION => 5, CcPlaylistPeer::LENGTH => 6, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MTIME' => 2, 'UTIME' => 3, 'CREATOR_ID' => 4, 'DESCRIPTION' => 5, 'LENGTH' => 6, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mtime' => 2, 'utime' => 3, 'creator_id' => 4, 'description' => 5, 'length' => 6, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
@ -101,13 +105,14 @@ abstract class BaseCcPlaylistPeer {
* @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)
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = CcPlaylistPeer::getFieldNames($toType);
$key = isset(CcPlaylistPeer::$fieldKeys[$fromType][$name]) ? CcPlaylistPeer::$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));
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcPlaylistPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@ -118,14 +123,15 @@ abstract class BaseCcPlaylistPeer {
* 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
* @throws PropelException - if the type is not valid.
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
if (!array_key_exists($type, CcPlaylistPeer::$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];
return CcPlaylistPeer::$fieldNames[$type];
}
/**
@ -168,13 +174,13 @@ abstract class BaseCcPlaylistPeer {
$criteria->addSelectColumn(CcPlaylistPeer::DESCRIPTION);
$criteria->addSelectColumn(CcPlaylistPeer::LENGTH);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.NAME');
$criteria->addSelectColumn($alias . '.MTIME');
$criteria->addSelectColumn($alias . '.UTIME');
$criteria->addSelectColumn($alias . '.CREATOR_ID');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.LENGTH');
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.name');
$criteria->addSelectColumn($alias . '.mtime');
$criteria->addSelectColumn($alias . '.utime');
$criteria->addSelectColumn($alias . '.creator_id');
$criteria->addSelectColumn($alias . '.description');
$criteria->addSelectColumn($alias . '.length');
}
}
@ -205,7 +211,7 @@ abstract class BaseCcPlaylistPeer {
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
$criteria->setDbName(CcPlaylistPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -219,10 +225,11 @@ abstract class BaseCcPlaylistPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
@ -238,10 +245,11 @@ abstract class BaseCcPlaylistPeer {
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
@ -256,7 +264,7 @@ abstract class BaseCcPlaylistPeer {
/**
* 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
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
@ -278,7 +286,7 @@ abstract class BaseCcPlaylistPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
@ -292,16 +300,16 @@ abstract class BaseCcPlaylistPeer {
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcPlaylist $value A CcPlaylist object.
* @param CcPlaylist $obj A CcPlaylist object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcPlaylist $obj, $key = null)
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getDbId();
} // if key === null
self::$instances[$key] = $obj;
CcPlaylistPeer::$instances[$key] = $obj;
}
}
@ -314,6 +322,9 @@ abstract class BaseCcPlaylistPeer {
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcPlaylist object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
@ -328,7 +339,7 @@ abstract class BaseCcPlaylistPeer {
throw $e;
}
unset(self::$instances[$key]);
unset(CcPlaylistPeer::$instances[$key]);
}
} // removeInstanceFromPool()
@ -339,16 +350,17 @@ abstract class BaseCcPlaylistPeer {
* 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 CcPlaylist Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @return CcPlaylist 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];
if (isset(CcPlaylistPeer::$instances[$key])) {
return CcPlaylistPeer::$instances[$key];
}
}
return null; // just to be explicit
}
@ -357,9 +369,14 @@ abstract class BaseCcPlaylistPeer {
*
* @return void
*/
public static function clearInstancePool()
public static function clearInstancePool($and_clear_all_references = false)
{
self::$instances = array();
if ($and_clear_all_references) {
foreach (CcPlaylistPeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcPlaylistPeer::$instances = array();
}
/**
@ -381,14 +398,15 @@ abstract class BaseCcPlaylistPeer {
*
* @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.
* @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 the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
@ -403,6 +421,7 @@ abstract class BaseCcPlaylistPeer {
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
@ -418,7 +437,7 @@ abstract class BaseCcPlaylistPeer {
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcPlaylistPeer::getOMClass(false);
$cls = CcPlaylistPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, 0);
@ -435,6 +454,7 @@ abstract class BaseCcPlaylistPeer {
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
@ -453,16 +473,18 @@ abstract class BaseCcPlaylistPeer {
// 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 + CcPlaylistPeer::NUM_COLUMNS;
$col = $startcol + CcPlaylistPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CcPlaylistPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcPlaylistPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the number of rows matching criteria, joining the related CcSubjs table
*
@ -493,7 +515,7 @@ abstract class BaseCcPlaylistPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -509,6 +531,7 @@ abstract class BaseCcPlaylistPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -528,11 +551,11 @@ abstract class BaseCcPlaylistPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistPeer::DATABASE_NAME);
}
CcPlaylistPeer::addSelectColumns($criteria);
$startcol = (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol = CcPlaylistPeer::NUM_HYDRATE_COLUMNS;
CcSubjsPeer::addSelectColumns($criteria);
$criteria->addJoin(CcPlaylistPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
@ -548,7 +571,7 @@ abstract class BaseCcPlaylistPeer {
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPlaylistPeer::getOMClass(false);
$cls = CcPlaylistPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -560,7 +583,7 @@ abstract class BaseCcPlaylistPeer {
$obj2 = CcSubjsPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcSubjsPeer::getOMClass(false);
$cls = CcSubjsPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
@ -575,6 +598,7 @@ abstract class BaseCcPlaylistPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -609,7 +633,7 @@ abstract class BaseCcPlaylistPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -625,6 +649,7 @@ abstract class BaseCcPlaylistPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -644,14 +669,14 @@ abstract class BaseCcPlaylistPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistPeer::DATABASE_NAME);
}
CcPlaylistPeer::addSelectColumns($criteria);
$startcol2 = (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcPlaylistPeer::NUM_HYDRATE_COLUMNS;
CcSubjsPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcPlaylistPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
@ -665,7 +690,7 @@ abstract class BaseCcPlaylistPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPlaylistPeer::getOMClass(false);
$cls = CcPlaylistPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -679,7 +704,7 @@ abstract class BaseCcPlaylistPeer {
$obj2 = CcSubjsPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcSubjsPeer::getOMClass(false);
$cls = CcSubjsPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -693,6 +718,7 @@ abstract class BaseCcPlaylistPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -705,7 +731,7 @@ abstract class BaseCcPlaylistPeer {
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
return Propel::getDatabaseMap(CcPlaylistPeer::DATABASE_NAME)->getTable(CcPlaylistPeer::TABLE_NAME);
}
/**
@ -714,30 +740,24 @@ abstract class BaseCcPlaylistPeer {
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcPlaylistPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcPlaylistPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcPlaylistTableMap());
if (!$dbMap->hasTable(BaseCcPlaylistPeer::TABLE_NAME)) {
$dbMap->addTableObject(new \CcPlaylistTableMap());
}
}
/**
* 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
* @return string ClassName
*/
public static function getOMClass($withPrefix = true)
public static function getOMClass($row = 0, $colnum = 0)
{
return $withPrefix ? CcPlaylistPeer::CLASS_DEFAULT : CcPlaylistPeer::OM_CLASS;
return CcPlaylistPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcPlaylist or Criteria object.
* Performs an INSERT on the database, given a CcPlaylist or Criteria object.
*
* @param mixed $values Criteria or CcPlaylist object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
@ -763,7 +783,7 @@ abstract class BaseCcPlaylistPeer {
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
@ -771,7 +791,7 @@ abstract class BaseCcPlaylistPeer {
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -780,7 +800,7 @@ abstract class BaseCcPlaylistPeer {
}
/**
* Method perform an UPDATE on the database, given a CcPlaylist or Criteria object.
* Performs an UPDATE on the database, given a CcPlaylist or Criteria object.
*
* @param mixed $values Criteria or CcPlaylist 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).
@ -794,7 +814,7 @@ abstract class BaseCcPlaylistPeer {
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
$selectCriteria = new Criteria(CcPlaylistPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
@ -813,17 +833,19 @@ abstract class BaseCcPlaylistPeer {
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_playlist table.
* Deletes all rows from the cc_playlist table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll($con = null)
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
@ -840,15 +862,16 @@ abstract class BaseCcPlaylistPeer {
CcPlaylistPeer::clearInstancePool();
CcPlaylistPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcPlaylist or Criteria object OR a primary key value.
* Performs a DELETE on the database, given a CcPlaylist or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcPlaylist object or primary key or array of primary keys
* which is used to create the DELETE statement
@ -877,7 +900,7 @@ abstract class BaseCcPlaylistPeer {
// 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 = new Criteria(CcPlaylistPeer::DATABASE_NAME);
$criteria->add(CcPlaylistPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
@ -886,7 +909,7 @@ abstract class BaseCcPlaylistPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@ -898,8 +921,9 @@ abstract class BaseCcPlaylistPeer {
$affectedRows += BasePeer::doDelete($criteria, $con);
CcPlaylistPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -917,7 +941,7 @@ abstract class BaseCcPlaylistPeer {
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(CcPlaylist $obj, $cols = null)
public static function doValidate($obj, $cols = null)
{
$columns = array();
@ -930,7 +954,7 @@ abstract class BaseCcPlaylistPeer {
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
@ -973,6 +997,7 @@ abstract class BaseCcPlaylistPeer {
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcPlaylist[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
@ -990,6 +1015,7 @@ abstract class BaseCcPlaylistPeer {
$criteria->add(CcPlaylistPeer::ID, $pks, Criteria::IN);
$objs = CcPlaylistPeer::doSelect($criteria, $con);
}
return $objs;
}

View File

@ -26,18 +26,17 @@
* @method CcPlaylistQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcPlaylistQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcPlaylistQuery leftJoinCcSubjs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjs relation
* @method CcPlaylistQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation
* @method CcPlaylistQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation
* @method CcPlaylistQuery leftJoinCcSubjs($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjs relation
* @method CcPlaylistQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation
* @method CcPlaylistQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs relation
*
* @method CcPlaylistQuery leftJoinCcPlaylistcontents($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlaylistcontents relation
* @method CcPlaylistQuery rightJoinCcPlaylistcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
* @method CcPlaylistQuery innerJoinCcPlaylistcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
* @method CcPlaylistQuery leftJoinCcPlaylistcontents($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlaylistcontents relation
* @method CcPlaylistQuery rightJoinCcPlaylistcontents($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
* @method CcPlaylistQuery innerJoinCcPlaylistcontents($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
*
* @method CcPlaylist findOne(PropelPDO $con = null) Return the first CcPlaylist matching the query
* @method CcPlaylist findOneOrCreate(PropelPDO $con = null) Return the first CcPlaylist matching the query, or a new CcPlaylist object populated from the query conditions when no match is found
*
* @method CcPlaylist findOneByDbId(int $id) Return the first CcPlaylist filtered by the id column
* @method CcPlaylist findOneByDbName(string $name) Return the first CcPlaylist filtered by the name column
* @method CcPlaylist findOneByDbMtime(string $mtime) Return the first CcPlaylist filtered by the mtime column
* @method CcPlaylist findOneByDbUtime(string $utime) Return the first CcPlaylist filtered by the utime column
@ -57,7 +56,6 @@
*/
abstract class BaseCcPlaylistQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcPlaylistQuery object.
*
@ -65,8 +63,14 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
* @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 = 'CcPlaylist', $modelAlias = null)
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'airtime';
}
if (null === $modelName) {
$modelName = 'CcPlaylist';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
@ -74,7 +78,7 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
* Returns a new CcPlaylistQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
* @param CcPlaylistQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CcPlaylistQuery
*/
@ -83,41 +87,115 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
if ($criteria instanceof CcPlaylistQuery) {
return $criteria;
}
$query = new CcPlaylistQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
$query = new CcPlaylistQuery(null, null, $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
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <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 CcPlaylist|array|mixed the result, formatted by the current formatter
* @return CcPlaylist|CcPlaylist[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcPlaylistPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
if ($key === null) {
return null;
}
if ((null !== ($obj = CcPlaylistPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
// the object has not been requested yet, or the formatter is not an object formatter
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcPlaylist A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneByDbId($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcPlaylist A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "id", "name", "mtime", "utime", "creator_id", "description", "length" FROM "cc_playlist" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CcPlaylist();
$obj->hydrate($row);
CcPlaylistPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcPlaylist|CcPlaylist[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
@ -127,14 +205,20 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
* @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
* @return PropelObjectCollection|CcPlaylist[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
$stmt = $criteria
->filterByPrimaryKeys($keys)
->find($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
@ -146,6 +230,7 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcPlaylistPeer::ID, $key, Criteria::EQUAL);
}
@ -158,29 +243,61 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcPlaylistPeer::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)
* Example usage:
* <code>
* $query->filterByDbId(1234); // WHERE id = 1234
* $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
* $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
* </code>
*
* @param mixed $dbId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistQuery The current query, for fluid interface
*/
public function filterByDbId($dbId = null, $comparison = null)
{
if (is_array($dbId) && null === $comparison) {
if (is_array($dbId)) {
$useMinMax = false;
if (isset($dbId['min'])) {
$this->addUsingAlias(CcPlaylistPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbId['max'])) {
$this->addUsingAlias(CcPlaylistPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistPeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the name column
*
* Example usage:
* <code>
* $query->filterByDbName('fooValue'); // WHERE name = 'fooValue'
* $query->filterByDbName('%fooValue%'); // WHERE name LIKE '%fooValue%'
* </code>
*
* @param string $dbName The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -197,14 +314,26 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlaylistPeer::NAME, $dbName, $comparison);
}
/**
* Filter the query on the mtime column
*
* @param string|array $dbMtime The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbMtime('2011-03-14'); // WHERE mtime = '2011-03-14'
* $query->filterByDbMtime('now'); // WHERE mtime = '2011-03-14'
* $query->filterByDbMtime(array('max' => 'yesterday')); // WHERE mtime < '2011-03-13'
* </code>
*
* @param mixed $dbMtime The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistQuery The current query, for fluid interface
@ -228,14 +357,26 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistPeer::MTIME, $dbMtime, $comparison);
}
/**
* Filter the query on the utime column
*
* @param string|array $dbUtime The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbUtime('2011-03-14'); // WHERE utime = '2011-03-14'
* $query->filterByDbUtime('now'); // WHERE utime = '2011-03-14'
* $query->filterByDbUtime(array('max' => 'yesterday')); // WHERE utime < '2011-03-13'
* </code>
*
* @param mixed $dbUtime The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistQuery The current query, for fluid interface
@ -259,14 +400,27 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistPeer::UTIME, $dbUtime, $comparison);
}
/**
* Filter the query on the creator_id column
*
* @param int|array $dbCreatorId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbCreatorId(1234); // WHERE creator_id = 1234
* $query->filterByDbCreatorId(array(12, 34)); // WHERE creator_id IN (12, 34)
* $query->filterByDbCreatorId(array('min' => 12)); // WHERE creator_id >= 12
* $query->filterByDbCreatorId(array('max' => 12)); // WHERE creator_id <= 12
* </code>
*
* @see filterByCcSubjs()
*
* @param mixed $dbCreatorId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistQuery The current query, for fluid interface
@ -290,12 +444,19 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $dbCreatorId, $comparison);
}
/**
* Filter the query on the description column
*
* Example usage:
* <code>
* $query->filterByDbDescription('fooValue'); // WHERE description = 'fooValue'
* $query->filterByDbDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
* </code>
*
* @param string $dbDescription The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -312,12 +473,19 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlaylistPeer::DESCRIPTION, $dbDescription, $comparison);
}
/**
* Filter the query on the length column
*
* Example usage:
* <code>
* $query->filterByDbLength('fooValue'); // WHERE length = 'fooValue'
* $query->filterByDbLength('%fooValue%'); // WHERE length LIKE '%fooValue%'
* </code>
*
* @param string $dbLength The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -334,21 +502,34 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlaylistPeer::LENGTH, $dbLength, $comparison);
}
/**
* Filter the query by a related CcSubjs object
*
* @param CcSubjs $ccSubjs the related object to use as filter
* @param CcSubjs|PropelObjectCollection $ccSubjs The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcSubjs($ccSubjs, $comparison = null)
{
if ($ccSubjs instanceof CcSubjs) {
return $this
->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $ccSubjs->getDbId(), $comparison);
} elseif ($ccSubjs instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison);
} else {
throw new PropelException('filterByCcSubjs() only accepts arguments of type CcSubjs or PropelCollection');
}
}
/**
@ -359,7 +540,7 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
*
* @return CcPlaylistQuery The current query, for fluid interface
*/
public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function joinCcSubjs($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcSubjs');
@ -394,7 +575,7 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
*
* @return CcSubjsQuery A secondary query class using the current class as primary query
*/
public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function useCcSubjsQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcSubjs($relationAlias, $joinType)
@ -404,15 +585,25 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
/**
* Filter the query by a related CcPlaylistcontents object
*
* @param CcPlaylistcontents $ccPlaylistcontents the related object to use as filter
* @param CcPlaylistcontents|PropelObjectCollection $ccPlaylistcontents the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcPlaylistcontents($ccPlaylistcontents, $comparison = null)
{
if ($ccPlaylistcontents instanceof CcPlaylistcontents) {
return $this
->addUsingAlias(CcPlaylistPeer::ID, $ccPlaylistcontents->getDbPlaylistId(), $comparison);
} elseif ($ccPlaylistcontents instanceof PropelObjectCollection) {
return $this
->useCcPlaylistcontentsQuery()
->filterByPrimaryKeys($ccPlaylistcontents->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByCcPlaylistcontents() only accepts arguments of type CcPlaylistcontents or PropelCollection');
}
}
/**
@ -423,7 +614,7 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
*
* @return CcPlaylistQuery The current query, for fluid interface
*/
public function joinCcPlaylistcontents($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function joinCcPlaylistcontents($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcPlaylistcontents');
@ -458,7 +649,7 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
*
* @return CcPlaylistcontentsQuery A secondary query class using the current class as primary query
*/
public function useCcPlaylistcontentsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function useCcPlaylistcontentsQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcPlaylistcontents($relationAlias, $joinType)
@ -481,4 +672,4 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
return $this;
}
} // BaseCcPlaylistQuery
}

View File

@ -8,7 +8,8 @@
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlaylistcontentsPeer {
abstract class BaseCcPlaylistcontentsPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
@ -19,9 +20,6 @@ abstract class BaseCcPlaylistcontentsPeer {
/** the related Propel class for this table */
const OM_CLASS = 'CcPlaylistcontents';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'airtime.CcPlaylistcontents';
/** the related TableMap class for this table */
const TM_CLASS = 'CcPlaylistcontentsTableMap';
@ -31,47 +29,53 @@ abstract class BaseCcPlaylistcontentsPeer {
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_playlistcontents.ID';
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 13;
/** the column name for the PLAYLIST_ID field */
const PLAYLIST_ID = 'cc_playlistcontents.PLAYLIST_ID';
/** the column name for the id field */
const ID = 'cc_playlistcontents.id';
/** the column name for the FILE_ID field */
const FILE_ID = 'cc_playlistcontents.FILE_ID';
/** the column name for the playlist_id field */
const PLAYLIST_ID = 'cc_playlistcontents.playlist_id';
/** the column name for the BLOCK_ID field */
const BLOCK_ID = 'cc_playlistcontents.BLOCK_ID';
/** the column name for the file_id field */
const FILE_ID = 'cc_playlistcontents.file_id';
/** the column name for the STREAM_ID field */
const STREAM_ID = 'cc_playlistcontents.STREAM_ID';
/** the column name for the block_id field */
const BLOCK_ID = 'cc_playlistcontents.block_id';
/** the column name for the TYPE field */
const TYPE = 'cc_playlistcontents.TYPE';
/** the column name for the stream_id field */
const STREAM_ID = 'cc_playlistcontents.stream_id';
/** the column name for the POSITION field */
const POSITION = 'cc_playlistcontents.POSITION';
/** the column name for the type field */
const TYPE = 'cc_playlistcontents.type';
/** the column name for the TRACKOFFSET field */
const TRACKOFFSET = 'cc_playlistcontents.TRACKOFFSET';
/** the column name for the position field */
const POSITION = 'cc_playlistcontents.position';
/** the column name for the CLIPLENGTH field */
const CLIPLENGTH = 'cc_playlistcontents.CLIPLENGTH';
/** the column name for the trackoffset field */
const TRACKOFFSET = 'cc_playlistcontents.trackoffset';
/** the column name for the CUEIN field */
const CUEIN = 'cc_playlistcontents.CUEIN';
/** the column name for the cliplength field */
const CLIPLENGTH = 'cc_playlistcontents.cliplength';
/** the column name for the CUEOUT field */
const CUEOUT = 'cc_playlistcontents.CUEOUT';
/** the column name for the cuein field */
const CUEIN = 'cc_playlistcontents.cuein';
/** the column name for the FADEIN field */
const FADEIN = 'cc_playlistcontents.FADEIN';
/** the column name for the cueout field */
const CUEOUT = 'cc_playlistcontents.cueout';
/** the column name for the FADEOUT field */
const FADEOUT = 'cc_playlistcontents.FADEOUT';
/** the column name for the fadein field */
const FADEIN = 'cc_playlistcontents.fadein';
/** the column name for the fadeout field */
const FADEOUT = 'cc_playlistcontents.fadeout';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CcPlaylistcontents objects.
* An identity map to hold any loaded instances of CcPlaylistcontents objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcPlaylistcontents[]
@ -83,12 +87,12 @@ abstract class BaseCcPlaylistcontentsPeer {
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
* e.g. CcPlaylistcontentsPeer::$fieldNames[CcPlaylistcontentsPeer::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbFileId', 'DbBlockId', 'DbStreamId', 'DbType', 'DbPosition', 'DbTrackOffset', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbFileId', 'dbBlockId', 'dbStreamId', 'dbType', 'dbPosition', 'dbTrackOffset', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::FILE_ID, self::BLOCK_ID, self::STREAM_ID, self::TYPE, self::POSITION, self::TRACKOFFSET, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ),
BasePeer::TYPE_COLNAME => array (CcPlaylistcontentsPeer::ID, CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistcontentsPeer::FILE_ID, CcPlaylistcontentsPeer::BLOCK_ID, CcPlaylistcontentsPeer::STREAM_ID, CcPlaylistcontentsPeer::TYPE, CcPlaylistcontentsPeer::POSITION, CcPlaylistcontentsPeer::TRACKOFFSET, CcPlaylistcontentsPeer::CLIPLENGTH, CcPlaylistcontentsPeer::CUEIN, CcPlaylistcontentsPeer::CUEOUT, CcPlaylistcontentsPeer::FADEIN, CcPlaylistcontentsPeer::FADEOUT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'FILE_ID', 'BLOCK_ID', 'STREAM_ID', 'TYPE', 'POSITION', 'TRACKOFFSET', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'file_id', 'block_id', 'stream_id', 'type', 'position', 'trackoffset', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
@ -98,12 +102,12 @@ abstract class BaseCcPlaylistcontentsPeer {
* 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
* e.g. CcPlaylistcontentsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbFileId' => 2, 'DbBlockId' => 3, 'DbStreamId' => 4, 'DbType' => 5, 'DbPosition' => 6, 'DbTrackOffset' => 7, 'DbCliplength' => 8, 'DbCuein' => 9, 'DbCueout' => 10, 'DbFadein' => 11, 'DbFadeout' => 12, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbFileId' => 2, 'dbBlockId' => 3, 'dbStreamId' => 4, 'dbType' => 5, 'dbPosition' => 6, 'dbTrackOffset' => 7, 'dbCliplength' => 8, 'dbCuein' => 9, 'dbCueout' => 10, 'dbFadein' => 11, 'dbFadeout' => 12, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::FILE_ID => 2, self::BLOCK_ID => 3, self::STREAM_ID => 4, self::TYPE => 5, self::POSITION => 6, self::TRACKOFFSET => 7, self::CLIPLENGTH => 8, self::CUEIN => 9, self::CUEOUT => 10, self::FADEIN => 11, self::FADEOUT => 12, ),
BasePeer::TYPE_COLNAME => array (CcPlaylistcontentsPeer::ID => 0, CcPlaylistcontentsPeer::PLAYLIST_ID => 1, CcPlaylistcontentsPeer::FILE_ID => 2, CcPlaylistcontentsPeer::BLOCK_ID => 3, CcPlaylistcontentsPeer::STREAM_ID => 4, CcPlaylistcontentsPeer::TYPE => 5, CcPlaylistcontentsPeer::POSITION => 6, CcPlaylistcontentsPeer::TRACKOFFSET => 7, CcPlaylistcontentsPeer::CLIPLENGTH => 8, CcPlaylistcontentsPeer::CUEIN => 9, CcPlaylistcontentsPeer::CUEOUT => 10, CcPlaylistcontentsPeer::FADEIN => 11, CcPlaylistcontentsPeer::FADEOUT => 12, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'FILE_ID' => 2, 'BLOCK_ID' => 3, 'STREAM_ID' => 4, 'TYPE' => 5, 'POSITION' => 6, 'TRACKOFFSET' => 7, 'CLIPLENGTH' => 8, 'CUEIN' => 9, 'CUEOUT' => 10, 'FADEIN' => 11, 'FADEOUT' => 12, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'file_id' => 2, 'block_id' => 3, 'stream_id' => 4, 'type' => 5, 'position' => 6, 'trackoffset' => 7, 'cliplength' => 8, 'cuein' => 9, 'cueout' => 10, 'fadein' => 11, 'fadeout' => 12, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
@ -119,13 +123,14 @@ abstract class BaseCcPlaylistcontentsPeer {
* @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)
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = CcPlaylistcontentsPeer::getFieldNames($toType);
$key = isset(CcPlaylistcontentsPeer::$fieldKeys[$fromType][$name]) ? CcPlaylistcontentsPeer::$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));
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcPlaylistcontentsPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@ -136,14 +141,15 @@ abstract class BaseCcPlaylistcontentsPeer {
* 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
* @throws PropelException - if the type is not valid.
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
if (!array_key_exists($type, CcPlaylistcontentsPeer::$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];
return CcPlaylistcontentsPeer::$fieldNames[$type];
}
/**
@ -192,19 +198,19 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->addSelectColumn(CcPlaylistcontentsPeer::FADEIN);
$criteria->addSelectColumn(CcPlaylistcontentsPeer::FADEOUT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.PLAYLIST_ID');
$criteria->addSelectColumn($alias . '.FILE_ID');
$criteria->addSelectColumn($alias . '.BLOCK_ID');
$criteria->addSelectColumn($alias . '.STREAM_ID');
$criteria->addSelectColumn($alias . '.TYPE');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.TRACKOFFSET');
$criteria->addSelectColumn($alias . '.CLIPLENGTH');
$criteria->addSelectColumn($alias . '.CUEIN');
$criteria->addSelectColumn($alias . '.CUEOUT');
$criteria->addSelectColumn($alias . '.FADEIN');
$criteria->addSelectColumn($alias . '.FADEOUT');
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.playlist_id');
$criteria->addSelectColumn($alias . '.file_id');
$criteria->addSelectColumn($alias . '.block_id');
$criteria->addSelectColumn($alias . '.stream_id');
$criteria->addSelectColumn($alias . '.type');
$criteria->addSelectColumn($alias . '.position');
$criteria->addSelectColumn($alias . '.trackoffset');
$criteria->addSelectColumn($alias . '.cliplength');
$criteria->addSelectColumn($alias . '.cuein');
$criteria->addSelectColumn($alias . '.cueout');
$criteria->addSelectColumn($alias . '.fadein');
$criteria->addSelectColumn($alias . '.fadeout');
}
}
@ -235,7 +241,7 @@ abstract class BaseCcPlaylistcontentsPeer {
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -249,10 +255,11 @@ abstract class BaseCcPlaylistcontentsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
@ -268,10 +275,11 @@ abstract class BaseCcPlaylistcontentsPeer {
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
@ -286,7 +294,7 @@ abstract class BaseCcPlaylistcontentsPeer {
/**
* 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
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
@ -308,7 +316,7 @@ abstract class BaseCcPlaylistcontentsPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
@ -322,16 +330,16 @@ abstract class BaseCcPlaylistcontentsPeer {
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcPlaylistcontents $value A CcPlaylistcontents object.
* @param CcPlaylistcontents $obj A CcPlaylistcontents object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcPlaylistcontents $obj, $key = null)
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getDbId();
} // if key === null
self::$instances[$key] = $obj;
CcPlaylistcontentsPeer::$instances[$key] = $obj;
}
}
@ -344,6 +352,9 @@ abstract class BaseCcPlaylistcontentsPeer {
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcPlaylistcontents object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
@ -358,7 +369,7 @@ abstract class BaseCcPlaylistcontentsPeer {
throw $e;
}
unset(self::$instances[$key]);
unset(CcPlaylistcontentsPeer::$instances[$key]);
}
} // removeInstanceFromPool()
@ -369,16 +380,17 @@ abstract class BaseCcPlaylistcontentsPeer {
* 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 CcPlaylistcontents Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @return CcPlaylistcontents 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];
if (isset(CcPlaylistcontentsPeer::$instances[$key])) {
return CcPlaylistcontentsPeer::$instances[$key];
}
}
return null; // just to be explicit
}
@ -387,9 +399,14 @@ abstract class BaseCcPlaylistcontentsPeer {
*
* @return void
*/
public static function clearInstancePool()
public static function clearInstancePool($and_clear_all_references = false)
{
self::$instances = array();
if ($and_clear_all_references) {
foreach (CcPlaylistcontentsPeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcPlaylistcontentsPeer::$instances = array();
}
/**
@ -408,14 +425,15 @@ abstract class BaseCcPlaylistcontentsPeer {
*
* @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.
* @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 the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
@ -430,6 +448,7 @@ abstract class BaseCcPlaylistcontentsPeer {
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
@ -445,7 +464,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcPlaylistcontentsPeer::getOMClass(false);
$cls = CcPlaylistcontentsPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
@ -462,6 +481,7 @@ abstract class BaseCcPlaylistcontentsPeer {
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
@ -480,16 +500,18 @@ abstract class BaseCcPlaylistcontentsPeer {
// 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 + CcPlaylistcontentsPeer::NUM_COLUMNS;
$col = $startcol + CcPlaylistcontentsPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = CcPlaylistcontentsPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcPlaylistcontentsPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the number of rows matching criteria, joining the related CcFiles table
*
@ -520,7 +542,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -536,6 +558,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -570,7 +593,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -586,6 +609,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -620,7 +644,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -636,6 +660,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -655,11 +680,11 @@ abstract class BaseCcPlaylistcontentsPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
}
CcPlaylistcontentsPeer::addSelectColumns($criteria);
$startcol = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol = CcPlaylistcontentsPeer::NUM_HYDRATE_COLUMNS;
CcFilesPeer::addSelectColumns($criteria);
$criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
@ -675,7 +700,7 @@ abstract class BaseCcPlaylistcontentsPeer {
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPlaylistcontentsPeer::getOMClass(false);
$cls = CcPlaylistcontentsPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -687,7 +712,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$obj2 = CcFilesPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcFilesPeer::getOMClass(false);
$cls = CcFilesPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
@ -702,6 +727,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -721,11 +747,11 @@ abstract class BaseCcPlaylistcontentsPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
}
CcPlaylistcontentsPeer::addSelectColumns($criteria);
$startcol = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol = CcPlaylistcontentsPeer::NUM_HYDRATE_COLUMNS;
CcBlockPeer::addSelectColumns($criteria);
$criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
@ -741,7 +767,7 @@ abstract class BaseCcPlaylistcontentsPeer {
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPlaylistcontentsPeer::getOMClass(false);
$cls = CcPlaylistcontentsPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -753,7 +779,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$obj2 = CcBlockPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcBlockPeer::getOMClass(false);
$cls = CcBlockPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
@ -768,6 +794,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -787,11 +814,11 @@ abstract class BaseCcPlaylistcontentsPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
}
CcPlaylistcontentsPeer::addSelectColumns($criteria);
$startcol = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol = CcPlaylistcontentsPeer::NUM_HYDRATE_COLUMNS;
CcPlaylistPeer::addSelectColumns($criteria);
$criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior);
@ -807,7 +834,7 @@ abstract class BaseCcPlaylistcontentsPeer {
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPlaylistcontentsPeer::getOMClass(false);
$cls = CcPlaylistcontentsPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -819,7 +846,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$obj2 = CcPlaylistPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcPlaylistPeer::getOMClass(false);
$cls = CcPlaylistPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
@ -834,6 +861,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -868,7 +896,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -888,6 +916,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -907,20 +936,20 @@ abstract class BaseCcPlaylistcontentsPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
}
CcPlaylistcontentsPeer::addSelectColumns($criteria);
$startcol2 = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcPlaylistcontentsPeer::NUM_HYDRATE_COLUMNS;
CcFilesPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
CcBlockPeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol4 = $startcol3 + CcBlockPeer::NUM_HYDRATE_COLUMNS;
CcPlaylistPeer::addSelectColumns($criteria);
$startcol5 = $startcol4 + (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol5 = $startcol4 + CcPlaylistPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
@ -938,7 +967,7 @@ abstract class BaseCcPlaylistcontentsPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPlaylistcontentsPeer::getOMClass(false);
$cls = CcPlaylistcontentsPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -952,7 +981,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$obj2 = CcFilesPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcFilesPeer::getOMClass(false);
$cls = CcFilesPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -970,7 +999,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$obj3 = CcBlockPeer::getInstanceFromPool($key3);
if (!$obj3) {
$cls = CcBlockPeer::getOMClass(false);
$cls = CcBlockPeer::getOMClass();
$obj3 = new $cls();
$obj3->hydrate($row, $startcol3);
@ -988,7 +1017,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$obj4 = CcPlaylistPeer::getInstanceFromPool($key4);
if (!$obj4) {
$cls = CcPlaylistPeer::getOMClass(false);
$cls = CcPlaylistPeer::getOMClass();
$obj4 = new $cls();
$obj4->hydrate($row, $startcol4);
@ -1002,6 +1031,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -1036,7 +1066,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -1054,6 +1084,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -1088,7 +1119,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -1106,6 +1137,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -1140,7 +1172,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -1158,6 +1190,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -1180,17 +1213,17 @@ abstract class BaseCcPlaylistcontentsPeer {
// $criteria->getDbName() will return the same object if not set to another value
// so == check is okay and faster
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
}
CcPlaylistcontentsPeer::addSelectColumns($criteria);
$startcol2 = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcPlaylistcontentsPeer::NUM_HYDRATE_COLUMNS;
CcBlockPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcBlockPeer::NUM_HYDRATE_COLUMNS;
CcPlaylistPeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol4 = $startcol3 + CcPlaylistPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
@ -1207,7 +1240,7 @@ abstract class BaseCcPlaylistcontentsPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPlaylistcontentsPeer::getOMClass(false);
$cls = CcPlaylistcontentsPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -1221,7 +1254,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$obj2 = CcBlockPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcBlockPeer::getOMClass(false);
$cls = CcBlockPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -1240,7 +1273,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$obj3 = CcPlaylistPeer::getInstanceFromPool($key3);
if (!$obj3) {
$cls = CcPlaylistPeer::getOMClass(false);
$cls = CcPlaylistPeer::getOMClass();
$obj3 = new $cls();
$obj3->hydrate($row, $startcol3);
@ -1255,6 +1288,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -1277,17 +1311,17 @@ abstract class BaseCcPlaylistcontentsPeer {
// $criteria->getDbName() will return the same object if not set to another value
// so == check is okay and faster
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
}
CcPlaylistcontentsPeer::addSelectColumns($criteria);
$startcol2 = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcPlaylistcontentsPeer::NUM_HYDRATE_COLUMNS;
CcFilesPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
CcPlaylistPeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol4 = $startcol3 + CcPlaylistPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
@ -1304,7 +1338,7 @@ abstract class BaseCcPlaylistcontentsPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPlaylistcontentsPeer::getOMClass(false);
$cls = CcPlaylistcontentsPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -1318,7 +1352,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$obj2 = CcFilesPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcFilesPeer::getOMClass(false);
$cls = CcFilesPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -1337,7 +1371,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$obj3 = CcPlaylistPeer::getInstanceFromPool($key3);
if (!$obj3) {
$cls = CcPlaylistPeer::getOMClass(false);
$cls = CcPlaylistPeer::getOMClass();
$obj3 = new $cls();
$obj3->hydrate($row, $startcol3);
@ -1352,6 +1386,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -1374,17 +1409,17 @@ abstract class BaseCcPlaylistcontentsPeer {
// $criteria->getDbName() will return the same object if not set to another value
// so == check is okay and faster
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
}
CcPlaylistcontentsPeer::addSelectColumns($criteria);
$startcol2 = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcPlaylistcontentsPeer::NUM_HYDRATE_COLUMNS;
CcFilesPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
CcBlockPeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol4 = $startcol3 + CcBlockPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
@ -1401,7 +1436,7 @@ abstract class BaseCcPlaylistcontentsPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPlaylistcontentsPeer::getOMClass(false);
$cls = CcPlaylistcontentsPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -1415,7 +1450,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$obj2 = CcFilesPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcFilesPeer::getOMClass(false);
$cls = CcFilesPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -1434,7 +1469,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$obj3 = CcBlockPeer::getInstanceFromPool($key3);
if (!$obj3) {
$cls = CcBlockPeer::getOMClass(false);
$cls = CcBlockPeer::getOMClass();
$obj3 = new $cls();
$obj3->hydrate($row, $startcol3);
@ -1449,6 +1484,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -1461,7 +1497,7 @@ abstract class BaseCcPlaylistcontentsPeer {
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
return Propel::getDatabaseMap(CcPlaylistcontentsPeer::DATABASE_NAME)->getTable(CcPlaylistcontentsPeer::TABLE_NAME);
}
/**
@ -1470,30 +1506,24 @@ abstract class BaseCcPlaylistcontentsPeer {
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcPlaylistcontentsPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcPlaylistcontentsPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcPlaylistcontentsTableMap());
if (!$dbMap->hasTable(BaseCcPlaylistcontentsPeer::TABLE_NAME)) {
$dbMap->addTableObject(new \CcPlaylistcontentsTableMap());
}
}
/**
* 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
* @return string ClassName
*/
public static function getOMClass($withPrefix = true)
public static function getOMClass($row = 0, $colnum = 0)
{
return $withPrefix ? CcPlaylistcontentsPeer::CLASS_DEFAULT : CcPlaylistcontentsPeer::OM_CLASS;
return CcPlaylistcontentsPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcPlaylistcontents or Criteria object.
* Performs an INSERT on the database, given a CcPlaylistcontents or Criteria object.
*
* @param mixed $values Criteria or CcPlaylistcontents object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
@ -1519,7 +1549,7 @@ abstract class BaseCcPlaylistcontentsPeer {
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
@ -1527,7 +1557,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -1536,7 +1566,7 @@ abstract class BaseCcPlaylistcontentsPeer {
}
/**
* Method perform an UPDATE on the database, given a CcPlaylistcontents or Criteria object.
* Performs an UPDATE on the database, given a CcPlaylistcontents or Criteria object.
*
* @param mixed $values Criteria or CcPlaylistcontents 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).
@ -1550,7 +1580,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
$selectCriteria = new Criteria(CcPlaylistcontentsPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
@ -1569,17 +1599,19 @@ abstract class BaseCcPlaylistcontentsPeer {
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_playlistcontents table.
* Deletes all rows from the cc_playlistcontents table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll($con = null)
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
@ -1596,15 +1628,16 @@ abstract class BaseCcPlaylistcontentsPeer {
CcPlaylistcontentsPeer::clearInstancePool();
CcPlaylistcontentsPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcPlaylistcontents or Criteria object OR a primary key value.
* Performs a DELETE on the database, given a CcPlaylistcontents or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcPlaylistcontents object or primary key or array of primary keys
* which is used to create the DELETE statement
@ -1633,7 +1666,7 @@ abstract class BaseCcPlaylistcontentsPeer {
// 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 = new Criteria(CcPlaylistcontentsPeer::DATABASE_NAME);
$criteria->add(CcPlaylistcontentsPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
@ -1642,7 +1675,7 @@ abstract class BaseCcPlaylistcontentsPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlaylistcontentsPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@ -1654,8 +1687,9 @@ abstract class BaseCcPlaylistcontentsPeer {
$affectedRows += BasePeer::doDelete($criteria, $con);
CcPlaylistcontentsPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -1673,7 +1707,7 @@ abstract class BaseCcPlaylistcontentsPeer {
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(CcPlaylistcontents $obj, $cols = null)
public static function doValidate($obj, $cols = null)
{
$columns = array();
@ -1686,7 +1720,7 @@ abstract class BaseCcPlaylistcontentsPeer {
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
@ -1729,6 +1763,7 @@ abstract class BaseCcPlaylistcontentsPeer {
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcPlaylistcontents[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
@ -1746,6 +1781,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->add(CcPlaylistcontentsPeer::ID, $pks, Criteria::IN);
$objs = CcPlaylistcontentsPeer::doSelect($criteria, $con);
}
return $objs;
}

View File

@ -38,22 +38,21 @@
* @method CcPlaylistcontentsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcPlaylistcontentsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcPlaylistcontentsQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation
* @method CcPlaylistcontentsQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
* @method CcPlaylistcontentsQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
* @method CcPlaylistcontentsQuery leftJoinCcFiles($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcFiles relation
* @method CcPlaylistcontentsQuery rightJoinCcFiles($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcFiles relation
* @method CcPlaylistcontentsQuery innerJoinCcFiles($relationAlias = null) Adds a INNER JOIN clause to the query using the CcFiles relation
*
* @method CcPlaylistcontentsQuery leftJoinCcBlock($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlock relation
* @method CcPlaylistcontentsQuery rightJoinCcBlock($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlock relation
* @method CcPlaylistcontentsQuery innerJoinCcBlock($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlock relation
* @method CcPlaylistcontentsQuery leftJoinCcBlock($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcBlock relation
* @method CcPlaylistcontentsQuery rightJoinCcBlock($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcBlock relation
* @method CcPlaylistcontentsQuery innerJoinCcBlock($relationAlias = null) Adds a INNER JOIN clause to the query using the CcBlock relation
*
* @method CcPlaylistcontentsQuery leftJoinCcPlaylist($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlaylist relation
* @method CcPlaylistcontentsQuery rightJoinCcPlaylist($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylist relation
* @method CcPlaylistcontentsQuery innerJoinCcPlaylist($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylist relation
* @method CcPlaylistcontentsQuery leftJoinCcPlaylist($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlaylist relation
* @method CcPlaylistcontentsQuery rightJoinCcPlaylist($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlaylist relation
* @method CcPlaylistcontentsQuery innerJoinCcPlaylist($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlaylist relation
*
* @method CcPlaylistcontents findOne(PropelPDO $con = null) Return the first CcPlaylistcontents matching the query
* @method CcPlaylistcontents findOneOrCreate(PropelPDO $con = null) Return the first CcPlaylistcontents matching the query, or a new CcPlaylistcontents object populated from the query conditions when no match is found
*
* @method CcPlaylistcontents findOneByDbId(int $id) Return the first CcPlaylistcontents filtered by the id column
* @method CcPlaylistcontents findOneByDbPlaylistId(int $playlist_id) Return the first CcPlaylistcontents filtered by the playlist_id column
* @method CcPlaylistcontents findOneByDbFileId(int $file_id) Return the first CcPlaylistcontents filtered by the file_id column
* @method CcPlaylistcontents findOneByDbBlockId(int $block_id) Return the first CcPlaylistcontents filtered by the block_id column
@ -85,7 +84,6 @@
*/
abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcPlaylistcontentsQuery object.
*
@ -93,8 +91,14 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
* @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 = 'CcPlaylistcontents', $modelAlias = null)
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'airtime';
}
if (null === $modelName) {
$modelName = 'CcPlaylistcontents';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
@ -102,7 +106,7 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
* Returns a new CcPlaylistcontentsQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
* @param CcPlaylistcontentsQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return CcPlaylistcontentsQuery
*/
@ -111,41 +115,115 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
if ($criteria instanceof CcPlaylistcontentsQuery) {
return $criteria;
}
$query = new CcPlaylistcontentsQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
$query = new CcPlaylistcontentsQuery(null, null, $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
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <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 CcPlaylistcontents|array|mixed the result, formatted by the current formatter
* @return CcPlaylistcontents|CcPlaylistcontents[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcPlaylistcontentsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
if ($key === null) {
return null;
}
if ((null !== ($obj = CcPlaylistcontentsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
// the object has not been requested yet, or the formatter is not an object formatter
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcPlaylistcontents A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneByDbId($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcPlaylistcontents A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "id", "playlist_id", "file_id", "block_id", "stream_id", "type", "position", "trackoffset", "cliplength", "cuein", "cueout", "fadein", "fadeout" FROM "cc_playlistcontents" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new CcPlaylistcontents();
$obj->hydrate($row);
CcPlaylistcontentsPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return CcPlaylistcontents|CcPlaylistcontents[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
@ -155,14 +233,20 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
* @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
* @return PropelObjectCollection|CcPlaylistcontents[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
$stmt = $criteria
->filterByPrimaryKeys($keys)
->find($con);
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
@ -174,6 +258,7 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $key, Criteria::EQUAL);
}
@ -186,31 +271,69 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcPlaylistcontentsPeer::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)
* Example usage:
* <code>
* $query->filterByDbId(1234); // WHERE id = 1234
* $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
* $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
* </code>
*
* @param mixed $dbId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
*/
public function filterByDbId($dbId = null, $comparison = null)
{
if (is_array($dbId) && null === $comparison) {
if (is_array($dbId)) {
$useMinMax = false;
if (isset($dbId['min'])) {
$this->addUsingAlias(CcPlaylistcontentsPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbId['max'])) {
$this->addUsingAlias(CcPlaylistcontentsPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the playlist_id column
*
* @param int|array $dbPlaylistId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbPlaylistId(1234); // WHERE playlist_id = 1234
* $query->filterByDbPlaylistId(array(12, 34)); // WHERE playlist_id IN (12, 34)
* $query->filterByDbPlaylistId(array('min' => 12)); // WHERE playlist_id >= 12
* $query->filterByDbPlaylistId(array('max' => 12)); // WHERE playlist_id <= 12
* </code>
*
* @see filterByCcPlaylist()
*
* @param mixed $dbPlaylistId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
@ -234,14 +357,27 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::PLAYLIST_ID, $dbPlaylistId, $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)
* Example usage:
* <code>
* $query->filterByDbFileId(1234); // WHERE file_id = 1234
* $query->filterByDbFileId(array(12, 34)); // WHERE file_id IN (12, 34)
* $query->filterByDbFileId(array('min' => 12)); // WHERE file_id >= 12
* $query->filterByDbFileId(array('max' => 12)); // WHERE file_id <= 12
* </code>
*
* @see filterByCcFiles()
*
* @param mixed $dbFileId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
@ -265,14 +401,27 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $dbFileId, $comparison);
}
/**
* Filter the query on the block_id column
*
* @param int|array $dbBlockId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbBlockId(1234); // WHERE block_id = 1234
* $query->filterByDbBlockId(array(12, 34)); // WHERE block_id IN (12, 34)
* $query->filterByDbBlockId(array('min' => 12)); // WHERE block_id >= 12
* $query->filterByDbBlockId(array('max' => 12)); // WHERE block_id <= 12
* </code>
*
* @see filterByCcBlock()
*
* @param mixed $dbBlockId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
@ -296,14 +445,25 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $dbBlockId, $comparison);
}
/**
* Filter the query on the stream_id column
*
* @param int|array $dbStreamId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbStreamId(1234); // WHERE stream_id = 1234
* $query->filterByDbStreamId(array(12, 34)); // WHERE stream_id IN (12, 34)
* $query->filterByDbStreamId(array('min' => 12)); // WHERE stream_id >= 12
* $query->filterByDbStreamId(array('max' => 12)); // WHERE stream_id <= 12
* </code>
*
* @param mixed $dbStreamId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
@ -327,14 +487,25 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::STREAM_ID, $dbStreamId, $comparison);
}
/**
* Filter the query on the type column
*
* @param int|array $dbType The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbType(1234); // WHERE type = 1234
* $query->filterByDbType(array(12, 34)); // WHERE type IN (12, 34)
* $query->filterByDbType(array('min' => 12)); // WHERE type >= 12
* $query->filterByDbType(array('max' => 12)); // WHERE type <= 12
* </code>
*
* @param mixed $dbType The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
@ -358,14 +529,25 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::TYPE, $dbType, $comparison);
}
/**
* Filter the query on the position column
*
* @param int|array $dbPosition The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbPosition(1234); // WHERE position = 1234
* $query->filterByDbPosition(array(12, 34)); // WHERE position IN (12, 34)
* $query->filterByDbPosition(array('min' => 12)); // WHERE position >= 12
* $query->filterByDbPosition(array('max' => 12)); // WHERE position <= 12
* </code>
*
* @param mixed $dbPosition The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
@ -389,14 +571,25 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::POSITION, $dbPosition, $comparison);
}
/**
* Filter the query on the trackoffset column
*
* @param double|array $dbTrackOffset The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbTrackOffset(1234); // WHERE trackoffset = 1234
* $query->filterByDbTrackOffset(array(12, 34)); // WHERE trackoffset IN (12, 34)
* $query->filterByDbTrackOffset(array('min' => 12)); // WHERE trackoffset >= 12
* $query->filterByDbTrackOffset(array('max' => 12)); // WHERE trackoffset <= 12
* </code>
*
* @param mixed $dbTrackOffset The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
@ -420,12 +613,19 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::TRACKOFFSET, $dbTrackOffset, $comparison);
}
/**
* Filter the query on the cliplength column
*
* Example usage:
* <code>
* $query->filterByDbCliplength('fooValue'); // WHERE cliplength = 'fooValue'
* $query->filterByDbCliplength('%fooValue%'); // WHERE cliplength LIKE '%fooValue%'
* </code>
*
* @param string $dbCliplength The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -442,12 +642,19 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength, $comparison);
}
/**
* Filter the query on the cuein column
*
* Example usage:
* <code>
* $query->filterByDbCuein('fooValue'); // WHERE cuein = 'fooValue'
* $query->filterByDbCuein('%fooValue%'); // WHERE cuein LIKE '%fooValue%'
* </code>
*
* @param string $dbCuein The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -464,12 +671,19 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein, $comparison);
}
/**
* Filter the query on the cueout column
*
* Example usage:
* <code>
* $query->filterByDbCueout('fooValue'); // WHERE cueout = 'fooValue'
* $query->filterByDbCueout('%fooValue%'); // WHERE cueout LIKE '%fooValue%'
* </code>
*
* @param string $dbCueout The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@ -486,14 +700,26 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout, $comparison);
}
/**
* Filter the query on the fadein column
*
* @param string|array $dbFadein The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbFadein('2011-03-14'); // WHERE fadein = '2011-03-14'
* $query->filterByDbFadein('now'); // WHERE fadein = '2011-03-14'
* $query->filterByDbFadein(array('max' => 'yesterday')); // WHERE fadein < '2011-03-13'
* </code>
*
* @param mixed $dbFadein The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
@ -517,14 +743,26 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::FADEIN, $dbFadein, $comparison);
}
/**
* Filter the query on the fadeout column
*
* @param string|array $dbFadeout The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* Example usage:
* <code>
* $query->filterByDbFadeout('2011-03-14'); // WHERE fadeout = '2011-03-14'
* $query->filterByDbFadeout('now'); // WHERE fadeout = '2011-03-14'
* $query->filterByDbFadeout(array('max' => 'yesterday')); // WHERE fadeout < '2011-03-13'
* </code>
*
* @param mixed $dbFadeout The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
@ -548,21 +786,34 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::FADEOUT, $dbFadeout, $comparison);
}
/**
* Filter the query by a related CcFiles object
*
* @param CcFiles $ccFiles the related object to use as filter
* @param CcFiles|PropelObjectCollection $ccFiles The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcFiles($ccFiles, $comparison = null)
{
if ($ccFiles instanceof CcFiles) {
return $this
->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $ccFiles->getDbId(), $comparison);
} elseif ($ccFiles instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $ccFiles->toKeyValue('PrimaryKey', 'DbId'), $comparison);
} else {
throw new PropelException('filterByCcFiles() only accepts arguments of type CcFiles or PropelCollection');
}
}
/**
@ -573,7 +824,7 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
*/
public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function joinCcFiles($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcFiles');
@ -608,7 +859,7 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
*
* @return CcFilesQuery A secondary query class using the current class as primary query
*/
public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function useCcFilesQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcFiles($relationAlias, $joinType)
@ -618,15 +869,27 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
/**
* Filter the query by a related CcBlock object
*
* @param CcBlock $ccBlock the related object to use as filter
* @param CcBlock|PropelObjectCollection $ccBlock The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcBlock($ccBlock, $comparison = null)
{
if ($ccBlock instanceof CcBlock) {
return $this
->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $ccBlock->getDbId(), $comparison);
} elseif ($ccBlock instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $ccBlock->toKeyValue('PrimaryKey', 'DbId'), $comparison);
} else {
throw new PropelException('filterByCcBlock() only accepts arguments of type CcBlock or PropelCollection');
}
}
/**
@ -637,7 +900,7 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
*/
public function joinCcBlock($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function joinCcBlock($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcBlock');
@ -672,7 +935,7 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
*
* @return CcBlockQuery A secondary query class using the current class as primary query
*/
public function useCcBlockQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function useCcBlockQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcBlock($relationAlias, $joinType)
@ -682,15 +945,27 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
/**
* Filter the query by a related CcPlaylist object
*
* @param CcPlaylist $ccPlaylist the related object to use as filter
* @param CcPlaylist|PropelObjectCollection $ccPlaylist The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByCcPlaylist($ccPlaylist, $comparison = null)
{
if ($ccPlaylist instanceof CcPlaylist) {
return $this
->addUsingAlias(CcPlaylistcontentsPeer::PLAYLIST_ID, $ccPlaylist->getDbId(), $comparison);
} elseif ($ccPlaylist instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CcPlaylistcontentsPeer::PLAYLIST_ID, $ccPlaylist->toKeyValue('PrimaryKey', 'DbId'), $comparison);
} else {
throw new PropelException('filterByCcPlaylist() only accepts arguments of type CcPlaylist or PropelCollection');
}
}
/**
@ -701,7 +976,7 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
*
* @return CcPlaylistcontentsQuery The current query, for fluid interface
*/
public function joinCcPlaylist($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function joinCcPlaylist($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcPlaylist');
@ -736,7 +1011,7 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
*
* @return CcPlaylistQuery A secondary query class using the current class as primary query
*/
public function useCcPlaylistQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
public function useCcPlaylistQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcPlaylist($relationAlias, $joinType)
@ -789,9 +1064,9 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
/**
* Code to execute before every UPDATE statement
*
* @param array $values The associatiove array of columns and values for the update
* @param array $values The associative array of columns and values for the update
* @param PropelPDO $con The connection object used by the query
* @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), ortherwise it is a series of save() calls on all the found objects
* @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), otherwise it is a series of save() calls on all the found objects
*/
protected function basePreUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false)
{
@ -804,7 +1079,7 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
/**
* Code to execute after every UPDATE statement
*
* @param int $affectedRows the number of udated rows
* @param int $affectedRows the number of updated rows
* @param PropelPDO $con The connection object used by the query
*/
protected function basePostUpdate($affectedRows, PropelPDO $con)
@ -845,4 +1120,4 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
$this->ccPlaylists = array();
}
} // BaseCcPlaylistcontentsQuery
}

View File

@ -10,7 +10,6 @@
*/
abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persistent
{
/**
* Peer class name
*/
@ -24,6 +23,12 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
*/
protected static $peer;
/**
* The flag var to prevent infinite loop in deep copy
* @var boolean
*/
protected $startCopy = false;
/**
* The value for the id field.
* @var int
@ -67,6 +72,12 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
*/
protected $alreadyInValidation = false;
/**
* Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
* @var boolean
*/
protected $alreadyInClearAllReferencesDeep = false;
/**
* Get the [id] column value.
*
@ -74,6 +85,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
*/
public function getDbId()
{
return $this->id;
}
@ -84,6 +96,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
*/
public function getDbHistoryId()
{
return $this->history_id;
}
@ -94,6 +107,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
*/
public function getDbKey()
{
return $this->key;
}
@ -104,6 +118,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
*/
public function getDbValue()
{
return $this->value;
}
@ -115,7 +130,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
*/
public function setDbId($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -124,6 +139,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
$this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::ID;
}
return $this;
} // setDbId()
@ -135,7 +151,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
*/
public function setDbHistoryId($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
@ -148,6 +164,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
$this->aCcPlayoutHistory = null;
}
return $this;
} // setDbHistoryId()
@ -159,7 +176,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
*/
public function setDbKey($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -168,6 +185,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
$this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::KEY;
}
return $this;
} // setDbKey()
@ -179,7 +197,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
*/
public function setDbValue($v)
{
if ($v !== null) {
if ($v !== null && is_numeric($v)) {
$v = (string) $v;
}
@ -188,6 +206,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
$this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::VALUE;
}
return $this;
} // setDbValue()
@ -201,7 +220,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
*/
public function hasOnlyDefaultValues()
{
// otherwise, everything was equal, so return TRUE
// otherwise, everything was equal, so return true
return true;
} // hasOnlyDefaultValues()
@ -214,7 +233,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
* 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 int $startcol 0-based offset column which indicates which resultset 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.
@ -234,8 +253,9 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
if ($rehydrate) {
$this->ensureConsistency();
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 4; // 4 = CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS - CcPlayoutHistoryMetaDataPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 4; // 4 = CcPlayoutHistoryMetaDataPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating CcPlayoutHistoryMetaData object", $e);
@ -310,6 +330,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
* @param PropelPDO $con
* @return void
* @throws PropelException
* @throws Exception
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
@ -325,18 +346,18 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
$con->beginTransaction();
try {
$deleteQuery = CcPlayoutHistoryMetaDataQuery::create()
->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con);
if ($ret) {
CcPlayoutHistoryMetaDataQuery::create()
->filterByPrimaryKey($this->getPrimaryKey())
->delete($con);
$deleteQuery->delete($con);
$this->postDelete($con);
$con->commit();
$this->setDeleted(true);
} else {
$con->commit();
}
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -353,6 +374,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @throws Exception
* @see doSave()
*/
public function save(PropelPDO $con = null)
@ -387,8 +409,9 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
$affectedRows = 0;
}
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -412,7 +435,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
@ -423,35 +446,113 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
$this->setCcPlayoutHistory($this->aCcPlayoutHistory);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
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);
$this->doInsert($con);
} else {
$affectedRows += CcPlayoutHistoryMetaDataPeer::doUpdate($this, $con);
$this->doUpdate($con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
$affectedRows += 1;
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Insert the row in the database.
*
* @param PropelPDO $con
*
* @throws PropelException
* @see doSave()
*/
protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcPlayoutHistoryMetaDataPeer::ID . ')');
}
if (null === $this->id) {
try {
$stmt = $con->query("SELECT nextval('cc_playout_history_metadata_id_seq')");
$row = $stmt->fetch(PDO::FETCH_NUM);
$this->id = $row[0];
} catch (Exception $e) {
throw new PropelException('Unable to get sequence id.', $e);
}
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::ID)) {
$modifiedColumns[':p' . $index++] = '"id"';
}
if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::HISTORY_ID)) {
$modifiedColumns[':p' . $index++] = '"history_id"';
}
if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::KEY)) {
$modifiedColumns[':p' . $index++] = '"key"';
}
if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::VALUE)) {
$modifiedColumns[':p' . $index++] = '"value"';
}
$sql = sprintf(
'INSERT INTO "cc_playout_history_metadata" (%s) VALUES (%s)',
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case '"id"':
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
break;
case '"history_id"':
$stmt->bindValue($identifier, $this->history_id, PDO::PARAM_INT);
break;
case '"key"':
$stmt->bindValue($identifier, $this->key, PDO::PARAM_STR);
break;
case '"value"':
$stmt->bindValue($identifier, $this->value, PDO::PARAM_STR);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
}
$this->setNew(false);
}
/**
* Update the row in the database.
*
* @param PropelPDO $con
*
* @see doSave()
*/
protected function doUpdate(PropelPDO $con)
{
$selectCriteria = $this->buildPkeyCriteria();
$valuesCriteria = $this->buildCriteria();
BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
}
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
@ -486,11 +587,13 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
$this->validationFailures = $res;
return false;
}
/**
@ -498,10 +601,10 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
*
* 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.
* an aggregated 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.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
@ -513,7 +616,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
// We call the validate method on the following object(s) if they
// were passed to this object by their coresponding set
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
@ -542,13 +645,15 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @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;
}
@ -589,13 +694,18 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
* @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 $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
* @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)
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['CcPlayoutHistoryMetaData'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['CcPlayoutHistoryMetaData'][$this->getPrimaryKey()] = true;
$keys = CcPlayoutHistoryMetaDataPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getDbId(),
@ -603,11 +713,17 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
$keys[2] => $this->getDbKey(),
$keys[3] => $this->getDbValue(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
$result[$key] = $virtualColumn;
}
if ($includeForeignObjects) {
if (null !== $this->aCcPlayoutHistory) {
$result['CcPlayoutHistory'] = $this->aCcPlayoutHistory->toArray($keyType, $includeLazyLoadColumns, true);
$result['CcPlayoutHistory'] = $this->aCcPlayoutHistory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
}
return $result;
}
@ -618,13 +734,15 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
* @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
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcPlayoutHistoryMetaDataPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
$this->setByPosition($pos, $value);
}
/**
@ -664,7 +782,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
* 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')
* The default key type is the column's BasePeer::TYPE_PHPNAME
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
@ -739,6 +857,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
*/
public function isPrimaryKeyNull()
{
return null === $this->getDbId();
}
@ -750,17 +869,31 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
*
* @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.
* @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setDbHistoryId($this->history_id);
$copyObj->setDbKey($this->key);
$copyObj->setDbValue($this->value);
$copyObj->setDbHistoryId($this->getDbHistoryId());
$copyObj->setDbKey($this->getDbKey());
$copyObj->setDbValue($this->getDbValue());
if ($deepCopy && !$this->startCopy) {
// important: temporarily setNew(false) because this affects the behavior of
// the getter/setter methods for fkey referrer objects.
$copyObj->setNew(false);
// store object hash to prevent cycle
$this->startCopy = true;
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
if ($makeNew) {
$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.
@ -780,6 +913,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
@ -797,6 +931,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
if (self::$peer === null) {
self::$peer = new CcPlayoutHistoryMetaDataPeer();
}
return self::$peer;
}
@ -823,6 +958,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
$v->addCcPlayoutHistoryMetaData($this);
}
return $this;
}
@ -830,13 +966,14 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
/**
* Get the associated CcPlayoutHistory object
*
* @param PropelPDO Optional Connection object.
* @param PropelPDO $con Optional Connection object.
* @param $doQuery Executes a query to get the object if required
* @return CcPlayoutHistory The associated CcPlayoutHistory object.
* @throws PropelException
*/
public function getCcPlayoutHistory(PropelPDO $con = null)
public function getCcPlayoutHistory(PropelPDO $con = null, $doQuery = true)
{
if ($this->aCcPlayoutHistory === null && ($this->history_id !== null)) {
if ($this->aCcPlayoutHistory === null && ($this->history_id !== null) && $doQuery) {
$this->aCcPlayoutHistory = CcPlayoutHistoryQuery::create()->findPk($this->history_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
@ -846,6 +983,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
$this->aCcPlayoutHistory->addCcPlayoutHistoryMetaDatas($this);
*/
}
return $this->aCcPlayoutHistory;
}
@ -860,6 +998,7 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
$this->value = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;
$this->clearAllReferences();
$this->resetModified();
$this->setNew(true);
@ -867,39 +1006,46 @@ abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persi
}
/**
* Resets all collections of referencing foreign keys.
* Resets all references to other model objects or collections of model objects.
*
* 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.
* This method is a user-space workaround for PHP's inability to garbage collect
* objects with circular references (even in PHP 5.3). This is currently necessary
* when using Propel in certain daemon or large-volume/high-memory operations.
*
* @param boolean $deep Whether to also clear the references on all associated objects.
* @param boolean $deep Whether to also clear the references on all referrer objects.
*/
public function clearAllReferences($deep = false)
{
if ($deep) {
if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true;
if ($this->aCcPlayoutHistory instanceof Persistent) {
$this->aCcPlayoutHistory->clearAllReferences($deep);
}
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
$this->aCcPlayoutHistory = null;
}
/**
* Catches calls to virtual methods
* return the string representation of this object
*
* @return string
*/
public function __call($name, $params)
public function __toString()
{
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);
return (string) $this->exportTo(CcPlayoutHistoryMetaDataPeer::DEFAULT_STRING_FORMAT);
}
} // BaseCcPlayoutHistoryMetaData
/**
* return true is the object is in saving state
*
* @return boolean
*/
public function isAlreadyInSave()
{
return $this->alreadyInSave;
}
}

View File

@ -8,7 +8,8 @@
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryMetaDataPeer {
abstract class BaseCcPlayoutHistoryMetaDataPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'airtime';
@ -19,9 +20,6 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
/** 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';
@ -31,20 +29,26 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
/** 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 number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 4;
/** the column name for the HISTORY_ID field */
const HISTORY_ID = 'cc_playout_history_metadata.HISTORY_ID';
/** the column name for the id field */
const ID = 'cc_playout_history_metadata.id';
/** the column name for the KEY field */
const KEY = 'cc_playout_history_metadata.KEY';
/** the column name for the history_id field */
const HISTORY_ID = 'cc_playout_history_metadata.history_id';
/** the column name for the VALUE field */
const VALUE = 'cc_playout_history_metadata.VALUE';
/** 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';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identiy map to hold any loaded instances of CcPlayoutHistoryMetaData objects.
* An identity 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[]
@ -56,12 +60,12 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
* e.g. CcPlayoutHistoryMetaDataPeer::$fieldNames[CcPlayoutHistoryMetaDataPeer::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
protected 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_COLNAME => array (CcPlayoutHistoryMetaDataPeer::ID, CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryMetaDataPeer::KEY, CcPlayoutHistoryMetaDataPeer::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, )
@ -71,12 +75,12 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
* 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
* e.g. CcPlayoutHistoryMetaDataPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
protected 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_COLNAME => array (CcPlayoutHistoryMetaDataPeer::ID => 0, CcPlayoutHistoryMetaDataPeer::HISTORY_ID => 1, CcPlayoutHistoryMetaDataPeer::KEY => 2, CcPlayoutHistoryMetaDataPeer::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, )
@ -92,13 +96,14 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
* @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)
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
$toNames = CcPlayoutHistoryMetaDataPeer::getFieldNames($toType);
$key = isset(CcPlayoutHistoryMetaDataPeer::$fieldKeys[$fromType][$name]) ? CcPlayoutHistoryMetaDataPeer::$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));
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CcPlayoutHistoryMetaDataPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
@ -109,14 +114,15 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
* 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
* @throws PropelException - if the type is not valid.
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
if (!array_key_exists($type, CcPlayoutHistoryMetaDataPeer::$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];
return CcPlayoutHistoryMetaDataPeer::$fieldNames[$type];
}
/**
@ -156,10 +162,10 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$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');
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.history_id');
$criteria->addSelectColumn($alias . '.key');
$criteria->addSelectColumn($alias . '.value');
}
}
@ -190,7 +196,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
$criteria->setDbName(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -204,10 +210,11 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
@ -223,10 +230,11 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
@ -241,7 +249,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
/**
* 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
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
@ -263,7 +271,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
@ -277,16 +285,16 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
* 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 CcPlayoutHistoryMetaData $obj 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)
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getDbId();
} // if key === null
self::$instances[$key] = $obj;
CcPlayoutHistoryMetaDataPeer::$instances[$key] = $obj;
}
}
@ -299,6 +307,9 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcPlayoutHistoryMetaData object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
@ -313,7 +324,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
throw $e;
}
unset(self::$instances[$key]);
unset(CcPlayoutHistoryMetaDataPeer::$instances[$key]);
}
} // removeInstanceFromPool()
@ -324,16 +335,17 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
* 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.
* @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];
if (isset(CcPlayoutHistoryMetaDataPeer::$instances[$key])) {
return CcPlayoutHistoryMetaDataPeer::$instances[$key];
}
}
return null; // just to be explicit
}
@ -342,9 +354,14 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
*
* @return void
*/
public static function clearInstancePool()
public static function clearInstancePool($and_clear_all_references = false)
{
self::$instances = array();
if ($and_clear_all_references) {
foreach (CcPlayoutHistoryMetaDataPeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
CcPlayoutHistoryMetaDataPeer::$instances = array();
}
/**
@ -363,14 +380,15 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
*
* @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.
* @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 the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
@ -385,6 +403,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
@ -400,7 +419,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcPlayoutHistoryMetaDataPeer::getOMClass(false);
$cls = CcPlayoutHistoryMetaDataPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, 0);
@ -417,6 +436,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
@ -435,16 +455,18 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
// 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;
$col = $startcol + CcPlayoutHistoryMetaDataPeer::NUM_HYDRATE_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
*
@ -475,7 +497,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -491,6 +513,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -510,11 +533,11 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
}
CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
$startcol = (CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS - CcPlayoutHistoryMetaDataPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol = CcPlayoutHistoryMetaDataPeer::NUM_HYDRATE_COLUMNS;
CcPlayoutHistoryPeer::addSelectColumns($criteria);
$criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::ID, $join_behavior);
@ -530,7 +553,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPlayoutHistoryMetaDataPeer::getOMClass(false);
$cls = CcPlayoutHistoryMetaDataPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -542,7 +565,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$obj2 = CcPlayoutHistoryPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcPlayoutHistoryPeer::getOMClass(false);
$cls = CcPlayoutHistoryPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
@ -557,6 +580,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -591,7 +615,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
@ -607,6 +631,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
@ -626,14 +651,14 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
}
CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
$startcol2 = (CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS - CcPlayoutHistoryMetaDataPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol2 = CcPlayoutHistoryMetaDataPeer::NUM_HYDRATE_COLUMNS;
CcPlayoutHistoryPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
$startcol3 = $startcol2 + CcPlayoutHistoryPeer::NUM_HYDRATE_COLUMNS;
$criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::ID, $join_behavior);
@ -647,7 +672,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPlayoutHistoryMetaDataPeer::getOMClass(false);
$cls = CcPlayoutHistoryMetaDataPeer::getOMClass();
$obj1 = new $cls();
$obj1->hydrate($row);
@ -661,7 +686,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$obj2 = CcPlayoutHistoryPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcPlayoutHistoryPeer::getOMClass(false);
$cls = CcPlayoutHistoryPeer::getOMClass();
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
@ -675,6 +700,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
@ -687,7 +713,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
return Propel::getDatabaseMap(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME)->getTable(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
}
/**
@ -696,30 +722,24 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcPlayoutHistoryMetaDataPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcPlayoutHistoryMetaDataTableMap());
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
* @return string ClassName
*/
public static function getOMClass($withPrefix = true)
public static function getOMClass($row = 0, $colnum = 0)
{
return $withPrefix ? CcPlayoutHistoryMetaDataPeer::CLASS_DEFAULT : CcPlayoutHistoryMetaDataPeer::OM_CLASS;
return CcPlayoutHistoryMetaDataPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcPlayoutHistoryMetaData or Criteria object.
* Performs 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
@ -745,7 +765,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
@ -753,7 +773,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -762,7 +782,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
}
/**
* Method perform an UPDATE on the database, given a CcPlayoutHistoryMetaData or Criteria object.
* Performs 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).
@ -776,7 +796,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
$selectCriteria = new Criteria(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
@ -795,17 +815,19 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_playout_history_metadata table.
* Deletes all rows from the cc_playout_history_metadata table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll($con = null)
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
@ -822,15 +844,16 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
CcPlayoutHistoryMetaDataPeer::clearInstancePool();
CcPlayoutHistoryMetaDataPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcPlayoutHistoryMetaData or Criteria object OR a primary key value.
* Performs 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
@ -859,7 +882,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
// 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 = new Criteria(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
$criteria->add(CcPlayoutHistoryMetaDataPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
@ -868,7 +891,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$criteria->setDbName(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
@ -880,8 +903,9 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$affectedRows += BasePeer::doDelete($criteria, $con);
CcPlayoutHistoryMetaDataPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
@ -899,7 +923,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
*
* @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)
public static function doValidate($obj, $cols = null)
{
$columns = array();
@ -912,7 +936,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
@ -955,6 +979,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return CcPlayoutHistoryMetaData[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
@ -972,6 +997,7 @@ abstract class BaseCcPlayoutHistoryMetaDataPeer {
$criteria->add(CcPlayoutHistoryMetaDataPeer::ID, $pks, Criteria::IN);
$objs = CcPlayoutHistoryMetaDataPeer::doSelect($criteria, $con);
}
return $objs;
}

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