changed how shows saved in database to make keeping track of host permissions easier.

This commit is contained in:
naomiaro 2010-12-10 12:15:17 -05:00
parent b10c2cfe2a
commit d94063fbe4
30 changed files with 6527 additions and 812 deletions

View file

@ -36,6 +36,20 @@ return array (
'BaseCcShowPeer' => 'campcaster/om/BaseCcShowPeer.php',
'BaseCcShow' => 'campcaster/om/BaseCcShow.php',
'BaseCcShowQuery' => 'campcaster/om/BaseCcShowQuery.php',
'CcShowDaysTableMap' => 'campcaster/map/CcShowDaysTableMap.php',
'CcShowDaysPeer' => 'campcaster/CcShowDaysPeer.php',
'CcShowDays' => 'campcaster/CcShowDays.php',
'CcShowDaysQuery' => 'campcaster/CcShowDaysQuery.php',
'BaseCcShowDaysPeer' => 'campcaster/om/BaseCcShowDaysPeer.php',
'BaseCcShowDays' => 'campcaster/om/BaseCcShowDays.php',
'BaseCcShowDaysQuery' => 'campcaster/om/BaseCcShowDaysQuery.php',
'CcShowHostsTableMap' => 'campcaster/map/CcShowHostsTableMap.php',
'CcShowHostsPeer' => 'campcaster/CcShowHostsPeer.php',
'CcShowHosts' => 'campcaster/CcShowHosts.php',
'CcShowHostsQuery' => 'campcaster/CcShowHostsQuery.php',
'BaseCcShowHostsPeer' => 'campcaster/om/BaseCcShowHostsPeer.php',
'BaseCcShowHosts' => 'campcaster/om/BaseCcShowHosts.php',
'BaseCcShowHostsQuery' => 'campcaster/om/BaseCcShowHostsQuery.php',
'CcPlaylistTableMap' => 'campcaster/map/CcPlaylistTableMap.php',
'CcPlaylistPeer' => 'campcaster/CcPlaylistPeer.php',
'CcPlaylist' => 'campcaster/CcPlaylist.php',

View file

@ -71,12 +71,26 @@ class ScheduleController extends Zend_Controller_Action
$show = new Show($userInfo->type);
$this->view->overlap = $show->moveShow($showId, $deltaDay, $deltaMin);
$overlap = $show->moveShow($showId, $deltaDay, $deltaMin);
if(isset($overlap))
$this->view->overlap = $overlap;
}
public function resizeShowAction()
{
// action body
$deltaDay = $this->_getParam('day');
$deltaMin = $this->_getParam('min');
$showId = $this->_getParam('showId');
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$show = new Show($userInfo->type);
$overlap = $show->resizeShow($showId, $deltaDay, $deltaMin);
if(isset($overlap))
$this->view->overlap = $overlap;
}

View file

