adding an instance id to the playout history table.

This commit is contained in:
Naomi 2013-08-28 17:15:36 -04:00
parent 5fbc3867f8
commit 5aa983be36
12 changed files with 917 additions and 14 deletions

View file

@ -42,6 +42,7 @@ class CcPlayoutHistoryTableMap extends TableMap {
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
$this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
$this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', false, null, null);
// validators
} // initialize()
@ -51,6 +52,7 @@ class CcPlayoutHistoryTableMap extends TableMap {
public function buildRelations()
{
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaData', RelationMap::ONE_TO_MANY, array('id' => 'history_id', ), 'CASCADE', null);
} // buildRelations()

View file

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

View file

@ -5292,6 +5292,31 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
}
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this CcFiles is new, it will return
* an empty collection; or if this CcFiles has previously
* been saved, it will retrieve related CcPlayoutHistorys from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in CcFiles.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return PropelCollection|array CcPlayoutHistory[] List of CcPlayoutHistory objects
*/
public function getCcPlayoutHistorysJoinCcShowInstances($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = CcPlayoutHistoryQuery::create(null, $criteria);
$query->joinWith('CcShowInstances', $join_behavior);
return $this->getCcPlayoutHistorys($query, $con);
}
/**
* Clears the current object and sets all attributes to their default values
*/

View file

