modified cc_schedule table, added foreign key to show instance id for easy clean up when show needs to be cleared/deleted. replaced primary key with a standard auto incrementing key for efficiency since the other key had no use.

This commit is contained in:
naomiaro 2011-02-06 01:10:07 -05:00
parent 14c71a3f39
commit ebb43857f6
12 changed files with 766 additions and 45 deletions

View file

@ -76,7 +76,7 @@ class ScheduleGroup {
* Return PEAR_Error if the item could not be added. * Return PEAR_Error if the item could not be added.
* Error code 555 is a scheduling conflict. * Error code 555 is a scheduling conflict.
*/ */
public function add($p_datetime, $p_audioFileId = null, $p_playlistId = null, $p_options = null) { public function add($show_instance, $p_datetime, $p_audioFileId = null, $p_playlistId = null, $p_options = null) {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
if (!is_null($p_audioFileId)) { if (!is_null($p_audioFileId)) {
// Schedule a single audio track // Schedule a single audio track
@ -101,8 +101,8 @@ class ScheduleGroup {
$this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')"); $this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')");
$id = $this->dateToId($p_datetime); $id = $this->dateToId($p_datetime);
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"] $sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
." (id, playlist_id, starts, ends, clip_length, group_id, file_id)" ." (playlist_id, starts, ends, clip_length, group_id, file_id)"
." VALUES ($id, 0, TIMESTAMP '$p_datetime', " ." VALUES (0, TIMESTAMP '$p_datetime', "
." (TIMESTAMP '$p_datetime' + INTERVAL '$length')," ." (TIMESTAMP '$p_datetime' + INTERVAL '$length'),"
." '$length'," ." '$length',"
." {$this->groupId}, $p_audioFileId)"; ." {$this->groupId}, $p_audioFileId)";
@ -143,9 +143,9 @@ class ScheduleGroup {
$trackLength = $row["cliplength"]; $trackLength = $row["cliplength"];
//var_dump($trackLength); //var_dump($trackLength);
$sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"] $sql = "INSERT INTO ".$CC_CONFIG["scheduleTable"]
." (id, playlist_id, starts, ends, group_id, file_id," ." (instance_id, playlist_id, starts, ends, group_id, file_id,"
." clip_length, cue_in, cue_out, fade_in, fade_out)" ." clip_length, cue_in, cue_out, fade_in, fade_out)"
." VALUES ($id, $p_playlistId, TIMESTAMP '$itemStartTime', " ." VALUES ($show_instance, $p_playlistId, TIMESTAMP '$itemStartTime', "
." (TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength')," ." (TIMESTAMP '$itemStartTime' + INTERVAL '$trackLength'),"
." '{$this->groupId}', '{$row['file_id']}', '$trackLength', '{$row['cuein']}'," ." '{$this->groupId}', '{$row['file_id']}', '$trackLength', '{$row['cuein']}',"
." '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')"; ." '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')";
@ -161,23 +161,23 @@ class ScheduleGroup {
} }
} }
public function addAfter($p_groupId, $p_audioFileId) { public function addAfter($show_instance, $p_groupId, $p_audioFileId) {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
// Get the end time for the given entry // Get the end time for the given entry
$sql = "SELECT MAX(ends) FROM ".$CC_CONFIG["scheduleTable"] $sql = "SELECT MAX(ends) FROM ".$CC_CONFIG["scheduleTable"]
." WHERE group_id=$p_groupId"; ." WHERE group_id=$p_groupId";
$startTime = $CC_DBC->GetOne($sql); $startTime = $CC_DBC->GetOne($sql);
return $this->add($startTime, $p_audioFileId); return $this->add($show_instance, $startTime, $p_audioFileId);
} }
public function addPlaylistAfter($p_groupId, $p_playlistId) { public function addPlaylistAfter($show_instance, $p_groupId, $p_playlistId) {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
// Get the end time for the given entry // Get the end time for the given entry
$sql = "SELECT MAX(ends) FROM ".$CC_CONFIG["scheduleTable"] $sql = "SELECT MAX(ends) FROM ".$CC_CONFIG["scheduleTable"]
." WHERE group_id=$p_groupId"; ." WHERE group_id=$p_groupId";
$startTime = $CC_DBC->GetOne($sql); $startTime = $CC_DBC->GetOne($sql);
return $this->add($startTime, null, $p_playlistId); return $this->add($show_instance, $startTime, null, $p_playlistId);
} }
public function update() { public function update() {

View file

@ -494,10 +494,10 @@ class ShowInstance {
if(is_null($lastGroupId)) { if(is_null($lastGroupId)) {
$groupId = $sched->add($this->getShowStart(), null, $plId); $groupId = $sched->add($this->_instanceId, $this->getShowStart(), null, $plId);
} }
else { else {
$groupId = $sched->addPlaylistAfter($lastGroupId, $plId); $groupId = $sched->addPlaylistAfter($this->_instanceId, $lastGroupId, $plId);
} }
$groupsched = new CcShowSchedule(); $groupsched = new CcShowSchedule();

View file

@ -35,9 +35,10 @@ class CcScheduleTableMap extends TableMap {
$this->setPhpName('CcSchedule'); $this->setPhpName('CcSchedule');
$this->setClassname('CcSchedule'); $this->setClassname('CcSchedule');
$this->setPackage('airtime'); $this->setPackage('airtime');
$this->setUseIdGenerator(false); $this->setUseIdGenerator(true);
$this->setPrimaryKeyMethodInfo('cc_schedule_id_seq');
// columns // columns
$this->addPrimaryKey('ID', 'DbId', 'BIGINT', true, null, null); $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', true, null, null); $this->addColumn('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', true, null, null);
$this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null); $this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
$this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null); $this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
@ -50,6 +51,7 @@ class CcScheduleTableMap extends TableMap {
$this->addColumn('CUE_OUT', 'DbCueOut', 'TIME', false, null, '00:00:00'); $this->addColumn('CUE_OUT', 'DbCueOut', 'TIME', false, null, '00:00:00');
$this->addColumn('SCHEDULE_GROUP_PLAYED', 'DbScheduleGroupPlayed', 'BOOLEAN', false, null, false); $this->addColumn('SCHEDULE_GROUP_PLAYED', 'DbScheduleGroupPlayed', 'BOOLEAN', false, null, false);
$this->addColumn('MEDIA_ITEM_PLAYED', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false); $this->addColumn('MEDIA_ITEM_PLAYED', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false);
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null);
// validators // validators
} // initialize() } // initialize()
@ -58,6 +60,7 @@ class CcScheduleTableMap extends TableMap {
*/ */
public function buildRelations() public function buildRelations()
{ {
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null);
} // buildRelations() } // buildRelations()
} // CcScheduleTableMap } // CcScheduleTableMap

View file

@ -52,6 +52,7 @@ class CcShowInstancesTableMap extends TableMap {
{ {
$this->addRelation('CcShow', 'CcShow', RelationMap::MANY_TO_ONE, array('show_id' => 'id', ), 'CASCADE', null); $this->addRelation('CcShow', 'CcShow', RelationMap::MANY_TO_ONE, array('show_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcShowSchedule', 'CcShowSchedule', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null); $this->addRelation('CcShowSchedule', 'CcShowSchedule', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null);
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null);
} // buildRelations() } // buildRelations()
} // CcShowInstancesTableMap } // CcShowInstancesTableMap

View file

@ -26,7 +26,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
/** /**
* The value for the id field. * The value for the id field.
* @var string * @var int
*/ */
protected $id; protected $id;
@ -109,6 +109,17 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
*/ */
protected $media_item_played; protected $media_item_played;
/**
* The value for the instance_id field.
* @var int
*/
protected $instance_id;
/**
* @var CcShowInstances
*/
protected $aCcShowInstances;
/** /**
* Flag to prevent endless save loop, if this object is referenced * Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction. * by another object which falls in this transaction.
@ -153,7 +164,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
/** /**
* Get the [id] column value. * Get the [id] column value.
* *
* @return string * @return int
*/ */
public function getDbId() public function getDbId()
{ {
@ -441,16 +452,26 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return $this->media_item_played; return $this->media_item_played;
} }
/**
* Get the [instance_id] column value.
*
* @return int
*/
public function getDbInstanceId()
{
return $this->instance_id;
}
/** /**
* Set the value of [id] column. * Set the value of [id] column.
* *
* @param string $v new value * @param int $v new value
* @return CcSchedule The current object (for fluent API support) * @return CcSchedule The current object (for fluent API support)
*/ */
public function setDbId($v) public function setDbId($v)
{ {
if ($v !== null) { if ($v !== null) {
$v = (string) $v; $v = (int) $v;
} }
if ($this->id !== $v) { if ($this->id !== $v) {
@ -909,6 +930,30 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return $this; return $this;
} // setDbMediaItemPlayed() } // setDbMediaItemPlayed()
/**
* Set the value of [instance_id] column.
*
* @param int $v new value
* @return CcSchedule The current object (for fluent API support)
*/
public function setDbInstanceId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->instance_id !== $v) {
$this->instance_id = $v;
$this->modifiedColumns[] = CcSchedulePeer::INSTANCE_ID;
}
if ($this->aCcShowInstances !== null && $this->aCcShowInstances->getDbId() !== $v) {
$this->aCcShowInstances = null;
}
return $this;
} // setDbInstanceId()
/** /**
* Indicates whether the columns in this object are only set to default values. * Indicates whether the columns in this object are only set to default values.
* *
@ -969,7 +1014,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
{ {
try { try {
$this->id = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null; $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->playlist_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; $this->playlist_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
$this->starts = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; $this->starts = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->ends = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; $this->ends = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
@ -982,6 +1027,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->cue_out = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; $this->cue_out = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
$this->schedule_group_played = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null; $this->schedule_group_played = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null;
$this->media_item_played = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null; $this->media_item_played = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null;
$this->instance_id = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null;
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
@ -990,7 +1036,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 13; // 13 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS). return $startcol + 14; // 14 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating CcSchedule object", $e); throw new PropelException("Error populating CcSchedule object", $e);
@ -1013,6 +1059,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
public function ensureConsistency() public function ensureConsistency()
{ {
if ($this->aCcShowInstances !== null && $this->instance_id !== $this->aCcShowInstances->getDbId()) {
$this->aCcShowInstances = null;
}
} // ensureConsistency } // ensureConsistency
/** /**
@ -1052,6 +1101,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects? if ($deep) { // also de-associate any related objects?
$this->aCcShowInstances = null;
} // if (deep) } // if (deep)
} }
@ -1162,16 +1212,36 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
if (!$this->alreadyInSave) { if (!$this->alreadyInSave) {
$this->alreadyInSave = true; $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->aCcShowInstances !== null) {
if ($this->aCcShowInstances->isModified() || $this->aCcShowInstances->isNew()) {
$affectedRows += $this->aCcShowInstances->save($con);
}
$this->setCcShowInstances($this->aCcShowInstances);
}
if ($this->isNew() ) {
$this->modifiedColumns[] = CcSchedulePeer::ID;
}
// If this object has been modified, then save it to the database. // If this object has been modified, then save it to the database.
if ($this->isModified()) { if ($this->isModified()) {
if ($this->isNew()) { if ($this->isNew()) {
$criteria = $this->buildCriteria(); $criteria = $this->buildCriteria();
if ($criteria->keyContainsValue(CcSchedulePeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcSchedulePeer::ID.')');
}
$pk = BasePeer::doInsert($criteria, $con); $pk = BasePeer::doInsert($criteria, $con);
$affectedRows = 1; $affectedRows += 1;
$this->setDbId($pk); //[IMV] update autoincrement primary key
$this->setNew(false); $this->setNew(false);
} else { } else {
$affectedRows = CcSchedulePeer::doUpdate($this, $con); $affectedRows += CcSchedulePeer::doUpdate($this, $con);
} }
$this->resetModified(); // [HL] After being saved an object is no longer 'modified' $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
@ -1243,6 +1313,18 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$failureMap = array(); $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->aCcShowInstances !== null) {
if (!$this->aCcShowInstances->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aCcShowInstances->getValidationFailures());
}
}
if (($retval = CcSchedulePeer::doValidate($this, $columns)) !== true) { if (($retval = CcSchedulePeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval); $failureMap = array_merge($failureMap, $retval);
} }
@ -1320,6 +1402,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
case 12: case 12:
return $this->getDbMediaItemPlayed(); return $this->getDbMediaItemPlayed();
break; break;
case 13:
return $this->getDbInstanceId();
break;
default: default:
return null; return null;
break; break;
@ -1336,10 +1421,11 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME. * Defaults to BasePeer::TYPE_PHPNAME.
* @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
* @param 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 * @return array an associative array containing the field names (as keys) and field values
*/ */
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false)
{ {
$keys = CcSchedulePeer::getFieldNames($keyType); $keys = CcSchedulePeer::getFieldNames($keyType);
$result = array( $result = array(
@ -1356,7 +1442,13 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$keys[10] => $this->getDbCueOut(), $keys[10] => $this->getDbCueOut(),
$keys[11] => $this->getDbScheduleGroupPlayed(), $keys[11] => $this->getDbScheduleGroupPlayed(),
$keys[12] => $this->getDbMediaItemPlayed(), $keys[12] => $this->getDbMediaItemPlayed(),
$keys[13] => $this->getDbInstanceId(),
); );
if ($includeForeignObjects) {
if (null !== $this->aCcShowInstances) {
$result['CcShowInstances'] = $this->aCcShowInstances->toArray($keyType, $includeLazyLoadColumns, true);
}
}
return $result; return $result;
} }
@ -1426,6 +1518,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
case 12: case 12:
$this->setDbMediaItemPlayed($value); $this->setDbMediaItemPlayed($value);
break; break;
case 13:
$this->setDbInstanceId($value);
break;
} // switch() } // switch()
} }
@ -1463,6 +1558,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
if (array_key_exists($keys[10], $arr)) $this->setDbCueOut($arr[$keys[10]]); if (array_key_exists($keys[10], $arr)) $this->setDbCueOut($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setDbScheduleGroupPlayed($arr[$keys[11]]); if (array_key_exists($keys[11], $arr)) $this->setDbScheduleGroupPlayed($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setDbMediaItemPlayed($arr[$keys[12]]); if (array_key_exists($keys[12], $arr)) $this->setDbMediaItemPlayed($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setDbInstanceId($arr[$keys[13]]);
} }
/** /**
@ -1487,6 +1583,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
if ($this->isColumnModified(CcSchedulePeer::CUE_OUT)) $criteria->add(CcSchedulePeer::CUE_OUT, $this->cue_out); if ($this->isColumnModified(CcSchedulePeer::CUE_OUT)) $criteria->add(CcSchedulePeer::CUE_OUT, $this->cue_out);
if ($this->isColumnModified(CcSchedulePeer::SCHEDULE_GROUP_PLAYED)) $criteria->add(CcSchedulePeer::SCHEDULE_GROUP_PLAYED, $this->schedule_group_played); if ($this->isColumnModified(CcSchedulePeer::SCHEDULE_GROUP_PLAYED)) $criteria->add(CcSchedulePeer::SCHEDULE_GROUP_PLAYED, $this->schedule_group_played);
if ($this->isColumnModified(CcSchedulePeer::MEDIA_ITEM_PLAYED)) $criteria->add(CcSchedulePeer::MEDIA_ITEM_PLAYED, $this->media_item_played); if ($this->isColumnModified(CcSchedulePeer::MEDIA_ITEM_PLAYED)) $criteria->add(CcSchedulePeer::MEDIA_ITEM_PLAYED, $this->media_item_played);
if ($this->isColumnModified(CcSchedulePeer::INSTANCE_ID)) $criteria->add(CcSchedulePeer::INSTANCE_ID, $this->instance_id);
return $criteria; return $criteria;
} }
@ -1509,7 +1606,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
/** /**
* Returns the primary key for this object (row). * Returns the primary key for this object (row).
* @return string * @return int
*/ */
public function getPrimaryKey() public function getPrimaryKey()
{ {
@ -1519,7 +1616,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
/** /**
* Generic method to set the primary key (id column). * Generic method to set the primary key (id column).
* *
* @param string $key Primary key. * @param int $key Primary key.
* @return void * @return void
*/ */
public function setPrimaryKey($key) public function setPrimaryKey($key)
@ -1548,7 +1645,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
*/ */
public function copyInto($copyObj, $deepCopy = false) public function copyInto($copyObj, $deepCopy = false)
{ {
$copyObj->setDbId($this->id);
$copyObj->setDbPlaylistId($this->playlist_id); $copyObj->setDbPlaylistId($this->playlist_id);
$copyObj->setDbStarts($this->starts); $copyObj->setDbStarts($this->starts);
$copyObj->setDbEnds($this->ends); $copyObj->setDbEnds($this->ends);
@ -1561,8 +1657,10 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$copyObj->setDbCueOut($this->cue_out); $copyObj->setDbCueOut($this->cue_out);
$copyObj->setDbScheduleGroupPlayed($this->schedule_group_played); $copyObj->setDbScheduleGroupPlayed($this->schedule_group_played);
$copyObj->setDbMediaItemPlayed($this->media_item_played); $copyObj->setDbMediaItemPlayed($this->media_item_played);
$copyObj->setDbInstanceId($this->instance_id);
$copyObj->setNew(true); $copyObj->setNew(true);
$copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
} }
/** /**
@ -1603,6 +1701,55 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return self::$peer; return self::$peer;
} }
/**
* Declares an association between this object and a CcShowInstances object.
*
* @param CcShowInstances $v
* @return CcSchedule The current object (for fluent API support)
* @throws PropelException
*/
public function setCcShowInstances(CcShowInstances $v = null)
{
if ($v === null) {
$this->setDbInstanceId(NULL);
} else {
$this->setDbInstanceId($v->getDbId());
}
$this->aCcShowInstances = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the CcShowInstances object, it will not be re-added.
if ($v !== null) {
$v->addCcSchedule($this);
}
return $this;
}
/**
* Get the associated CcShowInstances object
*
* @param PropelPDO Optional Connection object.
* @return CcShowInstances The associated CcShowInstances object.
* @throws PropelException
*/
public function getCcShowInstances(PropelPDO $con = null)
{
if ($this->aCcShowInstances === null && ($this->instance_id !== null)) {
$this->aCcShowInstances = CcShowInstancesQuery::create()->findPk($this->instance_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->aCcShowInstances->addCcSchedules($this);
*/
}
return $this->aCcShowInstances;
}
/** /**
* Clears the current object and sets all attributes to their default values * Clears the current object and sets all attributes to their default values
*/ */
@ -1621,6 +1768,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->cue_out = null; $this->cue_out = null;
$this->schedule_group_played = null; $this->schedule_group_played = null;
$this->media_item_played = null; $this->media_item_played = null;
$this->instance_id = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
$this->alreadyInValidation = false; $this->alreadyInValidation = false;
$this->clearAllReferences(); $this->clearAllReferences();
@ -1644,6 +1792,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
if ($deep) { if ($deep) {
} // if ($deep) } // if ($deep)
$this->aCcShowInstances = null;
} }
/** /**

View file

@ -26,7 +26,7 @@ abstract class BaseCcSchedulePeer {
const TM_CLASS = 'CcScheduleTableMap'; const TM_CLASS = 'CcScheduleTableMap';
/** The total number of columns. */ /** The total number of columns. */
const NUM_COLUMNS = 13; const NUM_COLUMNS = 14;
/** The number of lazy-loaded columns. */ /** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0; const NUM_LAZY_LOAD_COLUMNS = 0;
@ -70,6 +70,9 @@ abstract class BaseCcSchedulePeer {
/** the column name for the MEDIA_ITEM_PLAYED field */ /** the column name for the MEDIA_ITEM_PLAYED field */
const MEDIA_ITEM_PLAYED = 'cc_schedule.MEDIA_ITEM_PLAYED'; const MEDIA_ITEM_PLAYED = 'cc_schedule.MEDIA_ITEM_PLAYED';
/** the column name for the INSTANCE_ID field */
const INSTANCE_ID = 'cc_schedule.INSTANCE_ID';
/** /**
* An identiy map to hold any loaded instances of CcSchedule objects. * An identiy map to hold any loaded instances of CcSchedule objects.
* This must be public so that other peer classes can access this when hydrating from JOIN * This must be public so that other peer classes can access this when hydrating from JOIN
@ -86,12 +89,12 @@ abstract class BaseCcSchedulePeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
private static $fieldNames = array ( private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbStarts', 'DbEnds', 'DbGroupId', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbScheduleGroupPlayed', 'DbMediaItemPlayed', ), BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbStarts', 'DbEnds', 'DbGroupId', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbScheduleGroupPlayed', 'DbMediaItemPlayed', 'DbInstanceId', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbStarts', 'dbEnds', 'dbGroupId', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbScheduleGroupPlayed', 'dbMediaItemPlayed', ), BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbStarts', 'dbEnds', 'dbGroupId', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbScheduleGroupPlayed', 'dbMediaItemPlayed', 'dbInstanceId', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::STARTS, self::ENDS, self::GROUP_ID, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::SCHEDULE_GROUP_PLAYED, self::MEDIA_ITEM_PLAYED, ), BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::STARTS, self::ENDS, self::GROUP_ID, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::SCHEDULE_GROUP_PLAYED, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'STARTS', 'ENDS', 'GROUP_ID', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'SCHEDULE_GROUP_PLAYED', 'MEDIA_ITEM_PLAYED', ), BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'STARTS', 'ENDS', 'GROUP_ID', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'SCHEDULE_GROUP_PLAYED', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'starts', 'ends', 'group_id', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'schedule_group_played', 'media_item_played', ), BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'starts', 'ends', 'group_id', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'schedule_group_played', 'media_item_played', 'instance_id', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
); );
/** /**
@ -101,12 +104,12 @@ abstract class BaseCcSchedulePeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/ */
private static $fieldKeys = array ( private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbStarts' => 2, 'DbEnds' => 3, 'DbGroupId' => 4, 'DbFileId' => 5, 'DbClipLength' => 6, 'DbFadeIn' => 7, 'DbFadeOut' => 8, 'DbCueIn' => 9, 'DbCueOut' => 10, 'DbScheduleGroupPlayed' => 11, 'DbMediaItemPlayed' => 12, ), BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbStarts' => 2, 'DbEnds' => 3, 'DbGroupId' => 4, 'DbFileId' => 5, 'DbClipLength' => 6, 'DbFadeIn' => 7, 'DbFadeOut' => 8, 'DbCueIn' => 9, 'DbCueOut' => 10, 'DbScheduleGroupPlayed' => 11, 'DbMediaItemPlayed' => 12, 'DbInstanceId' => 13, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbStarts' => 2, 'dbEnds' => 3, 'dbGroupId' => 4, 'dbFileId' => 5, 'dbClipLength' => 6, 'dbFadeIn' => 7, 'dbFadeOut' => 8, 'dbCueIn' => 9, 'dbCueOut' => 10, 'dbScheduleGroupPlayed' => 11, 'dbMediaItemPlayed' => 12, ), BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbStarts' => 2, 'dbEnds' => 3, 'dbGroupId' => 4, 'dbFileId' => 5, 'dbClipLength' => 6, 'dbFadeIn' => 7, 'dbFadeOut' => 8, 'dbCueIn' => 9, 'dbCueOut' => 10, 'dbScheduleGroupPlayed' => 11, 'dbMediaItemPlayed' => 12, 'dbInstanceId' => 13, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::STARTS => 2, self::ENDS => 3, self::GROUP_ID => 4, self::FILE_ID => 5, self::CLIP_LENGTH => 6, self::FADE_IN => 7, self::FADE_OUT => 8, self::CUE_IN => 9, self::CUE_OUT => 10, self::SCHEDULE_GROUP_PLAYED => 11, self::MEDIA_ITEM_PLAYED => 12, ), BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::STARTS => 2, self::ENDS => 3, self::GROUP_ID => 4, self::FILE_ID => 5, self::CLIP_LENGTH => 6, self::FADE_IN => 7, self::FADE_OUT => 8, self::CUE_IN => 9, self::CUE_OUT => 10, self::SCHEDULE_GROUP_PLAYED => 11, self::MEDIA_ITEM_PLAYED => 12, self::INSTANCE_ID => 13, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'STARTS' => 2, 'ENDS' => 3, 'GROUP_ID' => 4, 'FILE_ID' => 5, 'CLIP_LENGTH' => 6, 'FADE_IN' => 7, 'FADE_OUT' => 8, 'CUE_IN' => 9, 'CUE_OUT' => 10, 'SCHEDULE_GROUP_PLAYED' => 11, 'MEDIA_ITEM_PLAYED' => 12, ), BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'STARTS' => 2, 'ENDS' => 3, 'GROUP_ID' => 4, 'FILE_ID' => 5, 'CLIP_LENGTH' => 6, 'FADE_IN' => 7, 'FADE_OUT' => 8, 'CUE_IN' => 9, 'CUE_OUT' => 10, 'SCHEDULE_GROUP_PLAYED' => 11, 'MEDIA_ITEM_PLAYED' => 12, 'INSTANCE_ID' => 13, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'starts' => 2, 'ends' => 3, 'group_id' => 4, 'file_id' => 5, 'clip_length' => 6, 'fade_in' => 7, 'fade_out' => 8, 'cue_in' => 9, 'cue_out' => 10, 'schedule_group_played' => 11, 'media_item_played' => 12, ), BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'starts' => 2, 'ends' => 3, 'group_id' => 4, 'file_id' => 5, 'clip_length' => 6, 'fade_in' => 7, 'fade_out' => 8, 'cue_in' => 9, 'cue_out' => 10, 'schedule_group_played' => 11, 'media_item_played' => 12, 'instance_id' => 13, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
); );
/** /**
@ -191,6 +194,7 @@ abstract class BaseCcSchedulePeer {
$criteria->addSelectColumn(CcSchedulePeer::CUE_OUT); $criteria->addSelectColumn(CcSchedulePeer::CUE_OUT);
$criteria->addSelectColumn(CcSchedulePeer::SCHEDULE_GROUP_PLAYED); $criteria->addSelectColumn(CcSchedulePeer::SCHEDULE_GROUP_PLAYED);
$criteria->addSelectColumn(CcSchedulePeer::MEDIA_ITEM_PLAYED); $criteria->addSelectColumn(CcSchedulePeer::MEDIA_ITEM_PLAYED);
$criteria->addSelectColumn(CcSchedulePeer::INSTANCE_ID);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.PLAYLIST_ID'); $criteria->addSelectColumn($alias . '.PLAYLIST_ID');
@ -205,6 +209,7 @@ abstract class BaseCcSchedulePeer {
$criteria->addSelectColumn($alias . '.CUE_OUT'); $criteria->addSelectColumn($alias . '.CUE_OUT');
$criteria->addSelectColumn($alias . '.SCHEDULE_GROUP_PLAYED'); $criteria->addSelectColumn($alias . '.SCHEDULE_GROUP_PLAYED');
$criteria->addSelectColumn($alias . '.MEDIA_ITEM_PLAYED'); $criteria->addSelectColumn($alias . '.MEDIA_ITEM_PLAYED');
$criteria->addSelectColumn($alias . '.INSTANCE_ID');
} }
} }
@ -430,7 +435,7 @@ abstract class BaseCcSchedulePeer {
*/ */
public static function getPrimaryKeyFromRow($row, $startcol = 0) public static function getPrimaryKeyFromRow($row, $startcol = 0)
{ {
return (string) $row[$startcol]; return (int) $row[$startcol];
} }
/** /**
@ -489,6 +494,240 @@ abstract class BaseCcSchedulePeer {
} }
return array($obj, $col); return array($obj, $col);
} }
/**
* Returns the number of rows matching criteria, joining the related CcShowInstances 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 doCountJoinCcShowInstances(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(CcSchedulePeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcSchedulePeer::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(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::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 CcSchedule objects pre-filled with their CcShowInstances 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 CcSchedule objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinCcShowInstances(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);
}
CcSchedulePeer::addSelectColumns($criteria);
$startcol = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
CcShowInstancesPeer::addSelectColumns($criteria);
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcSchedulePeer::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 = CcSchedulePeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcSchedulePeer::addInstanceToPool($obj1, $key1);
} // if $obj1 already loaded
$key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol);
if ($key2 !== null) {
$obj2 = CcShowInstancesPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcShowInstancesPeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
CcShowInstancesPeer::addInstanceToPool($obj2, $key2);
} // if obj2 already loaded
// Add the $obj1 (CcSchedule) to $obj2 (CcShowInstances)
$obj2->addCcSchedule($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(CcSchedulePeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcSchedulePeer::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(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::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 CcSchedule 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 CcSchedule 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);
}
CcSchedulePeer::addSelectColumns($criteria);
$startcol2 = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
CcShowInstancesPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcSchedulePeer::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 = CcSchedulePeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcSchedulePeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded
// Add objects for joined CcShowInstances rows
$key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = CcShowInstancesPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcShowInstancesPeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
CcShowInstancesPeer::addInstanceToPool($obj2, $key2);
} // if obj2 loaded
// Add the $obj1 (CcSchedule) to the collection in $obj2 (CcShowInstances)
$obj2->addCcSchedule($obj1);
} // if joined row not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
/** /**
* Returns the TableMap related to this peer. * Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need. * This method is not needed for general use but a specific application could have a need.
@ -550,6 +789,10 @@ abstract class BaseCcSchedulePeer {
$criteria = $values->buildCriteria(); // build Criteria from CcSchedule object $criteria = $values->buildCriteria(); // build Criteria from CcSchedule object
} }
if ($criteria->containsKey(CcSchedulePeer::ID) && $criteria->keyContainsValue(CcSchedulePeer::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcSchedulePeer::ID.')');
}
// Set the correct dbName // Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME); $criteria->setDbName(self::DATABASE_NAME);
@ -734,7 +977,7 @@ abstract class BaseCcSchedulePeer {
/** /**
* Retrieve a single object by pkey. * Retrieve a single object by pkey.
* *
* @param string $pk the primary key. * @param int $pk the primary key.
* @param PropelPDO $con the connection to use * @param PropelPDO $con the connection to use
* @return CcSchedule * @return CcSchedule
*/ */

View file

@ -19,6 +19,7 @@
* @method CcScheduleQuery orderByDbCueOut($order = Criteria::ASC) Order by the cue_out column * @method CcScheduleQuery orderByDbCueOut($order = Criteria::ASC) Order by the cue_out column
* @method CcScheduleQuery orderByDbScheduleGroupPlayed($order = Criteria::ASC) Order by the schedule_group_played column * @method CcScheduleQuery orderByDbScheduleGroupPlayed($order = Criteria::ASC) Order by the schedule_group_played column
* @method CcScheduleQuery orderByDbMediaItemPlayed($order = Criteria::ASC) Order by the media_item_played column * @method CcScheduleQuery orderByDbMediaItemPlayed($order = Criteria::ASC) Order by the media_item_played column
* @method CcScheduleQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
* *
* @method CcScheduleQuery groupByDbId() Group by the id column * @method CcScheduleQuery groupByDbId() Group by the id column
* @method CcScheduleQuery groupByDbPlaylistId() Group by the playlist_id column * @method CcScheduleQuery groupByDbPlaylistId() Group by the playlist_id column
@ -33,15 +34,20 @@
* @method CcScheduleQuery groupByDbCueOut() Group by the cue_out column * @method CcScheduleQuery groupByDbCueOut() Group by the cue_out column
* @method CcScheduleQuery groupByDbScheduleGroupPlayed() Group by the schedule_group_played column * @method CcScheduleQuery groupByDbScheduleGroupPlayed() Group by the schedule_group_played column
* @method CcScheduleQuery groupByDbMediaItemPlayed() Group by the media_item_played column * @method CcScheduleQuery groupByDbMediaItemPlayed() Group by the media_item_played column
* @method CcScheduleQuery groupByDbInstanceId() Group by the instance_id column
* *
* @method CcScheduleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method CcScheduleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcScheduleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method CcScheduleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcScheduleQuery innerJoin($relation) Adds a INNER JOIN clause to the query * @method CcScheduleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
* *
* @method CcScheduleQuery leftJoinCcShowInstances($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowInstances relation
* @method CcScheduleQuery rightJoinCcShowInstances($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
* @method CcScheduleQuery innerJoinCcShowInstances($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstances relation
*
* @method CcSchedule findOne(PropelPDO $con = null) Return the first CcSchedule matching the query * @method CcSchedule findOne(PropelPDO $con = null) Return the first CcSchedule matching the query
* @method CcSchedule findOneOrCreate(PropelPDO $con = null) Return the first CcSchedule matching the query, or a new CcSchedule object populated from the query conditions when no match is found * @method CcSchedule findOneOrCreate(PropelPDO $con = null) Return the first CcSchedule matching the query, or a new CcSchedule object populated from the query conditions when no match is found
* *
* @method CcSchedule findOneByDbId(string $id) Return the first CcSchedule filtered by the id column * @method CcSchedule findOneByDbId(int $id) Return the first CcSchedule filtered by the id column
* @method CcSchedule findOneByDbPlaylistId(int $playlist_id) Return the first CcSchedule filtered by the playlist_id column * @method CcSchedule findOneByDbPlaylistId(int $playlist_id) Return the first CcSchedule filtered by the playlist_id column
* @method CcSchedule findOneByDbStarts(string $starts) Return the first CcSchedule filtered by the starts column * @method CcSchedule findOneByDbStarts(string $starts) Return the first CcSchedule filtered by the starts column
* @method CcSchedule findOneByDbEnds(string $ends) Return the first CcSchedule filtered by the ends column * @method CcSchedule findOneByDbEnds(string $ends) Return the first CcSchedule filtered by the ends column
@ -54,8 +60,9 @@
* @method CcSchedule findOneByDbCueOut(string $cue_out) Return the first CcSchedule filtered by the cue_out column * @method CcSchedule findOneByDbCueOut(string $cue_out) Return the first CcSchedule filtered by the cue_out column
* @method CcSchedule findOneByDbScheduleGroupPlayed(boolean $schedule_group_played) Return the first CcSchedule filtered by the schedule_group_played column * @method CcSchedule findOneByDbScheduleGroupPlayed(boolean $schedule_group_played) Return the first CcSchedule filtered by the schedule_group_played column
* @method CcSchedule findOneByDbMediaItemPlayed(boolean $media_item_played) Return the first CcSchedule filtered by the media_item_played column * @method CcSchedule findOneByDbMediaItemPlayed(boolean $media_item_played) Return the first CcSchedule filtered by the media_item_played column
* @method CcSchedule findOneByDbInstanceId(int $instance_id) Return the first CcSchedule filtered by the instance_id column
* *
* @method array findByDbId(string $id) Return CcSchedule objects filtered by the id column * @method array findByDbId(int $id) Return CcSchedule objects filtered by the id column
* @method array findByDbPlaylistId(int $playlist_id) Return CcSchedule objects filtered by the playlist_id column * @method array findByDbPlaylistId(int $playlist_id) Return CcSchedule objects filtered by the playlist_id column
* @method array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column * @method array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column
* @method array findByDbEnds(string $ends) Return CcSchedule objects filtered by the ends column * @method array findByDbEnds(string $ends) Return CcSchedule objects filtered by the ends column
@ -68,6 +75,7 @@
* @method array findByDbCueOut(string $cue_out) Return CcSchedule objects filtered by the cue_out column * @method array findByDbCueOut(string $cue_out) Return CcSchedule objects filtered by the cue_out column
* @method array findByDbScheduleGroupPlayed(boolean $schedule_group_played) Return CcSchedule objects filtered by the schedule_group_played column * @method array findByDbScheduleGroupPlayed(boolean $schedule_group_played) Return CcSchedule objects filtered by the schedule_group_played column
* @method array findByDbMediaItemPlayed(boolean $media_item_played) Return CcSchedule objects filtered by the media_item_played column * @method array findByDbMediaItemPlayed(boolean $media_item_played) Return CcSchedule objects filtered by the media_item_played column
* @method array findByDbInstanceId(int $instance_id) Return CcSchedule objects filtered by the instance_id column
* *
* @package propel.generator.airtime.om * @package propel.generator.airtime.om
*/ */
@ -180,7 +188,7 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
/** /**
* Filter the query on the id column * Filter the query on the id column
* *
* @param string|array $dbId The value to use as filter. * @param int|array $dbId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue) * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
@ -538,6 +546,101 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
return $this->addUsingAlias(CcSchedulePeer::MEDIA_ITEM_PLAYED, $dbMediaItemPlayed, $comparison); return $this->addUsingAlias(CcSchedulePeer::MEDIA_ITEM_PLAYED, $dbMediaItemPlayed, $comparison);
} }
/**
* Filter the query on the instance_id column
*
* @param int|array $dbInstanceId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcScheduleQuery The current query, for fluid interface
*/
public function filterByDbInstanceId($dbInstanceId = null, $comparison = null)
{
if (is_array($dbInstanceId)) {
$useMinMax = false;
if (isset($dbInstanceId['min'])) {
$this->addUsingAlias(CcSchedulePeer::INSTANCE_ID, $dbInstanceId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbInstanceId['max'])) {
$this->addUsingAlias(CcSchedulePeer::INSTANCE_ID, $dbInstanceId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcSchedulePeer::INSTANCE_ID, $dbInstanceId, $comparison);
}
/**
* Filter the query by a related CcShowInstances object
*
* @param CcShowInstances $ccShowInstances the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcScheduleQuery The current query, for fluid interface
*/
public function filterByCcShowInstances($ccShowInstances, $comparison = null)
{
return $this
->addUsingAlias(CcSchedulePeer::INSTANCE_ID, $ccShowInstances->getDbId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcShowInstances relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcScheduleQuery The current query, for fluid interface
*/
public function joinCcShowInstances($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcShowInstances');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CcShowInstances');
}
return $this;
}
/**
* Use the CcShowInstances relation CcShowInstances object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowInstancesQuery A secondary query class using the current class as primary query
*/
public function useCcShowInstancesQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCcShowInstances($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery');
}
/** /**
* Exclude object from result * Exclude object from result
* *

View file

@ -58,6 +58,11 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
*/ */
protected $collCcShowSchedules; protected $collCcShowSchedules;
/**
* @var array CcSchedule[] Collection to store aggregation of CcSchedule objects.
*/
protected $collCcSchedules;
/** /**
* Flag to prevent endless save loop, if this object is referenced * Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction. * by another object which falls in this transaction.
@ -412,6 +417,8 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$this->aCcShow = null; $this->aCcShow = null;
$this->collCcShowSchedules = null; $this->collCcShowSchedules = null;
$this->collCcSchedules = null;
} // if (deep) } // if (deep)
} }
@ -565,6 +572,14 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
} }
} }
if ($this->collCcSchedules !== null) {
foreach ($this->collCcSchedules as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false; $this->alreadyInSave = false;
} }
@ -656,6 +671,14 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
} }
} }
if ($this->collCcSchedules !== null) {
foreach ($this->collCcSchedules as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
$this->alreadyInValidation = false; $this->alreadyInValidation = false;
} }
@ -896,6 +919,12 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
} }
} }
foreach ($this->getCcSchedules() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCcSchedule($relObj->copy($deepCopy));
}
}
} // if ($deepCopy) } // if ($deepCopy)
@ -1099,6 +1128,115 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
} }
} }
/**
* Clears out the collCcSchedules 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 addCcSchedules()
*/
public function clearCcSchedules()
{
$this->collCcSchedules = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Initializes the collCcSchedules collection.
*
* By default this just sets the collCcSchedules collection to an empty array (like clearcollCcSchedules());
* 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 initCcSchedules()
{
$this->collCcSchedules = new PropelObjectCollection();
$this->collCcSchedules->setModel('CcSchedule');
}
/**
* Gets an array of CcSchedule objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this CcShowInstances is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @return PropelCollection|array CcSchedule[] List of CcSchedule objects
* @throws PropelException
*/
public function getCcSchedules($criteria = null, PropelPDO $con = null)
{
if(null === $this->collCcSchedules || null !== $criteria) {
if ($this->isNew() && null === $this->collCcSchedules) {
// return empty collection
$this->initCcSchedules();
} else {
$collCcSchedules = CcScheduleQuery::create(null, $criteria)
->filterByCcShowInstances($this)
->find($con);
if (null !== $criteria) {
return $collCcSchedules;
}
$this->collCcSchedules = $collCcSchedules;
}
}
return $this->collCcSchedules;
}
/**
* Returns the number of related CcSchedule objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
* @return int Count of related CcSchedule objects.
* @throws PropelException
*/
public function countCcSchedules(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
if(null === $this->collCcSchedules || null !== $criteria) {
if ($this->isNew() && null === $this->collCcSchedules) {
return 0;
} else {
$query = CcScheduleQuery::create(null, $criteria);
if($distinct) {
$query->distinct();
}
return $query
->filterByCcShowInstances($this)
->count($con);
}
} else {
return count($this->collCcSchedules);
}
}
/**
* Method called to associate a CcSchedule object to this object
* through the CcSchedule foreign key attribute.
*
* @param CcSchedule $l CcSchedule
* @return void
* @throws PropelException
*/
public function addCcSchedule(CcSchedule $l)
{
if ($this->collCcSchedules === null) {
$this->initCcSchedules();
}
if (!$this->collCcSchedules->contains($l)) { // only add it if the **same** object is not already associated
$this->collCcSchedules[]= $l;
$l->setCcShowInstances($this);
}
}
/** /**
* Clears the current object and sets all attributes to their default values * Clears the current object and sets all attributes to their default values
*/ */
@ -1133,9 +1271,15 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
} }
} }
if ($this->collCcSchedules) {
foreach ((array) $this->collCcSchedules as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep) } // if ($deep)
$this->collCcShowSchedules = null; $this->collCcShowSchedules = null;
$this->collCcSchedules = null;
$this->aCcShow = null; $this->aCcShow = null;
} }

View file

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

View file

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

View file

@ -221,7 +221,7 @@
</index> </index>
</table> </table>
<table name="cc_schedule" phpName="CcSchedule"> <table name="cc_schedule" phpName="CcSchedule">
<column name="id" phpName="DbId" type="BIGINT" primaryKey="true" required="true"/> <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
<column name="playlist_id" phpName="DbPlaylistId" type="INTEGER" required="true"/> <column name="playlist_id" phpName="DbPlaylistId" type="INTEGER" required="true"/>
<column name="starts" phpName="DbStarts" type="TIMESTAMP" required="true"/> <column name="starts" phpName="DbStarts" type="TIMESTAMP" required="true"/>
<column name="ends" phpName="DbEnds" type="TIMESTAMP" required="true"/> <column name="ends" phpName="DbEnds" type="TIMESTAMP" required="true"/>
@ -234,6 +234,10 @@
<column name="cue_out" phpName="DbCueOut" type="TIME" required="false" defaultValue="00:00:00"/> <column name="cue_out" phpName="DbCueOut" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="schedule_group_played" phpName="DbScheduleGroupPlayed" type="BOOLEAN" required="false" defaultValue="0"/> <column name="schedule_group_played" phpName="DbScheduleGroupPlayed" type="BOOLEAN" required="false" defaultValue="0"/>
<column name="media_item_played" phpName="DbMediaItemPlayed" type="BOOLEAN" required="false" defaultValue="0"/> <column name="media_item_played" phpName="DbMediaItemPlayed" type="BOOLEAN" required="false" defaultValue="0"/>
<column name="instance_id" phpName="DbInstanceId" type="INTEGER" required="true"/>
<foreign-key foreignTable="cc_show_instances" name="cc_show_inst_fkey" onDelete="CASCADE">
<reference local="instance_id" foreign="id"/>
</foreign-key>
</table> </table>
<table name="cc_sess" phpName="CcSess"> <table name="cc_sess" phpName="CcSess">
<column name="sessid" phpName="Sessid" type="CHAR" size="32" primaryKey="true" required="true"/> <column name="sessid" phpName="Sessid" type="CHAR" size="32" primaryKey="true" required="true"/>

View file

@ -338,7 +338,7 @@ DROP TABLE "cc_schedule" CASCADE;
CREATE TABLE "cc_schedule" CREATE TABLE "cc_schedule"
( (
"id" INT8 NOT NULL, "id" serial NOT NULL,
"playlist_id" INTEGER NOT NULL, "playlist_id" INTEGER NOT NULL,
"starts" TIMESTAMP NOT NULL, "starts" TIMESTAMP NOT NULL,
"ends" TIMESTAMP NOT NULL, "ends" TIMESTAMP NOT NULL,
@ -351,6 +351,7 @@ CREATE TABLE "cc_schedule"
"cue_out" TIME default '00:00:00', "cue_out" TIME default '00:00:00',
"schedule_group_played" BOOLEAN default 'f', "schedule_group_played" BOOLEAN default 'f',
"media_item_played" BOOLEAN default 'f', "media_item_played" BOOLEAN default 'f',
"instance_id" INTEGER NOT NULL,
PRIMARY KEY ("id") PRIMARY KEY ("id")
); );
@ -501,4 +502,6 @@ ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_playlist_i
ALTER TABLE "cc_pref" ADD CONSTRAINT "cc_pref_subjid_fkey" FOREIGN KEY ("subjid") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE; ALTER TABLE "cc_pref" ADD CONSTRAINT "cc_pref_subjid_fkey" FOREIGN KEY ("subjid") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_inst_fkey" FOREIGN KEY ("instance_id") REFERENCES "cc_show_instances" ("id") ON DELETE CASCADE;
ALTER TABLE "cc_sess" ADD CONSTRAINT "cc_sess_userid_fkey" FOREIGN KEY ("userid") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE; ALTER TABLE "cc_sess" ADD CONSTRAINT "cc_sess_userid_fkey" FOREIGN KEY ("userid") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;