@ -10,31 +10,6 @@ class Show {
}
private function makeFullCalendarEvent($show, $date, $options=array()) {
$start = $date."T".$show["start_time"];
$end = $date."T".$show["end_time"];
$event = array(
"id" => $show["show_id"],
"title" => $show["name"],
"start" => $start,
"end" => $end,
"allDay" => false,
"description" => $show["description"]
);
foreach($options as $key=>$value) {
$event[$key] = $value;
}
if($this->_userRole === "A") {
$event["editable"] = true;
}
return $event;
}
//end dates are non inclusive.
public function addShow($data) {
@ -44,10 +19,6 @@ class Show {
$r = $con->query($sql);
$endTime = $r->fetchColumn(0);
$sql = "SELECT nextval('show_group_id_seq')";
$r = $con->query($sql);
$showId = $r->fetchColumn(0);
$sql = "SELECT EXTRACT(DOW FROM TIMESTAMP '{$data['start_date']} {$data['start_time']}')";
$r = $con->query($sql);
$startDow = $r->fetchColumn(0);
@ -71,6 +42,14 @@ class Show {
$data['day_check'] = array($startDow);
}
$show = new CcShow();
$show->setDbName($data['name']);
$show->setDbRepeats($data['repeats']);
$show->setDbDescription($data['description']);
$show->save();
$showId = $show->getDbId();
foreach ($data['day_check'] as $day) {
if($startDow !== $day){
@ -88,17 +67,14 @@ class Show {
$start = $data['start_date'];
}
$show = new CcShow();
$show->setDbName($data['name']);
$show->setDbFirstShow($start);
$show->setDbLastShow($endDate);
$show->setDbStartTime($data['start_time']);
$show->setDbEndTime($endTime);
$show->setDbRepeats($data['repeats']);
$show->setDbDay($day);
$show->setDbDescription($data['description']);
$show->setDbShowId($showId);
$show->save();
$showDay = new CcShowDays();
$showDay->setDbFirstShow($start);
$showDay->setDbLastShow($endDate);
$showDay->setDbStartTime($data['start_time']);
$showDay->setDbEndTime($endTime);
$showDay->setDbDay($day);
$showDay->setDbShowId($showId);
$showDay->save();
}
}
@ -106,7 +82,7 @@ class Show {
public function moveShow($showId, $deltaDay, $deltaMin){
global $CC_DBC;
$sql = "SELECT * FROM cc_show WHERE show_id = '{$showId}'";
$sql = "SELECT * FROM cc_show_days WHERE show_id = '{$showId}'";
$res = $CC_DBC->GetAll($sql);
$show = $res[0];
@ -123,18 +99,73 @@ class Show {
$mins = abs($deltaMin%60);
$sql = "SELECT time '{$show["start_time"]}' + interval '{$hours}:{$mins}'";
//echo $sql;
$s_time = $CC_DBC->GetOne($sql);
$sql = "SELECT time '{$show["end_time"]}' + interval '{$hours}:{$mins}'";
//echo $sql;
$e_time = $CC_DBC->GetOne($sql);
foreach($res as $show) {
$days[] = $show["day"] + $deltaDay;
}
return $this->getShows($start, $end, $days, $s_time, $e_time, array($showId));
//need to check each specific day if times different then merge arrays.
$overlap = $this->getShows($start, $end, $days, $s_time, $e_time, array($showId));
if(count($overlap) > 0) {
return $overlap;
}
foreach($res as $row) {
$show = CcShowDaysQuery::create()->findPK($row["id"]);
$show->setDbStartTime($s_time);
$show->setDbEndTime($e_time);
$show->save();
}
}
public function resizeShow($showId, $deltaDay, $deltaMin){
global $CC_DBC;
$sql = "SELECT * FROM cc_show_days WHERE show_id = '{$showId}'";
$res = $CC_DBC->GetAll($sql);
$show = $res[0];
$start = $show["first_show"];
$end = $show["last_show"];
$days = array();
$hours = $deltaMin/60;
if($hours > 0)
$hours = floor($hours);
else
$hours = ceil($hours);
$mins = abs($deltaMin%60);
$s_time = $show["start_time"];
$sql = "SELECT time '{$show["end_time"]}' + interval '{$hours}:{$mins}'";
$e_time = $CC_DBC->GetOne($sql);
foreach($res as $show) {
$days[] = $show["day"] + $deltaDay;
}
//need to check each specific day if times different then merge arrays.
$overlap = $this->getShows($start, $end, $days, $s_time, $e_time, array($showId));
if(count($overlap) > 0) {
return $overlap;
}
foreach($res as $row) {
$show = CcShowDaysQuery::create()->findPK($row["id"]);
$show->setDbStartTime($s_time);
$show->setDbEndTime($e_time);
$show->save();
}
}
public function getShows($start=NULL, $end=NULL, $days=NULL, $s_time=NULL, $e_time=NULL, $exclude_shows=NULL) {
@ -142,7 +173,10 @@ class Show {
$sql;
$sql_gen = "SELECT * FROM cc_show";
$sql_gen = "SELECT cc_show_days.id AS day_id, name, repeats, description,
first_show, last_show, start_time, end_time, day, show_id
FROM (cc_show LEFT JOIN cc_show_days ON cc_show.id = cc_show_days.show_id)";
$sql = $sql_gen;
if(!is_null($start) && !is_null($end)) {
@ -247,4 +281,29 @@ class Show {
return $shows;
}
private function makeFullCalendarEvent($show, $date, $options=array()) {
$start = $date."T".$show["start_time"];
$end = $date."T".$show["end_time"];
$event = array(
"id" => $show["show_id"],
"title" => $show["name"],
"start" => $start,
"end" => $end,
"allDay" => false,
"description" => $show["description"]
);
foreach($options as $key=>$value) {
$event[$key] = $value;
}
if($this->_userRole === "A") {
$event["editable"] = true;
}
return $event;
}
}

View file

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show_days' 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.campcaster
*/
class CcShowDays extends BaseCcShowDays {
} // CcShowDays

View file

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_days' 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.campcaster
*/
class CcShowDaysPeer extends BaseCcShowDaysPeer {
} // CcShowDaysPeer

View file

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_days' 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.campcaster
*/
class CcShowDaysQuery extends BaseCcShowDaysQuery {
} // CcShowDaysQuery

View file

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show_hosts' 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.campcaster
*/
class CcShowHosts extends BaseCcShowHosts {
} // CcShowHosts

View file

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_hosts' 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.campcaster
*/
class CcShowHostsPeer extends BaseCcShowHostsPeer {
} // CcShowHostsPeer

View file

@ -0,0 +1,18 @@
<?php
/**
* Skeleton subclass for performing query and update operations on the 'cc_show_hosts' 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.campcaster
*/
class CcShowHostsQuery extends BaseCcShowHostsQuery {
} // CcShowHostsQuery

View file

@ -0,0 +1,59 @@
<?php
/**
* This class defines the structure of the 'cc_show_days' 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.campcaster.map
*/
class CcShowDaysTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'campcaster.map.CcShowDaysTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_show_days');
$this->setPhpName('CcShowDays');
$this->setClassname('CcShowDays');
$this->setPackage('campcaster');
$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('END_TIME', 'DbEndTime', 'TIME', true, null, null);
$this->addColumn('DAY', 'DbDay', 'TINYINT', true, null, null);
$this->addForeignKey('SHOW_ID', 'DbShowId', 'INTEGER', 'cc_show', 'ID', true, null, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcShow', 'CcShow', RelationMap::MANY_TO_ONE, array('show_id' => 'id', ), 'CASCADE', null);
} // buildRelations()
} // CcShowDaysTableMap

View file

@ -0,0 +1,56 @@
<?php
/**
* This class defines the structure of the 'cc_show_hosts' 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.campcaster.map
*/
class CcShowHostsTableMap extends TableMap {
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'campcaster.map.CcShowHostsTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('cc_show_hosts');
$this->setPhpName('CcShowHosts');
$this->setClassname('CcShowHosts');
$this->setPackage('campcaster');
$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);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
$this->addRelation('CcShow', 'CcShow', RelationMap::MANY_TO_ONE, array('show_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('subjs_id' => 'id', ), 'CASCADE', null);
} // buildRelations()
} // CcShowHostsTableMap

View file

@ -40,14 +40,8 @@ class CcShowTableMap extends TableMap {
// columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
$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('END_TIME', 'DbEndTime', 'TIME', true, null, null);
$this->addColumn('REPEATS', 'DbRepeats', 'TINYINT', true, null, null);
$this->addColumn('DAY', 'DbDay', 'TINYINT', true, null, null);
$this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null);
$this->addColumn('SHOW_ID', 'DbShowId', 'INTEGER', true, null, null);
// validators
} // initialize()
@ -56,6 +50,8 @@ class CcShowTableMap extends TableMap {
*/
public function buildRelations()
{
$this->addRelation('CcShowDays', 'CcShowDays', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null);
$this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null);
} // buildRelations()
} // CcShowTableMap

View file

@ -56,6 +56,7 @@ class CcSubjsTableMap extends TableMap {
$this->addRelation('CcAccess', 'CcAccess', RelationMap::ONE_TO_MANY, array('id' => 'owner', ), null, null);
$this->addRelation('CcFiles', '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' => 'editedby', ), null, null);
$this->addRelation('CcPref', 'CcPref', RelationMap::ONE_TO_MANY, array('id' => 'subjid', ), 'CASCADE', null);
$this->addRelation('CcSess', 'CcSess', RelationMap::ONE_TO_MANY, array('id' => 'userid', ), 'CASCADE', null);

View file

@ -37,42 +37,12 @@ abstract class BaseCcShow extends BaseObject implements Persistent
*/
protected $name;
/**
* The value for the first_show field.
* @var string
*/
protected $first_show;
/**
* The value for the last_show field.
* @var string
*/
protected $last_show;
/**
* The value for the start_time field.
* @var string
*/
protected $start_time;
/**
* The value for the end_time field.
* @var string
*/
protected $end_time;
/**
* The value for the repeats field.
* @var int
*/
protected $repeats;
/**
* The value for the day field.
* @var int
*/
protected $day;
/**
* The value for the description field.
* @var string
@ -80,10 +50,14 @@ abstract class BaseCcShow extends BaseObject implements Persistent
protected $description;
/**
* The value for the show_id field.
* @var int
* @var array CcShowDays[] Collection to store aggregation of CcShowDays objects.
*/
protected $show_id;
protected $collCcShowDayss;
/**
* @var array CcShowHosts[] Collection to store aggregation of CcShowHosts objects.
*/
protected $collCcShowHostss;
/**
* Flag to prevent endless save loop, if this object is referenced
@ -140,138 +114,6 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return $this->name;
}
/**
* Get the [optionally formatted] temporal [first_show] column value.
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getDbFirstShow($format = '%x')
{
if ($this->first_show === null) {
return null;
}
try {
$dt = new DateTime($this->first_show);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->first_show, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
}
/**
* Get the [optionally formatted] temporal [last_show] column value.
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getDbLastShow($format = '%x')
{
if ($this->last_show === null) {
return null;
}
try {
$dt = new DateTime($this->last_show);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->last_show, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
}
/**
* Get the [optionally formatted] temporal [start_time] column value.
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getDbStartTime($format = '%X')
{
if ($this->start_time === null) {
return null;
}
try {
$dt = new DateTime($this->start_time);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->start_time, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
}
/**
* Get the [optionally formatted] temporal [end_time] column value.
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getDbEndTime($format = '%X')
{
if ($this->end_time === null) {
return null;
}
try {
$dt = new DateTime($this->end_time);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->end_time, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
}
/**
* Get the [repeats] column value.
*
@ -282,16 +124,6 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return $this->repeats;
}
/**
* Get the [day] column value.
*
* @return int
*/
public function getDbDay()
{
return $this->day;
}
/**
* Get the [description] column value.
*
@ -302,16 +134,6 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return $this->description;
}
/**
* Get the [show_id] column value.
*
* @return int
*/
public function getDbShowId()
{
return $this->show_id;
}
/**
* Set the value of [id] column.
*
@ -352,202 +174,6 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return $this;
} // setDbName()
/**
* Sets the value of [first_show] column to a normalized version of the date/time value specified.
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @return CcShow The current object (for fluent API support)
*/
public function setDbFirstShow($v)
{
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
// -- which is unexpected, to say the least.
if ($v === null || $v === '') {
$dt = null;
} elseif ($v instanceof DateTime) {
$dt = $v;
} else {
// some string/numeric value passed; we normalize that so that we can
// validate it.
try {
if (is_numeric($v)) { // if it's a unix timestamp
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
// We have to explicitly specify and then change the time zone because of a
// DateTime bug: http://bugs.php.net/bug.php?id=43003
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
} else {
$dt = new DateTime($v);
}
} catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
}
if ( $this->first_show !== null || $dt !== null ) {
// (nested ifs are a little easier to read in this case)
$currNorm = ($this->first_show !== null && $tmpDt = new DateTime($this->first_show)) ? $tmpDt->format('Y-m-d') : null;
$newNorm = ($dt !== null) ? $dt->format('Y-m-d') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
)
{
$this->first_show = ($dt ? $dt->format('Y-m-d') : null);
$this->modifiedColumns[] = CcShowPeer::FIRST_SHOW;
}
} // if either are not null
return $this;
} // setDbFirstShow()
/**
* Sets the value of [last_show] column to a normalized version of the date/time value specified.
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @return CcShow The current object (for fluent API support)
*/
public function setDbLastShow($v)
{
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
// -- which is unexpected, to say the least.
if ($v === null || $v === '') {
$dt = null;
} elseif ($v instanceof DateTime) {
$dt = $v;
} else {
// some string/numeric value passed; we normalize that so that we can
// validate it.
try {
if (is_numeric($v)) { // if it's a unix timestamp
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
// We have to explicitly specify and then change the time zone because of a
// DateTime bug: http://bugs.php.net/bug.php?id=43003
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
} else {
$dt = new DateTime($v);
}
} catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
}
if ( $this->last_show !== null || $dt !== null ) {
// (nested ifs are a little easier to read in this case)
$currNorm = ($this->last_show !== null && $tmpDt = new DateTime($this->last_show)) ? $tmpDt->format('Y-m-d') : null;
$newNorm = ($dt !== null) ? $dt->format('Y-m-d') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
)
{
$this->last_show = ($dt ? $dt->format('Y-m-d') : null);
$this->modifiedColumns[] = CcShowPeer::LAST_SHOW;
}
} // if either are not null
return $this;
} // setDbLastShow()
/**
* 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.
* @return CcShow 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);
}
}
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('H:i:s') : null;
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
)
{
$this->start_time = ($dt ? $dt->format('H:i:s') : null);
$this->modifiedColumns[] = CcShowPeer::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.
* @return CcShow 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);
}
}
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('H:i:s') : null;
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
)
{
$this->end_time = ($dt ? $dt->format('H:i:s') : null);
$this->modifiedColumns[] = CcShowPeer::END_TIME;
}
} // if either are not null
return $this;
} // setDbEndTime()
/**
* Set the value of [repeats] column.
*
@ -568,26 +194,6 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return $this;
} // setDbRepeats()
/**
* Set the value of [day] column.
*
* @param int $v new value
* @return CcShow The current object (for fluent API support)
*/
public function setDbDay($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->day !== $v) {
$this->day = $v;
$this->modifiedColumns[] = CcShowPeer::DAY;
}
return $this;
} // setDbDay()
/**
* Set the value of [description] column.
*
@ -608,26 +214,6 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return $this;
} // setDbDescription()
/**
* Set the value of [show_id] column.
*
* @param int $v new value
* @return CcShow The current object (for fluent API support)
*/
public function setDbShowId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->show_id !== $v) {
$this->show_id = $v;
$this->modifiedColumns[] = CcShowPeer::SHOW_ID;
}
return $this;
} // setDbShowId()
/**
* Indicates whether the columns in this object are only set to default values.
*
@ -666,14 +252,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
$this->first_show = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->last_show = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->start_time = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
$this->end_time = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
$this->repeats = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
$this->day = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null;
$this->description = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->show_id = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : null;
$this->repeats = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
$this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->resetModified();
$this->setNew(false);
@ -682,7 +262,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->ensureConsistency();
}
return $startcol + 10; // 10 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 4; // 4 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcShow object", $e);
@ -744,6 +324,10 @@ abstract class BaseCcShow extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
$this->collCcShowDayss = null;
$this->collCcShowHostss = null;
} // if (deep)
}
@ -877,6 +461,22 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
}
if ($this->collCcShowDayss !== null) {
foreach ($this->collCcShowDayss as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collCcShowHostss !== null) {
foreach ($this->collCcShowHostss as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
@ -948,6 +548,22 @@ abstract class BaseCcShow extends BaseObject implements Persistent
}
if ($this->collCcShowDayss !== null) {
foreach ($this->collCcShowDayss as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
if ($this->collCcShowHostss !== null) {
foreach ($this->collCcShowHostss as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
$this->alreadyInValidation = false;
}
@ -988,29 +604,11 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return $this->getDbName();
break;
case 2:
return $this->getDbFirstShow();
break;
case 3:
return $this->getDbLastShow();
break;
case 4:
return $this->getDbStartTime();
break;
case 5:
return $this->getDbEndTime();
break;
case 6:
return $this->getDbRepeats();
break;
case 7:
return $this->getDbDay();
break;
case 8:
case 3:
return $this->getDbDescription();
break;
case 9:
return $this->getDbShowId();
break;
default:
return null;
break;
@ -1036,14 +634,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$result = array(
$keys[0] => $this->getDbId(),
$keys[1] => $this->getDbName(),
$keys[2] => $this->getDbFirstShow(),
$keys[3] => $this->getDbLastShow(),
$keys[4] => $this->getDbStartTime(),
$keys[5] => $this->getDbEndTime(),
$keys[6] => $this->getDbRepeats(),
$keys[7] => $this->getDbDay(),
$keys[8] => $this->getDbDescription(),
$keys[9] => $this->getDbShowId(),
$keys[2] => $this->getDbRepeats(),
$keys[3] => $this->getDbDescription(),
);
return $result;
}
@ -1082,29 +674,11 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->setDbName($value);
break;
case 2:
$this->setDbFirstShow($value);
break;
case 3:
$this->setDbLastShow($value);
break;
case 4:
$this->setDbStartTime($value);
break;
case 5:
$this->setDbEndTime($value);
break;
case 6:
$this->setDbRepeats($value);
break;
case 7:
$this->setDbDay($value);
break;
case 8:
case 3:
$this->setDbDescription($value);
break;
case 9:
$this->setDbShowId($value);
break;
} // switch()
}
@ -1131,14 +705,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setDbName($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDbFirstShow($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDbLastShow($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setDbStartTime($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setDbEndTime($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setDbRepeats($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setDbDay($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setDbDescription($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setDbShowId($arr[$keys[9]]);
if (array_key_exists($keys[2], $arr)) $this->setDbRepeats($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDbDescription($arr[$keys[3]]);
}
/**
@ -1152,14 +720,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
if ($this->isColumnModified(CcShowPeer::ID)) $criteria->add(CcShowPeer::ID, $this->id);
if ($this->isColumnModified(CcShowPeer::NAME)) $criteria->add(CcShowPeer::NAME, $this->name);
if ($this->isColumnModified(CcShowPeer::FIRST_SHOW)) $criteria->add(CcShowPeer::FIRST_SHOW, $this->first_show);
if ($this->isColumnModified(CcShowPeer::LAST_SHOW)) $criteria->add(CcShowPeer::LAST_SHOW, $this->last_show);
if ($this->isColumnModified(CcShowPeer::START_TIME)) $criteria->add(CcShowPeer::START_TIME, $this->start_time);
if ($this->isColumnModified(CcShowPeer::END_TIME)) $criteria->add(CcShowPeer::END_TIME, $this->end_time);
if ($this->isColumnModified(CcShowPeer::REPEATS)) $criteria->add(CcShowPeer::REPEATS, $this->repeats);
if ($this->isColumnModified(CcShowPeer::DAY)) $criteria->add(CcShowPeer::DAY, $this->day);
if ($this->isColumnModified(CcShowPeer::DESCRIPTION)) $criteria->add(CcShowPeer::DESCRIPTION, $this->description);
if ($this->isColumnModified(CcShowPeer::SHOW_ID)) $criteria->add(CcShowPeer::SHOW_ID, $this->show_id);
return $criteria;
}
@ -1222,14 +784,28 @@ abstract class BaseCcShow extends BaseObject implements Persistent
public function copyInto($copyObj, $deepCopy = false)
{
$copyObj->setDbName($this->name);
$copyObj->setDbFirstShow($this->first_show);
$copyObj->setDbLastShow($this->last_show);
$copyObj->setDbStartTime($this->start_time);
$copyObj->setDbEndTime($this->end_time);
$copyObj->setDbRepeats($this->repeats);
$copyObj->setDbDay($this->day);
$copyObj->setDbDescription($this->description);
$copyObj->setDbShowId($this->show_id);
if ($deepCopy) {
// important: temporarily setNew(false) because this affects the behavior of
// the getter/setter methods for fkey referrer objects.
$copyObj->setNew(false);
foreach ($this->getCcShowDayss() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCcShowDays($relObj->copy($deepCopy));
}
}
foreach ($this->getCcShowHostss() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCcShowHosts($relObj->copy($deepCopy));
}
}
} // if ($deepCopy)
$copyObj->setNew(true);
$copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
@ -1273,6 +849,249 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return self::$peer;
}
/**
* Clears out the collCcShowDayss collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
* @see addCcShowDayss()
*/
public function clearCcShowDayss()
{
$this->collCcShowDayss = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Initializes the collCcShowDayss collection.
*
* By default this just sets the collCcShowDayss collection to an empty array (like clearcollCcShowDayss());
* however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database.
*
* @return void
*/
public function initCcShowDayss()
{
$this->collCcShowDayss = new PropelObjectCollection();
$this->collCcShowDayss->setModel('CcShowDays');
}
/**
* Gets an array of CcShowDays objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this CcShow is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @return PropelCollection|array CcShowDays[] List of CcShowDays objects
* @throws PropelException
*/
public function getCcShowDayss($criteria = null, PropelPDO $con = null)
{
if(null === $this->collCcShowDayss || null !== $criteria) {
if ($this->isNew() && null === $this->collCcShowDayss) {
// return empty collection
$this->initCcShowDayss();
} else {
$collCcShowDayss = CcShowDaysQuery::create(null, $criteria)
->filterByCcShow($this)
->find($con);
if (null !== $criteria) {
return $collCcShowDayss;
}
$this->collCcShowDayss = $collCcShowDayss;
}
}
return $this->collCcShowDayss;
}
/**
* Returns the number of related CcShowDays objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
* @return int Count of related CcShowDays objects.
* @throws PropelException
*/
public function countCcShowDayss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
if(null === $this->collCcShowDayss || null !== $criteria) {
if ($this->isNew() && null === $this->collCcShowDayss) {
return 0;
} else {
$query = CcShowDaysQuery::create(null, $criteria);
if($distinct) {
$query->distinct();
}
return $query
->filterByCcShow($this)
->count($con);
}
} else {
return count($this->collCcShowDayss);
}
}
/**
* Method called to associate a CcShowDays object to this object
* through the CcShowDays foreign key attribute.
*
* @param CcShowDays $l CcShowDays
* @return void
* @throws PropelException
*/
public function addCcShowDays(CcShowDays $l)
{
if ($this->collCcShowDayss === null) {
$this->initCcShowDayss();
}
if (!$this->collCcShowDayss->contains($l)) { // only add it if the **same** object is not already associated
$this->collCcShowDayss[]= $l;
$l->setCcShow($this);
}
}
/**
* Clears out the collCcShowHostss collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
* @see addCcShowHostss()
*/
public function clearCcShowHostss()
{
$this->collCcShowHostss = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Initializes the collCcShowHostss collection.
*
* By default this just sets the collCcShowHostss collection to an empty array (like clearcollCcShowHostss());
* however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database.
*
* @return void
*/
public function initCcShowHostss()
{
$this->collCcShowHostss = new PropelObjectCollection();
$this->collCcShowHostss->setModel('CcShowHosts');
}
/**
* Gets an array of CcShowHosts objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this CcShow is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @return PropelCollection|array CcShowHosts[] List of CcShowHosts objects
* @throws PropelException
*/
public function getCcShowHostss($criteria = null, PropelPDO $con = null)
{
if(null === $this->collCcShowHostss || null !== $criteria) {
if ($this->isNew() && null === $this->collCcShowHostss) {
// return empty collection
$this->initCcShowHostss();
} else {
$collCcShowHostss = CcShowHostsQuery::create(null, $criteria)
->filterByCcShow($this)
->find($con);
if (null !== $criteria) {
return $collCcShowHostss;
}
$this->collCcShowHostss = $collCcShowHostss;
}
}
return $this->collCcShowHostss;
}
/**
* Returns the number of related CcShowHosts objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
* @return int Count of related CcShowHosts objects.
* @throws PropelException
*/
public function countCcShowHostss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
if(null === $this->collCcShowHostss || null !== $criteria) {
if ($this->isNew() && null === $this->collCcShowHostss) {
return 0;
} else {
$query = CcShowHostsQuery::create(null, $criteria);
if($distinct) {
$query->distinct();
}
return $query
->filterByCcShow($this)
->count($con);
}
} else {
return count($this->collCcShowHostss);
}
}
/**
* Method called to associate a CcShowHosts object to this object
* through the CcShowHosts foreign key attribute.
*
* @param CcShowHosts $l CcShowHosts
* @return void
* @throws PropelException
*/
public function addCcShowHosts(CcShowHosts $l)
{
if ($this->collCcShowHostss === null) {
$this->initCcShowHostss();
}
if (!$this->collCcShowHostss->contains($l)) { // only add it if the **same** object is not already associated
$this->collCcShowHostss[]= $l;
$l->setCcShow($this);
}
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this CcShow is new, it will return
* an empty collection; or if this CcShow has previously
* been saved, it will retrieve related CcShowHostss from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in CcShow.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return PropelCollection|array CcShowHosts[] List of CcShowHosts objects
*/
public function getCcShowHostssJoinCcSubjs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = CcShowHostsQuery::create(null, $criteria);
$query->joinWith('CcSubjs', $join_behavior);
return $this->getCcShowHostss($query, $con);
}
/**
* Clears the current object and sets all attributes to their default values
*/
@ -1280,14 +1099,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent
{
$this->id = null;
$this->name = null;
$this->first_show = null;
$this->last_show = null;
$this->start_time = null;
$this->end_time = null;
$this->repeats = null;
$this->day = null;
$this->description = null;
$this->show_id = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->clearAllReferences();
@ -1309,8 +1122,20 @@ abstract class BaseCcShow extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
if ($this->collCcShowDayss) {
foreach ((array) $this->collCcShowDayss as $o) {
$o->clearAllReferences($deep);
}
}
if ($this->collCcShowHostss) {
foreach ((array) $this->collCcShowHostss as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep)
$this->collCcShowDayss = null;
$this->collCcShowHostss = null;
}
/**

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,998 @@
<?php
/**
* Base static class for performing query and update operations on the 'cc_show_days' table.
*
*
*
* @package propel.generator.campcaster.om
*/
abstract class BaseCcShowDaysPeer {
/** the default database name for this class */
const DATABASE_NAME = 'campcaster';
/** the table name for this class */
const TABLE_NAME = 'cc_show_days';
/** the related Propel class for this table */
const OM_CLASS = 'CcShowDays';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'campcaster.CcShowDays';
/** the related TableMap class for this table */
const TM_CLASS = 'CcShowDaysTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 7;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ID field */
const ID = 'cc_show_days.ID';
/** the column name for the FIRST_SHOW field */
const FIRST_SHOW = 'cc_show_days.FIRST_SHOW';
/** the column name for the LAST_SHOW field */
const LAST_SHOW = 'cc_show_days.LAST_SHOW';
/** the column name for the START_TIME field */
const START_TIME = 'cc_show_days.START_TIME';
/** the column name for the END_TIME field */
const END_TIME = 'cc_show_days.END_TIME';
/** the column name for the DAY field */
const DAY = 'cc_show_days.DAY';
/** the column name for the SHOW_ID field */
const SHOW_ID = 'cc_show_days.SHOW_ID';
/**
* An identiy map to hold any loaded instances of CcShowDays objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array CcShowDays[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbFirstShow', 'DbLastShow', 'DbStartTime', 'DbEndTime', 'DbDay', 'DbShowId', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFirstShow', 'dbLastShow', 'dbStartTime', 'dbEndTime', 'dbDay', 'dbShowId', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::FIRST_SHOW, self::LAST_SHOW, self::START_TIME, self::END_TIME, self::DAY, self::SHOW_ID, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FIRST_SHOW', 'LAST_SHOW', 'START_TIME', 'END_TIME', 'DAY', 'SHOW_ID', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'first_show', 'last_show', 'start_time', 'end_time', 'day', 'show_id', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbFirstShow' => 1, 'DbLastShow' => 2, 'DbStartTime' => 3, 'DbEndTime' => 4, 'DbDay' => 5, 'DbShowId' => 6, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFirstShow' => 1, 'dbLastShow' => 2, 'dbStartTime' => 3, 'dbEndTime' => 4, 'dbDay' => 5, 'dbShowId' => 6, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::FIRST_SHOW => 1, self::LAST_SHOW => 2, self::START_TIME => 3, self::END_TIME => 4, self::DAY => 5, self::SHOW_ID => 6, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FIRST_SHOW' => 1, 'LAST_SHOW' => 2, 'START_TIME' => 3, 'END_TIME' => 4, 'DAY' => 5, 'SHOW_ID' => 6, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'first_show' => 1, 'last_show' => 2, 'start_time' => 3, 'end_time' => 4, 'day' => 5, 'show_id' => 6, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
);
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return array A list of field names
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
}
return self::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. CcShowDaysPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(CcShowDaysPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(CcShowDaysPeer::ID);
$criteria->addSelectColumn(CcShowDaysPeer::FIRST_SHOW);
$criteria->addSelectColumn(CcShowDaysPeer::LAST_SHOW);
$criteria->addSelectColumn(CcShowDaysPeer::START_TIME);
$criteria->addSelectColumn(CcShowDaysPeer::END_TIME);
$criteria->addSelectColumn(CcShowDaysPeer::DAY);
$criteria->addSelectColumn(CcShowDaysPeer::SHOW_ID);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.FIRST_SHOW');
$criteria->addSelectColumn($alias . '.LAST_SHOW');
$criteria->addSelectColumn($alias . '.START_TIME');
$criteria->addSelectColumn($alias . '.END_TIME');
$criteria->addSelectColumn($alias . '.DAY');
$criteria->addSelectColumn($alias . '.SHOW_ID');
}
}
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CcShowDaysPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcShowDaysPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Method to select one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
* @return CcShowDays
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = CcShowDaysPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return CcShowDaysPeer::populateObjects(CcShowDaysPeer::doSelectStmt($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
*
* Use this method directly if you want to work with an executed statement durirectly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con The connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return PDOStatement The executed PDOStatement object.
* @see BasePeer::doSelect()
*/
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
CcShowDaysPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
}
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param CcShowDays $value A CcShowDays object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(CcShowDays $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getDbId();
} // if key === null
self::$instances[$key] = $obj;
}
}
/**
* Removes an object from the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doDelete
* methods in your stub classes -- you may need to explicitly remove objects
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A CcShowDays object or a primary key value.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof CcShowDays) {
$key = (string) $value->getDbId();
} elseif (is_scalar($value)) {
// assume we've been passed a primary key
$key = (string) $value;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcShowDays object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
}
unset(self::$instances[$key]);
}
} // removeInstanceFromPool()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return CcShowDays Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(self::$instances[$key])) {
return self::$instances[$key];
}
}
return null; // just to be explicit
}
/**
* Clear the instance pool.
*
* @return void
*/
public static function clearInstancePool()
{
self::$instances = array();
}
/**
* Method to invalidate the instance pool of all tables related to cc_show_days
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return string A string version of PK or NULL if the components of primary key in result array are all null.
*/
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return NULL.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = CcShowDaysPeer::getOMClass(false);
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = CcShowDaysPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = CcShowDaysPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, 0, true); // rehydrate
$results[] = $obj;
} else {
$obj = new $cls();
$obj->hydrate($row);
$results[] = $obj;
CcShowDaysPeer::addInstanceToPool($obj, $key);
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (CcShowDays object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = CcShowDaysPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = CcShowDaysPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + CcShowDaysPeer::NUM_COLUMNS;
} else {
$cls = CcShowDaysPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
CcShowDaysPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the number of rows matching criteria, joining the related CcShow table
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows.
*/
public static function doCountJoinCcShow(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CcShowDaysPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcShowDaysPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcShowDaysPeer::SHOW_ID, CcShowPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects a collection of CcShowDays objects pre-filled with their CcShow objects.
* @param Criteria $criteria
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return array Array of CcShowDays objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinCcShow(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
}
CcShowDaysPeer::addSelectColumns($criteria);
$startcol = (CcShowDaysPeer::NUM_COLUMNS - CcShowDaysPeer::NUM_LAZY_LOAD_COLUMNS);
CcShowPeer::addSelectColumns($criteria);
$criteria->addJoin(CcShowDaysPeer::SHOW_ID, CcShowPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcShowDaysPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcShowDaysPeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcShowDaysPeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcShowDaysPeer::addInstanceToPool($obj1, $key1);
} // if $obj1 already loaded
$key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol);
if ($key2 !== null) {
$obj2 = CcShowPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcShowPeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
CcShowPeer::addInstanceToPool($obj2, $key2);
} // if obj2 already loaded
// Add the $obj1 (CcShowDays) to $obj2 (CcShow)
$obj2->addCcShowDays($obj1);
} // if joined row was not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
/**
* Returns the number of rows matching criteria, joining all related tables
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows.
*/
public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CcShowDaysPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcShowDaysPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcShowDaysPeer::SHOW_ID, CcShowPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects a collection of CcShowDays objects pre-filled with all related objects.
*
* @param Criteria $criteria
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return array Array of CcShowDays objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
}
CcShowDaysPeer::addSelectColumns($criteria);
$startcol2 = (CcShowDaysPeer::NUM_COLUMNS - CcShowDaysPeer::NUM_LAZY_LOAD_COLUMNS);
CcShowPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcShowDaysPeer::SHOW_ID, CcShowPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcShowDaysPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcShowDaysPeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcShowDaysPeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcShowDaysPeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded
// Add objects for joined CcShow rows
$key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = CcShowPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcShowPeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
CcShowPeer::addInstanceToPool($obj2, $key2);
} // if obj2 loaded
// Add the $obj1 (CcShowDays) to the collection in $obj2 (CcShow)
$obj2->addCcShowDays($obj1);
} // if joined row not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this peer class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseCcShowDaysPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseCcShowDaysPeer::TABLE_NAME))
{
$dbMap->addTableObject(new CcShowDaysTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
* If $withPrefix is true, the returned path
* uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @param boolean $withPrefix Whether or not to return the path with the class name
* @return string path.to.ClassName
*/
public static function getOMClass($withPrefix = true)
{
return $withPrefix ? CcShowDaysPeer::CLASS_DEFAULT : CcShowDaysPeer::OM_CLASS;
}
/**
* Method perform an INSERT on the database, given a CcShowDays or Criteria object.
*
* @param mixed $values Criteria or CcShowDays object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from CcShowDays object
}
if ($criteria->containsKey(CcShowDaysPeer::ID) && $criteria->keyContainsValue(CcShowDaysPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowDaysPeer::ID.')');
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch(PropelException $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
/**
* Method perform an UPDATE on the database, given a CcShowDays or Criteria object.
*
* @param mixed $values Criteria or CcShowDays object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(CcShowDaysPeer::ID);
$value = $criteria->remove(CcShowDaysPeer::ID);
if ($value) {
$selectCriteria->add(CcShowDaysPeer::ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(CcShowDaysPeer::TABLE_NAME);
}
} else { // $values is CcShowDays object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the cc_show_days table.
*
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll($con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDeleteAll(CcShowDaysPeer::TABLE_NAME, $con, CcShowDaysPeer::DATABASE_NAME);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
CcShowDaysPeer::clearInstancePool();
CcShowDaysPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a CcShowDays or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or CcShowDays object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
CcShowDaysPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof CcShowDays) { // it's a model object
// invalidate the cache for this single object
CcShowDaysPeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(CcShowDaysPeer::ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
CcShowDaysPeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
CcShowDaysPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given CcShowDays object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param CcShowDays $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(CcShowDays $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(CcShowDaysPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(CcShowDaysPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(CcShowDaysPeer::DATABASE_NAME, CcShowDaysPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return CcShowDays
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = CcShowDaysPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(CcShowDaysPeer::DATABASE_NAME);
$criteria->add(CcShowDaysPeer::ID, $pk);
$v = CcShowDaysPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(CcShowDaysPeer::DATABASE_NAME);
$criteria->add(CcShowDaysPeer::ID, $pks, Criteria::IN);
$objs = CcShowDaysPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseCcShowDaysPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseCcShowDaysPeer::buildTableMap();

View file

@ -0,0 +1,443 @@
<?php
/**
* Base class that represents a query for the 'cc_show_days' table.
*
*
*
* @method CcShowDaysQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcShowDaysQuery orderByDbFirstShow($order = Criteria::ASC) Order by the first_show column
* @method CcShowDaysQuery orderByDbLastShow($order = Criteria::ASC) Order by the last_show column
* @method CcShowDaysQuery orderByDbStartTime($order = Criteria::ASC) Order by the start_time column
* @method CcShowDaysQuery orderByDbEndTime($order = Criteria::ASC) Order by the end_time column
* @method CcShowDaysQuery orderByDbDay($order = Criteria::ASC) Order by the day column
* @method CcShowDaysQuery orderByDbShowId($order = Criteria::ASC) Order by the show_id column
*
* @method CcShowDaysQuery groupByDbId() Group by the id column
* @method CcShowDaysQuery groupByDbFirstShow() Group by the first_show column
* @method CcShowDaysQuery groupByDbLastShow() Group by the last_show column
* @method CcShowDaysQuery groupByDbStartTime() Group by the start_time column
* @method CcShowDaysQuery groupByDbEndTime() Group by the end_time column
* @method CcShowDaysQuery groupByDbDay() Group by the day column
* @method CcShowDaysQuery groupByDbShowId() Group by the show_id column
*
* @method CcShowDaysQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcShowDaysQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcShowDaysQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcShowDaysQuery leftJoinCcShow($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShow relation
* @method CcShowDaysQuery rightJoinCcShow($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShow relation
* @method CcShowDaysQuery innerJoinCcShow($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShow relation
*
* @method CcShowDays findOne(PropelPDO $con = null) Return the first CcShowDays matching the query
* @method CcShowDays findOneOrCreate(PropelPDO $con = null) Return the first CcShowDays matching the query, or a new CcShowDays object populated from the query conditions when no match is found
*
* @method CcShowDays findOneByDbId(int $id) Return the first CcShowDays filtered by the id column
* @method CcShowDays findOneByDbFirstShow(string $first_show) Return the first CcShowDays filtered by the first_show column
* @method CcShowDays findOneByDbLastShow(string $last_show) Return the first CcShowDays filtered by the last_show column
* @method CcShowDays findOneByDbStartTime(string $start_time) Return the first CcShowDays filtered by the start_time column
* @method CcShowDays findOneByDbEndTime(string $end_time) Return the first CcShowDays filtered by the end_time column
* @method CcShowDays findOneByDbDay(int $day) Return the first CcShowDays filtered by the day column
* @method CcShowDays findOneByDbShowId(int $show_id) Return the first CcShowDays filtered by the show_id column
*
* @method array findByDbId(int $id) Return CcShowDays objects filtered by the id column
* @method array findByDbFirstShow(string $first_show) Return CcShowDays objects filtered by the first_show column
* @method array findByDbLastShow(string $last_show) Return CcShowDays objects filtered by the last_show column
* @method array findByDbStartTime(string $start_time) Return CcShowDays objects filtered by the start_time column
* @method array findByDbEndTime(string $end_time) Return CcShowDays objects filtered by the end_time column
* @method array findByDbDay(int $day) Return CcShowDays objects filtered by the day column
* @method array findByDbShowId(int $show_id) Return CcShowDays objects filtered by the show_id column
*
* @package propel.generator.campcaster.om
*/
abstract class BaseCcShowDaysQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcShowDaysQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'campcaster', $modelName = 'CcShowDays', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CcShowDaysQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return CcShowDaysQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CcShowDaysQuery) {
return $criteria;
}
$query = new CcShowDaysQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key
* Use instance pooling to avoid a database query if the object exists
* <code>
* $obj = $c->findPk(12, $con);
* </code>
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con an optional connection object
*
* @return CcShowDays|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcShowDaysPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
return $obj;
} else {
// the object has not been requested yet, or the formatter is not an object formatter
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
->filterByPrimaryKeys($keys)
->find($con);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return CcShowDaysQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcShowDaysPeer::ID, $key, Criteria::EQUAL);
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return CcShowDaysQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcShowDaysPeer::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* @param int|array $dbId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowDaysQuery The current query, for fluid interface
*/
public function filterByDbId($dbId = null, $comparison = null)
{
if (is_array($dbId) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(CcShowDaysPeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the first_show column
*
* @param string|array $dbFirstShow The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowDaysQuery The current query, for fluid interface
*/
public function filterByDbFirstShow($dbFirstShow = null, $comparison = null)
{
if (is_array($dbFirstShow)) {
$useMinMax = false;
if (isset($dbFirstShow['min'])) {
$this->addUsingAlias(CcShowDaysPeer::FIRST_SHOW, $dbFirstShow['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbFirstShow['max'])) {
$this->addUsingAlias(CcShowDaysPeer::FIRST_SHOW, $dbFirstShow['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcShowDaysPeer::FIRST_SHOW, $dbFirstShow, $comparison);
}
/**
* Filter the query on the last_show column
*
* @param string|array $dbLastShow The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowDaysQuery The current query, for fluid interface
*/
public function filterByDbLastShow($dbLastShow = null, $comparison = null)
{
if (is_array($dbLastShow)) {
$useMinMax = false;
if (isset($dbLastShow['min'])) {
$this->addUsingAlias(CcShowDaysPeer::LAST_SHOW, $dbLastShow['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbLastShow['max'])) {
$this->addUsingAlias(CcShowDaysPeer::LAST_SHOW, $dbLastShow['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcShowDaysPeer::LAST_SHOW, $dbLastShow, $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)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowDaysQuery The current query, for fluid interface
*/
public function filterByDbStartTime($dbStartTime = null, $comparison = null)
{
if (is_array($dbStartTime)) {
$useMinMax = false;
if (isset($dbStartTime['min'])) {
$this->addUsingAlias(CcShowDaysPeer::START_TIME, $dbStartTime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbStartTime['max'])) {
$this->addUsingAlias(CcShowDaysPeer::START_TIME, $dbStartTime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcShowDaysPeer::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)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowDaysQuery The current query, for fluid interface
*/
public function filterByDbEndTime($dbEndTime = null, $comparison = null)
{
if (is_array($dbEndTime)) {
$useMinMax = false;
if (isset($dbEndTime['min'])) {
$this->addUsingAlias(CcShowDaysPeer::END_TIME, $dbEndTime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbEndTime['max'])) {
$this->addUsingAlias(CcShowDaysPeer::END_TIME, $dbEndTime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcShowDaysPeer::END_TIME, $dbEndTime, $comparison);
}
/**
* Filter the query on the day column
*
* @param int|array $dbDay The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowDaysQuery The current query, for fluid interface
*/
public function filterByDbDay($dbDay = null, $comparison = null)
{
if (is_array($dbDay)) {
$useMinMax = false;
if (isset($dbDay['min'])) {
$this->addUsingAlias(CcShowDaysPeer::DAY, $dbDay['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbDay['max'])) {
$this->addUsingAlias(CcShowDaysPeer::DAY, $dbDay['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcShowDaysPeer::DAY, $dbDay, $comparison);
}
/**
* Filter the query on the show_id column
*
* @param int|array $dbShowId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowDaysQuery The current query, for fluid interface
*/
public function filterByDbShowId($dbShowId = null, $comparison = null)
{
if (is_array($dbShowId)) {
$useMinMax = false;
if (isset($dbShowId['min'])) {
$this->addUsingAlias(CcShowDaysPeer::SHOW_ID, $dbShowId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbShowId['max'])) {
$this->addUsingAlias(CcShowDaysPeer::SHOW_ID, $dbShowId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcShowDaysPeer::SHOW_ID, $dbShowId, $comparison);
}
/**
* Filter the query by a related CcShow object
*
* @param CcShow $ccShow the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowDaysQuery The current query, for fluid interface
*/
public function filterByCcShow($ccShow, $comparison = null)
{
return $this
->addUsingAlias(CcShowDaysPeer::SHOW_ID, $ccShow->getDbId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcShow relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowDaysQuery The current query, for fluid interface
*/
public function joinCcShow($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcShow');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CcShow');
}
return $this;
}
/**
* Use the CcShow relation CcShow object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowQuery A secondary query class using the current class as primary query
*/
public function useCcShowQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcShow($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcShow', 'CcShowQuery');
}
/**
* Exclude object from result
*
* @param CcShowDays $ccShowDays Object to remove from the list of results
*
* @return CcShowDaysQuery The current query, for fluid interface
*/
public function prune($ccShowDays = null)
{
if ($ccShowDays) {
$this->addUsingAlias(CcShowDaysPeer::ID, $ccShowDays->getDbId(), Criteria::NOT_EQUAL);
}
return $this;
}
} // BaseCcShowDaysQuery

View file

@ -0,0 +1,936 @@
<?php
/**
* Base class that represents a row from the 'cc_show_hosts' table.
*
*
*
* @package propel.generator.campcaster.om
*/
abstract class BaseCcShowHosts extends BaseObject implements Persistent
{
/**
* Peer class name
*/
const PEER = 'CcShowHostsPeer';
/**
* The Peer class.
* Instance provides a convenient way of calling static methods on a class
* that calling code may not be able to identify.
* @var CcShowHostsPeer
*/
protected static $peer;
/**
* The value for the id field.
* @var int
*/
protected $id;
/**
* The value for the show_id field.
* @var int
*/
protected $show_id;
/**
* The value for the subjs_id field.
* @var int
*/
protected $subjs_id;
/**
* @var CcShow
*/
protected $aCcShow;
/**
* @var CcSubjs
*/
protected $aCcSubjs;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInSave = false;
/**
* Flag to prevent endless validation loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInValidation = false;
/**
* Get the [id] column value.
*
* @return int
*/
public function getDbId()
{
return $this->id;
}
/**
* Get the [show_id] column value.
*
* @return int
*/
public function getDbShow()
{
return $this->show_id;
}
/**
* Get the [subjs_id] column value.
*
* @return int
*/
public function getDbHost()
{
return $this->subjs_id;
}
/**
* Set the value of [id] column.
*
* @param int $v new value
* @return CcShowHosts The current object (for fluent API support)
*/
public function setDbId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->id !== $v) {
$this->id = $v;
$this->modifiedColumns[] = CcShowHostsPeer::ID;
}
return $this;
} // setDbId()
/**
* Set the value of [show_id] column.
*
* @param int $v new value
* @return CcShowHosts The current object (for fluent API support)
*/
public function setDbShow($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->show_id !== $v) {
$this->show_id = $v;
$this->modifiedColumns[] = CcShowHostsPeer::SHOW_ID;
}
if ($this->aCcShow !== null && $this->aCcShow->getDbId() !== $v) {
$this->aCcShow = null;
}
return $this;
} // setDbShow()
/**
* Set the value of [subjs_id] column.
*
* @param int $v new value
* @return CcShowHosts The current object (for fluent API support)
*/
public function setDbHost($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->subjs_id !== $v) {
$this->subjs_id = $v;
$this->modifiedColumns[] = CcShowHostsPeer::SUBJS_ID;
}
if ($this->aCcSubjs !== null && $this->aCcSubjs->getId() !== $v) {
$this->aCcSubjs = null;
}
return $this;
} // setDbHost()
/**
* Indicates whether the columns in this object are only set to default values.
*
* This method can be used in conjunction with isModified() to indicate whether an object is both
* modified _and_ has some values set which are non-default.
*
* @return boolean Whether the columns in this object are only been set with default values.
*/
public function hasOnlyDefaultValues()
{
// otherwise, everything was equal, so return TRUE
return true;
} // hasOnlyDefaultValues()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
* An offset (0-based "start column") is specified so that objects can be hydrated
* with a subset of the columns in the resultset rows. This is needed, for example,
* for results of JOIN queries where the resultset row includes columns from two or
* more tables.
*
* @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
* @param int $startcol 0-based offset column which indicates which restultset column to start with.
* @param boolean $rehydrate Whether this object is being re-hydrated from the database.
* @return int next starting column
* @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
*/
public function hydrate($row, $startcol = 0, $rehydrate = false)
{
try {
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->show_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
$this->subjs_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
$this->resetModified();
$this->setNew(false);
if ($rehydrate) {
$this->ensureConsistency();
}
return $startcol + 3; // 3 = CcShowHostsPeer::NUM_COLUMNS - CcShowHostsPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcShowHosts object", $e);
}
}
/**
* Checks and repairs the internal consistency of the object.
*
* This method is executed after an already-instantiated object is re-hydrated
* from the database. It exists to check any foreign keys to make sure that
* the objects related to the current object are correct based on foreign key.
*
* You can override this method in the stub class, but you should always invoke
* the base method from the overridden method (i.e. parent::ensureConsistency()),
* in case your model changes.
*
* @throws PropelException
*/
public function ensureConsistency()
{
if ($this->aCcShow !== null && $this->show_id !== $this->aCcShow->getDbId()) {
$this->aCcShow = null;
}
if ($this->aCcSubjs !== null && $this->subjs_id !== $this->aCcSubjs->getId()) {
$this->aCcSubjs = null;
}
} // ensureConsistency
/**
* Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
*
* This will only work if the object has been saved and has a valid primary key set.
*
* @param boolean $deep (optional) Whether to also de-associated any related objects.
* @param PropelPDO $con (optional) The PropelPDO connection to use.
* @return void
* @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
*/
public function reload($deep = false, PropelPDO $con = null)
{
if ($this->isDeleted()) {
throw new PropelException("Cannot reload a deleted object.");
}
if ($this->isNew()) {
throw new PropelException("Cannot reload an unsaved object.");
}
if ($con === null) {
$con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// We don't need to alter the object instance pool; we're just modifying this instance
// already in the pool.
$stmt = CcShowHostsPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
$row = $stmt->fetch(PDO::FETCH_NUM);
$stmt->closeCursor();
if (!$row) {
throw new PropelException('Cannot find matching row in the database to reload object values.');
}
$this->hydrate($row, 0, true); // rehydrate
if ($deep) { // also de-associate any related objects?
$this->aCcShow = null;
$this->aCcSubjs = null;
} // if (deep)
}
/**
* Removes this object from datastore and sets delete attribute.
*
* @param PropelPDO $con
* @return void
* @throws PropelException
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
public function delete(PropelPDO $con = null)
{
if ($this->isDeleted()) {
throw new PropelException("This object has already been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$con->beginTransaction();
try {
$ret = $this->preDelete($con);
if ($ret) {
CcShowHostsQuery::create()
->filterByPrimaryKey($this->getPrimaryKey())
->delete($con);
$this->postDelete($con);
$con->commit();
$this->setDeleted(true);
} else {
$con->commit();
}
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Persists this object to the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All modified related objects will also be persisted in the doSave()
* method. This method wraps all precipitate database operations in a
* single transaction.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see doSave()
*/
public function save(PropelPDO $con = null)
{
if ($this->isDeleted()) {
throw new PropelException("You cannot save an object that has been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$con->beginTransaction();
$isInsert = $this->isNew();
try {
$ret = $this->preSave($con);
if ($isInsert) {
$ret = $ret && $this->preInsert($con);
} else {
$ret = $ret && $this->preUpdate($con);
}
if ($ret) {
$affectedRows = $this->doSave($con);
if ($isInsert) {
$this->postInsert($con);
} else {
$this->postUpdate($con);
}
$this->postSave($con);
CcShowHostsPeer::addInstanceToPool($this);
} else {
$affectedRows = 0;
}
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aCcShow !== null) {
if ($this->aCcShow->isModified() || $this->aCcShow->isNew()) {
$affectedRows += $this->aCcShow->save($con);
}
$this->setCcShow($this->aCcShow);
}
if ($this->aCcSubjs !== null) {
if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) {
$affectedRows += $this->aCcSubjs->save($con);
}
$this->setCcSubjs($this->aCcSubjs);
}
if ($this->isNew() ) {
$this->modifiedColumns[] = CcShowHostsPeer::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(CcShowHostsPeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowHostsPeer::ID.')');
}
$pk = BasePeer::doInsert($criteria, $con);
$affectedRows += 1;
$this->setDbId($pk); //[IMV] update autoincrement primary key
$this->setNew(false);
} else {
$affectedRows += CcShowHostsPeer::doUpdate($this, $con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
*/
protected $validationFailures = array();
/**
* Gets any ValidationFailed objects that resulted from last call to validate().
*
*
* @return array ValidationFailed[]
* @see validate()
*/
public function getValidationFailures()
{
return $this->validationFailures;
}
/**
* Validates the objects modified field values and all objects related to this table.
*
* If $columns is either a column name or an array of column names
* only those columns are validated.
*
* @param mixed $columns Column name or an array of column names.
* @return boolean Whether all columns pass validation.
* @see doValidate()
* @see getValidationFailures()
*/
public function validate($columns = null)
{
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
}
/**
* This function performs the validation work for complex object models.
*
* In addition to checking the current object, all related objects will
* also be validated. If all pass then <code>true</code> is returned; otherwise
* an aggreagated array of ValidationFailed objects will be returned.
*
* @param array $columns Array of column names to validate.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
*/
protected function doValidate($columns = null)
{
if (!$this->alreadyInValidation) {
$this->alreadyInValidation = true;
$retval = null;
$failureMap = array();
// We call the validate method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aCcShow !== null) {
if (!$this->aCcShow->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aCcShow->getValidationFailures());
}
}
if ($this->aCcSubjs !== null) {
if (!$this->aCcSubjs->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures());
}
}
if (($retval = CcShowHostsPeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval);
}
$this->alreadyInValidation = false;
}
return (!empty($failureMap) ? $failureMap : true);
}
/**
* Retrieves a field from the object by name passed in as a string.
*
* @param string $name name
* @param string $type The type of fieldname the $name is of:
* one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcShowHostsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
$field = $this->getByPosition($pos);
return $field;
}
/**
* Retrieves a field from the object by Position as specified in the xml schema.
* Zero-based.
*
* @param int $pos position in xml schema
* @return mixed Value of field at $pos
*/
public function getByPosition($pos)
{
switch($pos) {
case 0:
return $this->getDbId();
break;
case 1:
return $this->getDbShow();
break;
case 2:
return $this->getDbHost();
break;
default:
return null;
break;
} // switch()
}
/**
* Exports the object as an array.
*
* You can specify the key type of the array by passing one of the class
* type constants.
*
* @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME.
* @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
* @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
*
* @return array an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false)
{
$keys = CcShowHostsPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getDbId(),
$keys[1] => $this->getDbShow(),
$keys[2] => $this->getDbHost(),
);
if ($includeForeignObjects) {
if (null !== $this->aCcShow) {
$result['CcShow'] = $this->aCcShow->toArray($keyType, $includeLazyLoadColumns, true);
}
if (null !== $this->aCcSubjs) {
$result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true);
}
}
return $result;
}
/**
* Sets a field from the object by name passed in as a string.
*
* @param string $name peer name
* @param mixed $value field value
* @param string $type The type of fieldname the $name is of:
* one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = CcShowHostsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
}
/**
* Sets a field from the object by Position as specified in the xml schema.
* Zero-based.
*
* @param int $pos position in xml schema
* @param mixed $value field value
* @return void
*/
public function setByPosition($pos, $value)
{
switch($pos) {
case 0:
$this->setDbId($value);
break;
case 1:
$this->setDbShow($value);
break;
case 2:
$this->setDbHost($value);
break;
} // switch()
}
/**
* Populates the object using an array.
*
* This is particularly useful when populating an object from one of the
* request arrays (e.g. $_POST). This method goes through the column
* names, checking to see whether a matching key exists in populated
* array. If so the setByName() method is called for that column.
*
* You can specify the key type of the array by additionally passing one
* of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* The default key type is the column's phpname (e.g. 'AuthorId')
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
* @return void
*/
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = CcShowHostsPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setDbShow($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDbHost($arr[$keys[2]]);
}
/**
* Build a Criteria object containing the values of all modified columns in this object.
*
* @return Criteria The Criteria object containing all modified values.
*/
public function buildCriteria()
{
$criteria = new Criteria(CcShowHostsPeer::DATABASE_NAME);
if ($this->isColumnModified(CcShowHostsPeer::ID)) $criteria->add(CcShowHostsPeer::ID, $this->id);
if ($this->isColumnModified(CcShowHostsPeer::SHOW_ID)) $criteria->add(CcShowHostsPeer::SHOW_ID, $this->show_id);
if ($this->isColumnModified(CcShowHostsPeer::SUBJS_ID)) $criteria->add(CcShowHostsPeer::SUBJS_ID, $this->subjs_id);
return $criteria;
}
/**
* Builds a Criteria object containing the primary key for this object.
*
* Unlike buildCriteria() this method includes the primary key values regardless
* of whether or not they have been modified.
*
* @return Criteria The Criteria object containing value(s) for primary key(s).
*/
public function buildPkeyCriteria()
{
$criteria = new Criteria(CcShowHostsPeer::DATABASE_NAME);
$criteria->add(CcShowHostsPeer::ID, $this->id);
return $criteria;
}
/**
* Returns the primary key for this object (row).
* @return int
*/
public function getPrimaryKey()
{
return $this->getDbId();
}
/**
* Generic method to set the primary key (id column).
*
* @param int $key Primary key.
* @return void
*/
public function setPrimaryKey($key)
{
$this->setDbId($key);
}
/**
* Returns true if the primary key for this object is null.
* @return boolean
*/
public function isPrimaryKeyNull()
{
return null === $this->getDbId();
}
/**
* Sets contents of passed object to values from current object.
*
* If desired, this method can also make copies of all associated (fkey referrers)
* objects.
*
* @param object $copyObj An object of CcShowHosts (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
{
$copyObj->setDbShow($this->show_id);
$copyObj->setDbHost($this->subjs_id);
$copyObj->setNew(true);
$copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
}
/**
* Makes a copy of this object that will be inserted as a new row in table when saved.
* It creates a new object filling in the simple attributes, but skipping any primary
* keys that are defined for the table.
*
* If desired, this method can also make copies of all associated (fkey referrers)
* objects.
*
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @return CcShowHosts Clone of current object.
* @throws PropelException
*/
public function copy($deepCopy = false)
{
// we use get_class(), because this might be a subclass
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
/**
* Returns a peer instance associated with this om.
*
* Since Peer classes are not to have any instance attributes, this method returns the
* same instance for all member of this class. The method could therefore
* be static, but this would prevent one from overriding the behavior.
*
* @return CcShowHostsPeer
*/
public function getPeer()
{
if (self::$peer === null) {
self::$peer = new CcShowHostsPeer();
}
return self::$peer;
}
/**
* Declares an association between this object and a CcShow object.
*
* @param CcShow $v
* @return CcShowHosts The current object (for fluent API support)
* @throws PropelException
*/
public function setCcShow(CcShow $v = null)
{
if ($v === null) {
$this->setDbShow(NULL);
} else {
$this->setDbShow($v->getDbId());
}
$this->aCcShow = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the CcShow object, it will not be re-added.
if ($v !== null) {
$v->addCcShowHosts($this);
}
return $this;
}
/**
* Get the associated CcShow object
*
* @param PropelPDO Optional Connection object.
* @return CcShow The associated CcShow object.
* @throws PropelException
*/
public function getCcShow(PropelPDO $con = null)
{
if ($this->aCcShow === null && ($this->show_id !== null)) {
$this->aCcShow = CcShowQuery::create()->findPk($this->show_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->aCcShow->addCcShowHostss($this);
*/
}
return $this->aCcShow;
}
/**
* Declares an association between this object and a CcSubjs object.
*
* @param CcSubjs $v
* @return CcShowHosts The current object (for fluent API support)
* @throws PropelException
*/
public function setCcSubjs(CcSubjs $v = null)
{
if ($v === null) {
$this->setDbHost(NULL);
} else {
$this->setDbHost($v->getId());
}
$this->aCcSubjs = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the CcSubjs object, it will not be re-added.
if ($v !== null) {
$v->addCcShowHosts($this);
}
return $this;
}
/**
* Get the associated CcSubjs object
*
* @param PropelPDO Optional Connection object.
* @return CcSubjs The associated CcSubjs object.
* @throws PropelException
*/
public function getCcSubjs(PropelPDO $con = null)
{
if ($this->aCcSubjs === null && ($this->subjs_id !== null)) {
$this->aCcSubjs = CcSubjsQuery::create()->findPk($this->subjs_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->aCcSubjs->addCcShowHostss($this);
*/
}
return $this->aCcSubjs;
}
/**
* Clears the current object and sets all attributes to their default values
*/
public function clear()
{
$this->id = null;
$this->show_id = null;
$this->subjs_id = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->clearAllReferences();
$this->resetModified();
$this->setNew(true);
$this->setDeleted(false);
}
/**
* Resets all collections of referencing foreign keys.
*
* This method is a user-space workaround for PHP's inability to garbage collect objects
* with circular references. This is currently necessary when using Propel in certain
* daemon or large-volumne/high-memory operations.
*
* @param boolean $deep Whether to also clear the references on all associated objects.
*/
public function clearAllReferences($deep = false)
{
if ($deep) {
} // if ($deep)
$this->aCcShow = null;
$this->aCcSubjs = null;
}
/**
* Catches calls to virtual methods
*/
public function __call($name, $params)
{
if (preg_match('/get(\w+)/', $name, $matches)) {
$virtualColumn = $matches[1];
if ($this->hasVirtualColumn($virtualColumn)) {
return $this->getVirtualColumn($virtualColumn);
}
// no lcfirst in php<5.3...
$virtualColumn[0] = strtolower($virtualColumn[0]);
if ($this->hasVirtualColumn($virtualColumn)) {
return $this->getVirtualColumn($virtualColumn);
}
}
throw new PropelException('Call to undefined method: ' . $name);
}
} // BaseCcShowHosts

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,371 @@
<?php
/**
* Base class that represents a query for the 'cc_show_hosts' table.
*
*
*
* @method CcShowHostsQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcShowHostsQuery orderByDbShow($order = Criteria::ASC) Order by the show_id column
* @method CcShowHostsQuery orderByDbHost($order = Criteria::ASC) Order by the subjs_id column
*
* @method CcShowHostsQuery groupByDbId() Group by the id column
* @method CcShowHostsQuery groupByDbShow() Group by the show_id column
* @method CcShowHostsQuery groupByDbHost() Group by the subjs_id column
*
* @method CcShowHostsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcShowHostsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcShowHostsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcShowHostsQuery leftJoinCcShow($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShow relation
* @method CcShowHostsQuery rightJoinCcShow($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShow relation
* @method CcShowHostsQuery innerJoinCcShow($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShow relation
*
* @method CcShowHostsQuery leftJoinCcSubjs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjs relation
* @method CcShowHostsQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation
* @method CcShowHostsQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation
*
* @method CcShowHosts findOne(PropelPDO $con = null) Return the first CcShowHosts matching the query
* @method CcShowHosts findOneOrCreate(PropelPDO $con = null) Return the first CcShowHosts matching the query, or a new CcShowHosts object populated from the query conditions when no match is found
*
* @method CcShowHosts findOneByDbId(int $id) Return the first CcShowHosts filtered by the id column
* @method CcShowHosts findOneByDbShow(int $show_id) Return the first CcShowHosts filtered by the show_id column
* @method CcShowHosts findOneByDbHost(int $subjs_id) Return the first CcShowHosts filtered by the subjs_id column
*
* @method array findByDbId(int $id) Return CcShowHosts objects filtered by the id column
* @method array findByDbShow(int $show_id) Return CcShowHosts objects filtered by the show_id column
* @method array findByDbHost(int $subjs_id) Return CcShowHosts objects filtered by the subjs_id column
*
* @package propel.generator.campcaster.om
*/
abstract class BaseCcShowHostsQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseCcShowHostsQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'campcaster', $modelName = 'CcShowHosts', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new CcShowHostsQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return CcShowHostsQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof CcShowHostsQuery) {
return $criteria;
}
$query = new CcShowHostsQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key
* Use instance pooling to avoid a database query if the object exists
* <code>
* $obj = $c->findPk(12, $con);
* </code>
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con an optional connection object
*
* @return CcShowHosts|array|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ((null !== ($obj = CcShowHostsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
// the object is alredy in the instance pool
return $obj;
} else {
// the object has not been requested yet, or the formatter is not an object formatter
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->getSelectStatement($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
$criteria = $this->isKeepQuery() ? clone $this : $this;
return $this
->filterByPrimaryKeys($keys)
->find($con);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return CcShowHostsQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(CcShowHostsPeer::ID, $key, Criteria::EQUAL);
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return CcShowHostsQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(CcShowHostsPeer::ID, $keys, Criteria::IN);
}
/**
* Filter the query on the id column
*
* @param int|array $dbId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowHostsQuery The current query, for fluid interface
*/
public function filterByDbId($dbId = null, $comparison = null)
{
if (is_array($dbId) && null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(CcShowHostsPeer::ID, $dbId, $comparison);
}
/**
* Filter the query on the show_id column
*
* @param int|array $dbShow The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowHostsQuery The current query, for fluid interface
*/
public function filterByDbShow($dbShow = null, $comparison = null)
{
if (is_array($dbShow)) {
$useMinMax = false;
if (isset($dbShow['min'])) {
$this->addUsingAlias(CcShowHostsPeer::SHOW_ID, $dbShow['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbShow['max'])) {
$this->addUsingAlias(CcShowHostsPeer::SHOW_ID, $dbShow['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcShowHostsPeer::SHOW_ID, $dbShow, $comparison);
}
/**
* Filter the query on the subjs_id column
*
* @param int|array $dbHost The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowHostsQuery The current query, for fluid interface
*/
public function filterByDbHost($dbHost = null, $comparison = null)
{
if (is_array($dbHost)) {
$useMinMax = false;
if (isset($dbHost['min'])) {
$this->addUsingAlias(CcShowHostsPeer::SUBJS_ID, $dbHost['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbHost['max'])) {
$this->addUsingAlias(CcShowHostsPeer::SUBJS_ID, $dbHost['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcShowHostsPeer::SUBJS_ID, $dbHost, $comparison);
}
/**
* Filter the query by a related CcShow object
*
* @param CcShow $ccShow the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowHostsQuery The current query, for fluid interface
*/
public function filterByCcShow($ccShow, $comparison = null)
{
return $this
->addUsingAlias(CcShowHostsPeer::SHOW_ID, $ccShow->getDbId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcShow relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowHostsQuery The current query, for fluid interface
*/
public function joinCcShow($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcShow');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CcShow');
}
return $this;
}
/**
* Use the CcShow relation CcShow object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowQuery A secondary query class using the current class as primary query
*/
public function useCcShowQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcShow($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcShow', 'CcShowQuery');
}
/**
* Filter the query by a related CcSubjs object
*
* @param CcSubjs $ccSubjs the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowHostsQuery The current query, for fluid interface
*/
public function filterByCcSubjs($ccSubjs, $comparison = null)
{
return $this
->addUsingAlias(CcShowHostsPeer::SUBJS_ID, $ccSubjs->getId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcSubjs relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowHostsQuery The current query, for fluid interface
*/
public function joinCcSubjs($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcSubjs');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CcSubjs');
}
return $this;
}
/**
* Use the CcSubjs relation CcSubjs object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcSubjsQuery A secondary query class using the current class as primary query
*/
public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcSubjs($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery');
}
/**
* Exclude object from result
*
* @param CcShowHosts $ccShowHosts Object to remove from the list of results
*
* @return CcShowHostsQuery The current query, for fluid interface
*/
public function prune($ccShowHosts = null)
{
if ($ccShowHosts) {
$this->addUsingAlias(CcShowHostsPeer::ID, $ccShowHosts->getDbId(), Criteria::NOT_EQUAL);
}
return $this;
}
} // BaseCcShowHostsQuery

View file

@ -26,7 +26,7 @@ abstract class BaseCcShowPeer {
const TM_CLASS = 'CcShowTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 10;
const NUM_COLUMNS = 4;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@ -37,30 +37,12 @@ abstract class BaseCcShowPeer {
/** the column name for the NAME field */
const NAME = 'cc_show.NAME';
/** the column name for the FIRST_SHOW field */
const FIRST_SHOW = 'cc_show.FIRST_SHOW';
/** the column name for the LAST_SHOW field */
const LAST_SHOW = 'cc_show.LAST_SHOW';
/** the column name for the START_TIME field */
const START_TIME = 'cc_show.START_TIME';
/** the column name for the END_TIME field */
const END_TIME = 'cc_show.END_TIME';
/** the column name for the REPEATS field */
const REPEATS = 'cc_show.REPEATS';
/** the column name for the DAY field */
const DAY = 'cc_show.DAY';
/** the column name for the DESCRIPTION field */
const DESCRIPTION = 'cc_show.DESCRIPTION';
/** the column name for the SHOW_ID field */
const SHOW_ID = 'cc_show.SHOW_ID';
/**
* An identiy map to hold any loaded instances of CcShow objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
@ -77,12 +59,12 @@ abstract class BaseCcShowPeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbFirstShow', 'DbLastShow', 'DbStartTime', 'DbEndTime', 'DbRepeats', 'DbDay', 'DbDescription', 'DbShowId', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbFirstShow', 'dbLastShow', 'dbStartTime', 'dbEndTime', 'dbRepeats', 'dbDay', 'dbDescription', 'dbShowId', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::FIRST_SHOW, self::LAST_SHOW, self::START_TIME, self::END_TIME, self::REPEATS, self::DAY, self::DESCRIPTION, self::SHOW_ID, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'FIRST_SHOW', 'LAST_SHOW', 'START_TIME', 'END_TIME', 'REPEATS', 'DAY', 'DESCRIPTION', 'SHOW_ID', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'first_show', 'last_show', 'start_time', 'end_time', 'repeats', 'day', 'description', 'show_id', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbRepeats', 'DbDescription', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbRepeats', 'dbDescription', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::REPEATS, self::DESCRIPTION, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'REPEATS', 'DESCRIPTION', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'repeats', 'description', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
@ -92,12 +74,12 @@ abstract class BaseCcShowPeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbFirstShow' => 2, 'DbLastShow' => 3, 'DbStartTime' => 4, 'DbEndTime' => 5, 'DbRepeats' => 6, 'DbDay' => 7, 'DbDescription' => 8, 'DbShowId' => 9, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbFirstShow' => 2, 'dbLastShow' => 3, 'dbStartTime' => 4, 'dbEndTime' => 5, 'dbRepeats' => 6, 'dbDay' => 7, 'dbDescription' => 8, 'dbShowId' => 9, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::FIRST_SHOW => 2, self::LAST_SHOW => 3, self::START_TIME => 4, self::END_TIME => 5, self::REPEATS => 6, self::DAY => 7, self::DESCRIPTION => 8, self::SHOW_ID => 9, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'FIRST_SHOW' => 2, 'LAST_SHOW' => 3, 'START_TIME' => 4, 'END_TIME' => 5, 'REPEATS' => 6, 'DAY' => 7, 'DESCRIPTION' => 8, 'SHOW_ID' => 9, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'first_show' => 2, 'last_show' => 3, 'start_time' => 4, 'end_time' => 5, 'repeats' => 6, 'day' => 7, 'description' => 8, 'show_id' => 9, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbRepeats' => 2, 'DbDescription' => 3, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbRepeats' => 2, 'dbDescription' => 3, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::REPEATS => 2, self::DESCRIPTION => 3, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'REPEATS' => 2, 'DESCRIPTION' => 3, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'repeats' => 2, 'description' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
@ -171,25 +153,13 @@ abstract class BaseCcShowPeer {
if (null === $alias) {
$criteria->addSelectColumn(CcShowPeer::ID);
$criteria->addSelectColumn(CcShowPeer::NAME);
$criteria->addSelectColumn(CcShowPeer::FIRST_SHOW);
$criteria->addSelectColumn(CcShowPeer::LAST_SHOW);
$criteria->addSelectColumn(CcShowPeer::START_TIME);
$criteria->addSelectColumn(CcShowPeer::END_TIME);
$criteria->addSelectColumn(CcShowPeer::REPEATS);
$criteria->addSelectColumn(CcShowPeer::DAY);
$criteria->addSelectColumn(CcShowPeer::DESCRIPTION);
$criteria->addSelectColumn(CcShowPeer::SHOW_ID);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.NAME');
$criteria->addSelectColumn($alias . '.FIRST_SHOW');
$criteria->addSelectColumn($alias . '.LAST_SHOW');
$criteria->addSelectColumn($alias . '.START_TIME');
$criteria->addSelectColumn($alias . '.END_TIME');
$criteria->addSelectColumn($alias . '.REPEATS');
$criteria->addSelectColumn($alias . '.DAY');
$criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.SHOW_ID');
}
}
@ -383,6 +353,12 @@ abstract class BaseCcShowPeer {
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in CcShowDaysPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcShowDaysPeer::clearInstancePool();
// Invalidate objects in CcShowHostsPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcShowHostsPeer::clearInstancePool();
}
/**

View file

@ -8,54 +8,38 @@
*
* @method CcShowQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcShowQuery orderByDbName($order = Criteria::ASC) Order by the name column
* @method CcShowQuery orderByDbFirstShow($order = Criteria::ASC) Order by the first_show column
* @method CcShowQuery orderByDbLastShow($order = Criteria::ASC) Order by the last_show column
* @method CcShowQuery orderByDbStartTime($order = Criteria::ASC) Order by the start_time column
* @method CcShowQuery orderByDbEndTime($order = Criteria::ASC) Order by the end_time column
* @method CcShowQuery orderByDbRepeats($order = Criteria::ASC) Order by the repeats column
* @method CcShowQuery orderByDbDay($order = Criteria::ASC) Order by the day column
* @method CcShowQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
* @method CcShowQuery orderByDbShowId($order = Criteria::ASC) Order by the show_id column
*
* @method CcShowQuery groupByDbId() Group by the id column
* @method CcShowQuery groupByDbName() Group by the name column
* @method CcShowQuery groupByDbFirstShow() Group by the first_show column
* @method CcShowQuery groupByDbLastShow() Group by the last_show column
* @method CcShowQuery groupByDbStartTime() Group by the start_time column
* @method CcShowQuery groupByDbEndTime() Group by the end_time column
* @method CcShowQuery groupByDbRepeats() Group by the repeats column
* @method CcShowQuery groupByDbDay() Group by the day column
* @method CcShowQuery groupByDbDescription() Group by the description column
* @method CcShowQuery groupByDbShowId() Group by the show_id column
*
* @method CcShowQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcShowQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcShowQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcShowQuery leftJoinCcShowDays($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowDays relation
* @method CcShowQuery rightJoinCcShowDays($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowDays relation
* @method CcShowQuery innerJoinCcShowDays($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowDays relation
*
* @method CcShowQuery leftJoinCcShowHosts($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowHosts relation
* @method CcShowQuery rightJoinCcShowHosts($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowHosts relation
* @method CcShowQuery innerJoinCcShowHosts($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowHosts relation
*
* @method CcShow findOne(PropelPDO $con = null) Return the first CcShow matching the query
* @method CcShow findOneOrCreate(PropelPDO $con = null) Return the first CcShow matching the query, or a new CcShow object populated from the query conditions when no match is found
*
* @method CcShow findOneByDbId(int $id) Return the first CcShow filtered by the id column
* @method CcShow findOneByDbName(string $name) Return the first CcShow filtered by the name column
* @method CcShow findOneByDbFirstShow(string $first_show) Return the first CcShow filtered by the first_show column
* @method CcShow findOneByDbLastShow(string $last_show) Return the first CcShow filtered by the last_show column
* @method CcShow findOneByDbStartTime(string $start_time) Return the first CcShow filtered by the start_time column
* @method CcShow findOneByDbEndTime(string $end_time) Return the first CcShow filtered by the end_time column
* @method CcShow findOneByDbRepeats(int $repeats) Return the first CcShow filtered by the repeats column
* @method CcShow findOneByDbDay(int $day) Return the first CcShow filtered by the day column
* @method CcShow findOneByDbDescription(string $description) Return the first CcShow filtered by the description column
* @method CcShow findOneByDbShowId(int $show_id) Return the first CcShow filtered by the show_id column
*
* @method array findByDbId(int $id) Return CcShow objects filtered by the id column
* @method array findByDbName(string $name) Return CcShow objects filtered by the name column
* @method array findByDbFirstShow(string $first_show) Return CcShow objects filtered by the first_show column
* @method array findByDbLastShow(string $last_show) Return CcShow objects filtered by the last_show column
* @method array findByDbStartTime(string $start_time) Return CcShow objects filtered by the start_time column
* @method array findByDbEndTime(string $end_time) Return CcShow objects filtered by the end_time column
* @method array findByDbRepeats(int $repeats) Return CcShow objects filtered by the repeats column
* @method array findByDbDay(int $day) Return CcShow objects filtered by the day column
* @method array findByDbDescription(string $description) Return CcShow objects filtered by the description column
* @method array findByDbShowId(int $show_id) Return CcShow objects filtered by the show_id column
*
* @package propel.generator.campcaster.om
*/
@ -204,130 +188,6 @@ abstract class BaseCcShowQuery extends ModelCriteria
return $this->addUsingAlias(CcShowPeer::NAME, $dbName, $comparison);
}
/**
* Filter the query on the first_show column
*
* @param string|array $dbFirstShow The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowQuery The current query, for fluid interface
*/
public function filterByDbFirstShow($dbFirstShow = null, $comparison = null)
{
if (is_array($dbFirstShow)) {
$useMinMax = false;
if (isset($dbFirstShow['min'])) {
$this->addUsingAlias(CcShowPeer::FIRST_SHOW, $dbFirstShow['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbFirstShow['max'])) {
$this->addUsingAlias(CcShowPeer::FIRST_SHOW, $dbFirstShow['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcShowPeer::FIRST_SHOW, $dbFirstShow, $comparison);
}
/**
* Filter the query on the last_show column
*
* @param string|array $dbLastShow The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowQuery The current query, for fluid interface
*/
public function filterByDbLastShow($dbLastShow = null, $comparison = null)
{
if (is_array($dbLastShow)) {
$useMinMax = false;
if (isset($dbLastShow['min'])) {
$this->addUsingAlias(CcShowPeer::LAST_SHOW, $dbLastShow['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbLastShow['max'])) {
$this->addUsingAlias(CcShowPeer::LAST_SHOW, $dbLastShow['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcShowPeer::LAST_SHOW, $dbLastShow, $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)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowQuery The current query, for fluid interface
*/
public function filterByDbStartTime($dbStartTime = null, $comparison = null)
{
if (is_array($dbStartTime)) {
$useMinMax = false;
if (isset($dbStartTime['min'])) {
$this->addUsingAlias(CcShowPeer::START_TIME, $dbStartTime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbStartTime['max'])) {
$this->addUsingAlias(CcShowPeer::START_TIME, $dbStartTime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcShowPeer::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)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowQuery The current query, for fluid interface
*/
public function filterByDbEndTime($dbEndTime = null, $comparison = null)
{
if (is_array($dbEndTime)) {
$useMinMax = false;
if (isset($dbEndTime['min'])) {
$this->addUsingAlias(CcShowPeer::END_TIME, $dbEndTime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbEndTime['max'])) {
$this->addUsingAlias(CcShowPeer::END_TIME, $dbEndTime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcShowPeer::END_TIME, $dbEndTime, $comparison);
}
/**
* Filter the query on the repeats column
*
@ -359,37 +219,6 @@ abstract class BaseCcShowQuery extends ModelCriteria
return $this->addUsingAlias(CcShowPeer::REPEATS, $dbRepeats, $comparison);
}
/**
* Filter the query on the day column
*
* @param int|array $dbDay The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowQuery The current query, for fluid interface
*/
public function filterByDbDay($dbDay = null, $comparison = null)
{
if (is_array($dbDay)) {
$useMinMax = false;
if (isset($dbDay['min'])) {
$this->addUsingAlias(CcShowPeer::DAY, $dbDay['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbDay['max'])) {
$this->addUsingAlias(CcShowPeer::DAY, $dbDay['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcShowPeer::DAY, $dbDay, $comparison);
}
/**
* Filter the query on the description column
*
@ -413,34 +242,131 @@ abstract class BaseCcShowQuery extends ModelCriteria
}
/**
* Filter the query on the show_id column
* Filter the query by a related CcShowDays object
*
* @param int|array $dbShowId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param CcShowDays $ccShowDays the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowQuery The current query, for fluid interface
*/
public function filterByDbShowId($dbShowId = null, $comparison = null)
public function filterByCcShowDays($ccShowDays, $comparison = null)
{
if (is_array($dbShowId)) {
$useMinMax = false;
if (isset($dbShowId['min'])) {
$this->addUsingAlias(CcShowPeer::SHOW_ID, $dbShowId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbShowId['max'])) {
$this->addUsingAlias(CcShowPeer::SHOW_ID, $dbShowId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CcShowPeer::ID, $ccShowDays->getDbShowId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcShowDays relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowQuery The current query, for fluid interface
*/
public function joinCcShowDays($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcShowDays');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
return $this->addUsingAlias(CcShowPeer::SHOW_ID, $dbShowId, $comparison);
// add the ModelJoin to the current object
if($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CcShowDays');
}
return $this;
}
/**
* Use the CcShowDays relation CcShowDays object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowDaysQuery A secondary query class using the current class as primary query
*/
public function useCcShowDaysQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcShowDays($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcShowDays', 'CcShowDaysQuery');
}
/**
* Filter the query by a related CcShowHosts object
*
* @param CcShowHosts $ccShowHosts the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowQuery The current query, for fluid interface
*/
public function filterByCcShowHosts($ccShowHosts, $comparison = null)
{
return $this
->addUsingAlias(CcShowPeer::ID, $ccShowHosts->getDbShow(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcShowHosts relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowQuery The current query, for fluid interface
*/
public function joinCcShowHosts($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcShowHosts');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CcShowHosts');
}
return $this;
}
/**
* Use the CcShowHosts relation CcShowHosts object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowHostsQuery A secondary query class using the current class as primary query
*/
public function useCcShowHostsQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcShowHosts($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcShowHosts', 'CcShowHostsQuery');
}
/**

View file

@ -85,6 +85,11 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
*/
protected $collCcPermss;
/**
* @var array CcShowHosts[] Collection to store aggregation of CcShowHosts objects.
*/
protected $collCcShowHostss;
/**
* @var array CcPlaylist[] Collection to store aggregation of CcPlaylist objects.
*/
@ -583,6 +588,8 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
$this->collCcPermss = null;
$this->collCcShowHostss = null;
$this->collCcPlaylists = null;
$this->collCcPrefs = null;
@ -746,6 +753,14 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
}
}
if ($this->collCcShowHostss !== null) {
foreach ($this->collCcShowHostss as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collCcPlaylists !== null) {
foreach ($this->collCcPlaylists as $referrerFK) {
if (!$referrerFK->isDeleted()) {
@ -865,6 +880,14 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
}
}
if ($this->collCcShowHostss !== null) {
foreach ($this->collCcShowHostss as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
if ($this->collCcPlaylists !== null) {
foreach ($this->collCcPlaylists as $referrerFK) {
if (!$referrerFK->validate($columns)) {
@ -1165,6 +1188,12 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
}
}
foreach ($this->getCcShowHostss() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCcShowHosts($relObj->copy($deepCopy));
}
}
foreach ($this->getCcPlaylists() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCcPlaylist($relObj->copy($deepCopy));
@ -1555,6 +1584,140 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
}
}
/**
* Clears out the collCcShowHostss collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
* @see addCcShowHostss()
*/
public function clearCcShowHostss()
{
$this->collCcShowHostss = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Initializes the collCcShowHostss collection.
*
* By default this just sets the collCcShowHostss collection to an empty array (like clearcollCcShowHostss());
* however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database.
*
* @return void
*/
public function initCcShowHostss()
{
$this->collCcShowHostss = new PropelObjectCollection();
$this->collCcShowHostss->setModel('CcShowHosts');
}
/**
* Gets an array of CcShowHosts objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this CcSubjs is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @return PropelCollection|array CcShowHosts[] List of CcShowHosts objects
* @throws PropelException
*/
public function getCcShowHostss($criteria = null, PropelPDO $con = null)
{
if(null === $this->collCcShowHostss || null !== $criteria) {
if ($this->isNew() && null === $this->collCcShowHostss) {
// return empty collection
$this->initCcShowHostss();
} else {
$collCcShowHostss = CcShowHostsQuery::create(null, $criteria)
->filterByCcSubjs($this)
->find($con);
if (null !== $criteria) {
return $collCcShowHostss;
}
$this->collCcShowHostss = $collCcShowHostss;
}
}
return $this->collCcShowHostss;
}
/**
* Returns the number of related CcShowHosts objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
* @return int Count of related CcShowHosts objects.
* @throws PropelException
*/
public function countCcShowHostss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
if(null === $this->collCcShowHostss || null !== $criteria) {
if ($this->isNew() && null === $this->collCcShowHostss) {
return 0;
} else {
$query = CcShowHostsQuery::create(null, $criteria);
if($distinct) {
$query->distinct();
}
return $query
->filterByCcSubjs($this)
->count($con);
}
} else {
return count($this->collCcShowHostss);
}
}
/**
* Method called to associate a CcShowHosts object to this object
* through the CcShowHosts foreign key attribute.
*
* @param CcShowHosts $l CcShowHosts
* @return void
* @throws PropelException
*/
public function addCcShowHosts(CcShowHosts $l)
{
if ($this->collCcShowHostss === null) {
$this->initCcShowHostss();
}
if (!$this->collCcShowHostss->contains($l)) { // only add it if the **same** object is not already associated
$this->collCcShowHostss[]= $l;
$l->setCcSubjs($this);
}
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this CcSubjs is new, it will return
* an empty collection; or if this CcSubjs has previously
* been saved, it will retrieve related CcShowHostss from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in CcSubjs.
*
* @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 CcShowHosts[] List of CcShowHosts objects
*/
public function getCcShowHostssJoinCcShow($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = CcShowHostsQuery::create(null, $criteria);
$query->joinWith('CcShow', $join_behavior);
return $this->getCcShowHostss($query, $con);
}
/**
* Clears out the collCcPlaylists collection
*
@ -1930,6 +2093,11 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
if ($this->collCcShowHostss) {
foreach ((array) $this->collCcShowHostss as $o) {
$o->clearAllReferences($deep);
}
}
if ($this->collCcPlaylists) {
foreach ((array) $this->collCcPlaylists as $o) {
$o->clearAllReferences($deep);
@ -1950,6 +2118,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
$this->collCcAccesss = null;
$this->collCcFiless = null;
$this->collCcPermss = null;
$this->collCcShowHostss = null;
$this->collCcPlaylists = null;
$this->collCcPrefs = null;
$this->collCcSesss = null;

View file

@ -371,6 +371,9 @@ abstract class BaseCcSubjsPeer {
// Invalidate objects in CcPermsPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcPermsPeer::clearInstancePool();
// Invalidate objects in CcShowHostsPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcShowHostsPeer::clearInstancePool();
// Invalidate objects in CcPrefPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcPrefPeer::clearInstancePool();

View file

@ -38,6 +38,10 @@
* @method CcSubjsQuery rightJoinCcPerms($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPerms relation
* @method CcSubjsQuery innerJoinCcPerms($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPerms relation
*
* @method CcSubjsQuery leftJoinCcShowHosts($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowHosts relation
* @method CcSubjsQuery rightJoinCcShowHosts($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowHosts relation
* @method CcSubjsQuery innerJoinCcShowHosts($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowHosts relation
*
* @method CcSubjsQuery leftJoinCcPlaylist($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlaylist relation
* @method CcSubjsQuery rightJoinCcPlaylist($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylist relation
* @method CcSubjsQuery innerJoinCcPlaylist($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylist relation
@ -536,6 +540,70 @@ abstract class BaseCcSubjsQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CcPerms', 'CcPermsQuery');
}
/**
* Filter the query by a related CcShowHosts object
*
* @param CcShowHosts $ccShowHosts the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcSubjsQuery The current query, for fluid interface
*/
public function filterByCcShowHosts($ccShowHosts, $comparison = null)
{
return $this
->addUsingAlias(CcSubjsPeer::ID, $ccShowHosts->getDbHost(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcShowHosts relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcSubjsQuery The current query, for fluid interface
*/
public function joinCcShowHosts($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcShowHosts');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CcShowHosts');
}
return $this;
}
/**
* Use the CcShowHosts relation CcShowHosts object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowHostsQuery A secondary query class using the current class as primary query
*/
public function useCcShowHostsQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcShowHosts($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcShowHosts', 'CcShowHostsQuery');
}
/**
* Filter the query by a related CcPlaylist object
*

View file

@ -0,0 +1 @@
<br /><br /><center>View script for controller <b>Schedule</b> and script/action name <b>moveShow</b></center>

View file

@ -0,0 +1 @@
<br /><br /><center>View script for controller <b>Schedule</b> and script/action name <b>resizeShow</b></center>

View file

@ -124,14 +124,31 @@
<table name="cc_show" phpName="CcShow">
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
<column name="name" phpName="DbName" type="VARCHAR" size="255" required="true" defaultValue=""/>
<column name="first_show" phpName="DbFirstShow" type="DATE" required="true"/>
<column name="repeats" phpName="DbRepeats" type="TINYINT" required="true"/>
<column name="description" phpName="DbDescription" type="VARCHAR" size="512" required="false"/>
</table>
<table name="cc_show_days" phpName="CcShowDays">
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
<column name="first_show" phpName="DbFirstShow" type="DATE" required="true"/>
<column name="last_show" phpName="DbLastShow" type="DATE" required="false"/>
<column name="start_time" phpName="DbStartTime" type="TIME" required="true"/>
<column name="end_time" phpName="DbEndTime" type="TIME" required="true"/>
<column name="repeats" phpName="DbRepeats" type="TINYINT" required="true"/>
<column name="day" phpName="DbDay" type="TINYINT" required="true"/>
<column name="description" phpName="DbDescription" type="VARCHAR" size="512" required="false"/>
<column name="show_id" phpName="DbShowId" type="INTEGER" required="true"/>
<foreign-key foreignTable="cc_show" name="cc_show_fkey" onDelete="CASCADE">
<reference local="show_id" foreign="id"/>
</foreign-key>
</table>
<table name="cc_show_hosts" phpName="CcShowHosts">
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
<column name="show_id" phpName="DbShow" type="INTEGER" required="true"/>
<column name="subjs_id" phpName="DbHost" type="INTEGER" required="true"/>
<foreign-key foreignTable="cc_show" name="cc_perm_show_fkey" onDelete="CASCADE">
<reference local="show_id" foreign="id"/>
</foreign-key>
<foreign-key foreignTable="cc_subjs" name="cc_perm_host_fkey" onDelete="CASCADE">
<reference local="subjs_id" foreign="id"/>
</foreign-key>
</table>
<table name="cc_playlist" phpName="CcPlaylist">
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>

View file

@ -162,20 +162,56 @@ CREATE TABLE "cc_show"
(
"id" serial NOT NULL,
"name" VARCHAR(255) default '' NOT NULL,
"first_show" DATE NOT NULL,
"last_show" DATE,
"start_time" TIME NOT NULL,
"end_time" TIME NOT NULL,
"repeats" INT2 NOT NULL,
"day" INT2 NOT NULL,
"description" VARCHAR(512),
"show_id" INTEGER NOT NULL,
PRIMARY KEY ("id")
);
COMMENT ON TABLE "cc_show" IS '';
SET search_path TO public;
-----------------------------------------------------------------------------
-- cc_show_days
-----------------------------------------------------------------------------
DROP TABLE "cc_show_days" CASCADE;
CREATE TABLE "cc_show_days"
(
"id" serial NOT NULL,
"first_show" DATE NOT NULL,
"last_show" DATE,
"start_time" TIME NOT NULL,
"end_time" TIME NOT NULL,
"day" INT2 NOT NULL,
"show_id" INTEGER NOT NULL,
PRIMARY KEY ("id")
);
COMMENT ON TABLE "cc_show_days" IS '';
SET search_path TO public;
-----------------------------------------------------------------------------
-- cc_show_hosts
-----------------------------------------------------------------------------
DROP TABLE "cc_show_hosts" CASCADE;
CREATE TABLE "cc_show_hosts"
(
"id" serial NOT NULL,
"show_id" INTEGER NOT NULL,
"subjs_id" INTEGER NOT NULL,
PRIMARY KEY ("id")
);
COMMENT ON TABLE "cc_show_hosts" IS '';
SET search_path TO public;
-----------------------------------------------------------------------------
-- cc_playlist
@ -401,6 +437,12 @@ ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_editedby_fkey" FOREIGN KEY ("edi
ALTER TABLE "cc_perms" ADD CONSTRAINT "cc_perms_subj_fkey" FOREIGN KEY ("subj") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
ALTER TABLE "cc_show_days" ADD CONSTRAINT "cc_show_fkey" FOREIGN KEY ("show_id") REFERENCES "cc_show" ("id") ON DELETE CASCADE;
ALTER TABLE "cc_show_hosts" ADD CONSTRAINT "cc_perm_show_fkey" FOREIGN KEY ("show_id") REFERENCES "cc_show" ("id") ON DELETE CASCADE;
ALTER TABLE "cc_show_hosts" ADD CONSTRAINT "cc_perm_host_fkey" FOREIGN KEY ("subjs_id") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
ALTER TABLE "cc_playlist" ADD CONSTRAINT "cc_playlist_editedby_fkey" FOREIGN KEY ("editedby") REFERENCES "cc_subjs" ("id");
ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE;

View file

@ -120,14 +120,24 @@ function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui
$.post(url,
{day: dayDelta, min: minuteDelta, showId: event.id},
function(json){
if(json.error) {
if(json.overlap) {
revertFunc();
}
});
}
function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view ) {
var x;
var url;
url = '/Schedule/resize-show/format/json';
$.post(url,
{day: dayDelta, min: minuteDelta, showId: event.id},
function(json){
if(json.overlap) {
revertFunc();
}
});
}
function openShowDialog() {
@ -145,7 +155,7 @@ $(document).ready(function() {
$('#schedule_calendar').fullCalendar({
header: {
left: 'prev, next, today',
left: 'next, today',
center: 'title',
right: 'agendaDay, agendaWeek, month'
},