@ -48,11 +48,22 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
*/
protected $ends;
/**
* The value for the instance_id field.
* @var int
*/
protected $instance_id;
/**
* @var CcFiles
*/
protected $aCcFiles;
/**
* @var CcShowInstances
*/
protected $aCcShowInstances;
/**
* @var array CcPlayoutHistoryMetaData[] Collection to store aggregation of CcPlayoutHistoryMetaData objects.
*/
@ -158,6 +169,16 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
}
}
/**
* Get the [instance_id] column value.
*
* @return int
*/
public function getDbInstanceId()
{
return $this->instance_id;
}
/**
* Set the value of [id] column.
*
@ -300,6 +321,30 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
return $this;
} // setDbEnds()
/**
* Set the value of [instance_id] column.
*
* @param int $v new value
* @return CcPlayoutHistory 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[] = CcPlayoutHistoryPeer::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.
*
@ -336,6 +381,7 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
$this->file_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
$this->starts = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->ends = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->instance_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
$this->resetModified();
$this->setNew(false);
@ -344,7 +390,7 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
$this->ensureConsistency();
}
return $startcol + 4; // 4 = CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 5; // 5 = CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcPlayoutHistory object", $e);
@ -370,6 +416,9 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
if ($this->aCcFiles !== null && $this->file_id !== $this->aCcFiles->getDbId()) {
$this->aCcFiles = null;
}
if ($this->aCcShowInstances !== null && $this->instance_id !== $this->aCcShowInstances->getDbId()) {
$this->aCcShowInstances = null;
}
} // ensureConsistency
/**
@ -410,6 +459,7 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
$this->aCcFiles = null;
$this->aCcShowInstances = null;
$this->collCcPlayoutHistoryMetaDatas = null;
} // if (deep)
@ -534,6 +584,13 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
$this->setCcFiles($this->aCcFiles);
}
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[] = CcPlayoutHistoryPeer::ID;
}
@ -642,6 +699,12 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
}
}
if ($this->aCcShowInstances !== null) {
if (!$this->aCcShowInstances->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aCcShowInstances->getValidationFailures());
}
}
if (($retval = CcPlayoutHistoryPeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval);
@ -701,6 +764,9 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
case 3:
return $this->getDbEnds();
break;
case 4:
return $this->getDbInstanceId();
break;
default:
return null;
break;
@ -729,11 +795,15 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
$keys[1] => $this->getDbFileId(),
$keys[2] => $this->getDbStarts(),
$keys[3] => $this->getDbEnds(),
$keys[4] => $this->getDbInstanceId(),
);
if ($includeForeignObjects) {
if (null !== $this->aCcFiles) {
$result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true);
}
if (null !== $this->aCcShowInstances) {
$result['CcShowInstances'] = $this->aCcShowInstances->toArray($keyType, $includeLazyLoadColumns, true);
}
}
return $result;
}
@ -777,6 +847,9 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
case 3:
$this->setDbEnds($value);
break;
case 4:
$this->setDbInstanceId($value);
break;
} // switch()
}
@ -805,6 +878,7 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
if (array_key_exists($keys[1], $arr)) $this->setDbFileId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDbStarts($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDbEnds($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setDbInstanceId($arr[$keys[4]]);
}
/**
@ -820,6 +894,7 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
if ($this->isColumnModified(CcPlayoutHistoryPeer::FILE_ID)) $criteria->add(CcPlayoutHistoryPeer::FILE_ID, $this->file_id);
if ($this->isColumnModified(CcPlayoutHistoryPeer::STARTS)) $criteria->add(CcPlayoutHistoryPeer::STARTS, $this->starts);
if ($this->isColumnModified(CcPlayoutHistoryPeer::ENDS)) $criteria->add(CcPlayoutHistoryPeer::ENDS, $this->ends);
if ($this->isColumnModified(CcPlayoutHistoryPeer::INSTANCE_ID)) $criteria->add(CcPlayoutHistoryPeer::INSTANCE_ID, $this->instance_id);
return $criteria;
}
@ -884,6 +959,7 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
$copyObj->setDbFileId($this->file_id);
$copyObj->setDbStarts($this->starts);
$copyObj->setDbEnds($this->ends);
$copyObj->setDbInstanceId($this->instance_id);
if ($deepCopy) {
// important: temporarily setNew(false) because this affects the behavior of
@ -990,6 +1066,55 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
return $this->aCcFiles;
}
/**
* Declares an association between this object and a CcShowInstances object.
*
* @param CcShowInstances $v
* @return CcPlayoutHistory 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->addCcPlayoutHistory($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->addCcPlayoutHistorys($this);
*/
}
return $this->aCcShowInstances;
}
/**
* Clears out the collCcPlayoutHistoryMetaDatas collection
*
@ -1108,6 +1233,7 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
$this->file_id = null;
$this->starts = null;
$this->ends = null;
$this->instance_id = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->clearAllReferences();
@ -1137,6 +1263,7 @@ abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
$this->collCcPlayoutHistoryMetaDatas = null;
$this->aCcFiles = null;
$this->aCcShowInstances = null;
}
/**

View file

@ -26,7 +26,7 @@ abstract class BaseCcPlayoutHistoryPeer {
const TM_CLASS = 'CcPlayoutHistoryTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 4;
const NUM_COLUMNS = 5;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@ -43,6 +43,9 @@ abstract class BaseCcPlayoutHistoryPeer {
/** the column name for the ENDS field */
const ENDS = 'cc_playout_history.ENDS';
/** the column name for the INSTANCE_ID field */
const INSTANCE_ID = 'cc_playout_history.INSTANCE_ID';
/**
* An identiy map to hold any loaded instances of CcPlayoutHistory objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
@ -59,12 +62,12 @@ abstract class BaseCcPlayoutHistoryPeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbFileId', 'DbStarts', 'DbEnds', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFileId', 'dbStarts', 'dbEnds', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::FILE_ID, self::STARTS, self::ENDS, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FILE_ID', 'STARTS', 'ENDS', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'file_id', 'starts', 'ends', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbFileId', 'DbStarts', 'DbEnds', 'DbInstanceId', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFileId', 'dbStarts', 'dbEnds', 'dbInstanceId', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::FILE_ID, self::STARTS, self::ENDS, self::INSTANCE_ID, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FILE_ID', 'STARTS', 'ENDS', 'INSTANCE_ID', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'file_id', 'starts', 'ends', 'instance_id', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
@ -74,12 +77,12 @@ abstract class BaseCcPlayoutHistoryPeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbFileId' => 1, 'DbStarts' => 2, 'DbEnds' => 3, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFileId' => 1, 'dbStarts' => 2, 'dbEnds' => 3, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::FILE_ID => 1, self::STARTS => 2, self::ENDS => 3, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FILE_ID' => 1, 'STARTS' => 2, 'ENDS' => 3, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'file_id' => 1, 'starts' => 2, 'ends' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbFileId' => 1, 'DbStarts' => 2, 'DbEnds' => 3, 'DbInstanceId' => 4, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFileId' => 1, 'dbStarts' => 2, 'dbEnds' => 3, 'dbInstanceId' => 4, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::FILE_ID => 1, self::STARTS => 2, self::ENDS => 3, self::INSTANCE_ID => 4, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FILE_ID' => 1, 'STARTS' => 2, 'ENDS' => 3, 'INSTANCE_ID' => 4, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'file_id' => 1, 'starts' => 2, 'ends' => 3, 'instance_id' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
@ -155,11 +158,13 @@ abstract class BaseCcPlayoutHistoryPeer {
$criteria->addSelectColumn(CcPlayoutHistoryPeer::FILE_ID);
$criteria->addSelectColumn(CcPlayoutHistoryPeer::STARTS);
$criteria->addSelectColumn(CcPlayoutHistoryPeer::ENDS);
$criteria->addSelectColumn(CcPlayoutHistoryPeer::INSTANCE_ID);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.FILE_ID');
$criteria->addSelectColumn($alias . '.STARTS');
$criteria->addSelectColumn($alias . '.ENDS');
$criteria->addSelectColumn($alias . '.INSTANCE_ID');
}
}
@ -498,6 +503,56 @@ abstract class BaseCcPlayoutHistoryPeer {
}
/**
* 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(CcPlayoutHistoryPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcPlayoutHistoryPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcPlayoutHistoryPeer::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 CcPlayoutHistory objects pre-filled with their CcFiles objects.
* @param Criteria $criteria
@ -564,6 +619,72 @@ abstract class BaseCcPlayoutHistoryPeer {
}
/**
* Selects a collection of CcPlayoutHistory 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 CcPlayoutHistory 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);
}
CcPlayoutHistoryPeer::addSelectColumns($criteria);
$startcol = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
CcShowInstancesPeer::addSelectColumns($criteria);
$criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcPlayoutHistoryPeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPlayoutHistoryPeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcPlayoutHistoryPeer::addInstanceToPool($obj1, $key1);
} // if $obj1 already loaded
$key2 = 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 (CcPlayoutHistory) to $obj2 (CcShowInstances)
$obj2->addCcPlayoutHistory($obj1);
} // if joined row was not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
/**
* Returns the number of rows matching criteria, joining all related tables
*
@ -602,6 +723,8 @@ abstract class BaseCcPlayoutHistoryPeer {
$criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
$criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
@ -638,8 +761,13 @@ abstract class BaseCcPlayoutHistoryPeer {
CcFilesPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
CcShowInstancesPeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
$criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
@ -675,6 +803,270 @@ abstract class BaseCcPlayoutHistoryPeer {
$obj2->addCcPlayoutHistory($obj1);
} // if joined row not null
// Add objects for joined CcShowInstances rows
$key3 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol3);
if ($key3 !== null) {
$obj3 = CcShowInstancesPeer::getInstanceFromPool($key3);
if (!$obj3) {
$cls = CcShowInstancesPeer::getOMClass(false);
$obj3 = new $cls();
$obj3->hydrate($row, $startcol3);
CcShowInstancesPeer::addInstanceToPool($obj3, $key3);
} // if obj3 loaded
// Add the $obj1 (CcPlayoutHistory) to the collection in $obj3 (CcShowInstances)
$obj3->addCcPlayoutHistory($obj1);
} // if joined row not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
/**
* Returns the number of rows matching criteria, joining the related CcFiles table
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows.
*/
public static function doCountJoinAllExceptCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CcPlayoutHistoryPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcPlayoutHistoryPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcPlayoutHistoryPeer::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;
}
/**
* 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 doCountJoinAllExceptCcShowInstances(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CcPlayoutHistoryPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcPlayoutHistoryPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects a collection of CcPlayoutHistory objects pre-filled with all related objects except CcFiles.
*
* @param Criteria $criteria
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return array Array of CcPlayoutHistory objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinAllExceptCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
// Set the correct dbName if it has not been overridden
// $criteria->getDbName() will return the same object if not set to another value
// so == check is okay and faster
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
}
CcPlayoutHistoryPeer::addSelectColumns($criteria);
$startcol2 = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
CcShowInstancesPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcPlayoutHistoryPeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPlayoutHistoryPeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcPlayoutHistoryPeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded
// Add objects for joined 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 already loaded
// Add the $obj1 (CcPlayoutHistory) to the collection in $obj2 (CcShowInstances)
$obj2->addCcPlayoutHistory($obj1);
} // if joined row is not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
/**
* Selects a collection of CcPlayoutHistory objects pre-filled with all related objects except CcShowInstances.
*
* @param Criteria $criteria
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return array Array of CcPlayoutHistory objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinAllExceptCcShowInstances(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
// Set the correct dbName if it has not been overridden
// $criteria->getDbName() will return the same object if not set to another value
// so == check is okay and faster
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
}
CcPlayoutHistoryPeer::addSelectColumns($criteria);
$startcol2 = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
CcFilesPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcPlayoutHistoryPeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcPlayoutHistoryPeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcPlayoutHistoryPeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded
// Add objects for joined CcFiles rows
$key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = CcFilesPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcFilesPeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
CcFilesPeer::addInstanceToPool($obj2, $key2);
} // if $obj2 already loaded
// Add the $obj1 (CcPlayoutHistory) to the collection in $obj2 (CcFiles)
$obj2->addCcPlayoutHistory($obj1);
} // if joined row is not null
$results[] = $obj1;
}
$stmt->closeCursor();

View file

@ -10,11 +10,13 @@
* @method CcPlayoutHistoryQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
* @method CcPlayoutHistoryQuery orderByDbStarts($order = Criteria::ASC) Order by the starts column
* @method CcPlayoutHistoryQuery orderByDbEnds($order = Criteria::ASC) Order by the ends column
* @method CcPlayoutHistoryQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
*
* @method CcPlayoutHistoryQuery groupByDbId() Group by the id column
* @method CcPlayoutHistoryQuery groupByDbFileId() Group by the file_id column
* @method CcPlayoutHistoryQuery groupByDbStarts() Group by the starts column
* @method CcPlayoutHistoryQuery groupByDbEnds() Group by the ends column
* @method CcPlayoutHistoryQuery groupByDbInstanceId() Group by the instance_id column
*
* @method CcPlayoutHistoryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcPlayoutHistoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@ -24,6 +26,10 @@
* @method CcPlayoutHistoryQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
* @method CcPlayoutHistoryQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
*
* @method CcPlayoutHistoryQuery leftJoinCcShowInstances($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowInstances relation
* @method CcPlayoutHistoryQuery rightJoinCcShowInstances($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
* @method CcPlayoutHistoryQuery innerJoinCcShowInstances($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstances relation
*
* @method CcPlayoutHistoryQuery leftJoinCcPlayoutHistoryMetaData($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistoryMetaData relation
* @method CcPlayoutHistoryQuery rightJoinCcPlayoutHistoryMetaData($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistoryMetaData relation
* @method CcPlayoutHistoryQuery innerJoinCcPlayoutHistoryMetaData($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistoryMetaData relation
@ -35,11 +41,13 @@
* @method CcPlayoutHistory findOneByDbFileId(int $file_id) Return the first CcPlayoutHistory filtered by the file_id column
* @method CcPlayoutHistory findOneByDbStarts(string $starts) Return the first CcPlayoutHistory filtered by the starts column
* @method CcPlayoutHistory findOneByDbEnds(string $ends) Return the first CcPlayoutHistory filtered by the ends column
* @method CcPlayoutHistory findOneByDbInstanceId(int $instance_id) Return the first CcPlayoutHistory filtered by the instance_id column
*
* @method array findByDbId(int $id) Return CcPlayoutHistory objects filtered by the id column
* @method array findByDbFileId(int $file_id) Return CcPlayoutHistory objects filtered by the file_id column
* @method array findByDbStarts(string $starts) Return CcPlayoutHistory objects filtered by the starts column
* @method array findByDbEnds(string $ends) Return CcPlayoutHistory objects filtered by the ends column
* @method array findByDbInstanceId(int $instance_id) Return CcPlayoutHistory objects filtered by the instance_id column
*
* @package propel.generator.airtime.om
*/
@ -259,6 +267,37 @@ abstract class BaseCcPlayoutHistoryQuery extends ModelCriteria
return $this->addUsingAlias(CcPlayoutHistoryPeer::ENDS, $dbEnds, $comparison);
}
/**
* Filter the query on the instance_id column
*
* @param int|array $dbInstanceId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlayoutHistoryQuery The current query, for fluid interface
*/
public function filterByDbInstanceId($dbInstanceId = null, $comparison = null)
{
if (is_array($dbInstanceId)) {
$useMinMax = false;
if (isset($dbInstanceId['min'])) {
$this->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbInstanceId['max'])) {
$this->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId, $comparison);
}
/**
* Filter the query by a related CcFiles object
*
@ -323,6 +362,70 @@ abstract class BaseCcPlayoutHistoryQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
}
/**
* Filter the query by a related CcShowInstances object
*
* @param CcShowInstances $ccShowInstances the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcPlayoutHistoryQuery The current query, for fluid interface
*/
public function filterByCcShowInstances($ccShowInstances, $comparison = null)
{
return $this
->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $ccShowInstances->getDbId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcShowInstances relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcPlayoutHistoryQuery The current query, for fluid interface
*/
public function joinCcShowInstances($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcShowInstances');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CcShowInstances');
}
return $this;
}
/**
* Use the CcShowInstances relation CcShowInstances object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcShowInstancesQuery A secondary query class using the current class as primary query
*/
public function useCcShowInstancesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcShowInstances($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery');
}
/**
* Filter the query by a related CcPlayoutHistoryMetaData object
*

View file

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

View file

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

View file

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

View file

@ -423,6 +423,11 @@ class Application_Service_HistoryService
);
}
public function getShowList($startDT, $endDT, $opts)
{
}
public function insertPlayedItem($schedId) {
$this->con->beginTransaction();
@ -447,6 +452,7 @@ class Application_Service_HistoryService
$history->setDbFileId($fileId);
$history->setDbStarts($item->getDbStarts(null));
$history->setDbEnds($item->getDbEnds(null));
$history->setDbInstanceId($item->getDbInstanceId());
foreach ($metadata as $key => $val) {
$meta = new CcPlayoutHistoryMetaData();

View file

@ -484,9 +484,13 @@
<column name="file_id" phpName="DbFileId" type="INTEGER" required="false" />
<column name="starts" phpName="DbStarts" type="TIMESTAMP" required="true"/>
<column name="ends" phpName="DbEnds" type="TIMESTAMP" required="true"/>
<column name="instance_id" phpName="DbInstanceId" type="INTEGER" required="false"/>
<foreign-key foreignTable="cc_files" name="cc_playout_history_file_tag_fkey" onDelete="CASCADE">
<reference local="file_id" foreign="id"/>
</foreign-key>
<foreign-key foreignTable="cc_show_instances" name="cc_his_item_inst_fkey" onDelete="CASCADE">
<reference local="instance_id" foreign="id"/>
</foreign-key>
</table>
<table name="cc_playout_history_metadata" phpName="CcPlayoutHistoryMetaData">
<column name="id" phpName="DbId" primaryKey="true" type="INTEGER" autoIncrement="true" required="true" />

View file

@ -766,6 +766,7 @@ CREATE TABLE "cc_playout_history"
"file_id" INTEGER,
"starts" TIMESTAMP NOT NULL,
"ends" TIMESTAMP NOT NULL,
"instance_id" INTEGER,
PRIMARY KEY ("id")
);
@ -893,6 +894,8 @@ ALTER TABLE "cc_listener_count" ADD CONSTRAINT "cc_mount_name_inst_fkey" FOREIGN
ALTER TABLE "cc_playout_history" ADD CONSTRAINT "cc_playout_history_file_tag_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE;
ALTER TABLE "cc_playout_history" ADD CONSTRAINT "cc_his_item_inst_fkey" FOREIGN KEY ("instance_id") REFERENCES "cc_show_instances" ("id") ON DELETE CASCADE;
ALTER TABLE "cc_playout_history_metadata" ADD CONSTRAINT "cc_playout_history_metadata_entry_fkey" FOREIGN KEY ("history_id") REFERENCES "cc_playout_history" ("id") ON DELETE CASCADE;
ALTER TABLE "cc_playout_history_template_field" ADD CONSTRAINT "cc_playout_history_template_template_fkey" FOREIGN KEY ("template_id") REFERENCES "cc_playout_history_template" ("id") ON DELETE CASCADE;