CC-2559 : Remove files from cc_schedule that are no longer watched
adding foreign key to file_id column of cc_schedule table.
This commit is contained in:
parent
4588ebd105
commit
b7819211ac
11 changed files with 808 additions and 2 deletions
|
@ -105,6 +105,7 @@ class CcFilesTableMap extends TableMap {
|
||||||
$this->addRelation('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), 'CASCADE', null);
|
$this->addRelation('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), 'CASCADE', null);
|
||||||
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
|
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
|
||||||
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
|
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
|
||||||
|
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
} // CcFilesTableMap
|
} // CcFilesTableMap
|
||||||
|
|
|
@ -43,7 +43,7 @@ class CcScheduleTableMap extends TableMap {
|
||||||
$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);
|
||||||
$this->addColumn('GROUP_ID', 'DbGroupId', 'INTEGER', false, null, null);
|
$this->addColumn('GROUP_ID', 'DbGroupId', 'INTEGER', false, null, null);
|
||||||
$this->addColumn('FILE_ID', 'DbFileId', 'INTEGER', false, null, null);
|
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
|
||||||
$this->addColumn('CLIP_LENGTH', 'DbClipLength', 'TIME', false, null, '00:00:00');
|
$this->addColumn('CLIP_LENGTH', 'DbClipLength', 'TIME', false, null, '00:00:00');
|
||||||
$this->addColumn('FADE_IN', 'DbFadeIn', 'TIME', false, null, '00:00:00');
|
$this->addColumn('FADE_IN', 'DbFadeIn', 'TIME', false, null, '00:00:00');
|
||||||
$this->addColumn('FADE_OUT', 'DbFadeOut', 'TIME', false, null, '00:00:00');
|
$this->addColumn('FADE_OUT', 'DbFadeOut', 'TIME', false, null, '00:00:00');
|
||||||
|
@ -61,6 +61,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);
|
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null);
|
||||||
|
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -380,6 +380,11 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
*/
|
*/
|
||||||
protected $collCcPlaylistcontentss;
|
protected $collCcPlaylistcontentss;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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.
|
||||||
|
@ -2375,6 +2380,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
|
|
||||||
$this->collCcPlaylistcontentss = null;
|
$this->collCcPlaylistcontentss = null;
|
||||||
|
|
||||||
|
$this->collCcSchedules = null;
|
||||||
|
|
||||||
} // if (deep)
|
} // if (deep)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2543,6 +2550,14 @@ abstract class BaseCcFiles 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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2648,6 +2663,14 @@ abstract class BaseCcFiles 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;
|
||||||
}
|
}
|
||||||
|
@ -3407,6 +3430,12 @@ abstract class BaseCcFiles 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)
|
||||||
|
|
||||||
|
|
||||||
|
@ -3843,6 +3872,140 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
||||||
return $this->getCcPlaylistcontentss($query, $con);
|
return $this->getCcPlaylistcontentss($query, $con);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 CcFiles is new, it will return
|
||||||
|
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||||
|
* @param PropelPDO $con optional connection object
|
||||||
|
* @return PropelCollection|array 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)
|
||||||
|
->filterByCcFiles($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
|
||||||
|
->filterByCcFiles($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->setCcFiles($this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this collection has already been initialized with
|
||||||
|
* an identical criteria, it returns the collection.
|
||||||
|
* Otherwise if this CcFiles is new, it will return
|
||||||
|
* an empty collection; or if this CcFiles has previously
|
||||||
|
* been saved, it will retrieve related CcSchedules 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 CcSchedule[] List of CcSchedule objects
|
||||||
|
*/
|
||||||
|
public function getCcSchedulesJoinCcShowInstances($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$query = CcScheduleQuery::create(null, $criteria);
|
||||||
|
$query->joinWith('CcShowInstances', $join_behavior);
|
||||||
|
|
||||||
|
return $this->getCcSchedules($query, $con);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the current object and sets all attributes to their default values
|
* Clears the current object and sets all attributes to their default values
|
||||||
*/
|
*/
|
||||||
|
@ -3934,10 +4097,16 @@ abstract class BaseCcFiles 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->collCcShowInstancess = null;
|
$this->collCcShowInstancess = null;
|
||||||
$this->collCcPlaylistcontentss = null;
|
$this->collCcPlaylistcontentss = null;
|
||||||
|
$this->collCcSchedules = null;
|
||||||
$this->aCcSubjs = null;
|
$this->aCcSubjs = null;
|
||||||
$this->aCcMusicDirs = null;
|
$this->aCcMusicDirs = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -614,6 +614,9 @@ abstract class BaseCcFilesPeer {
|
||||||
// Invalidate objects in CcPlaylistcontentsPeer instance pool,
|
// Invalidate objects in CcPlaylistcontentsPeer 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.
|
||||||
CcPlaylistcontentsPeer::clearInstancePool();
|
CcPlaylistcontentsPeer::clearInstancePool();
|
||||||
|
// Invalidate objects in CcSchedulePeer instance pool,
|
||||||
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
|
CcSchedulePeer::clearInstancePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -138,6 +138,10 @@
|
||||||
* @method CcFilesQuery rightJoinCcPlaylistcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
|
* @method CcFilesQuery rightJoinCcPlaylistcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
|
||||||
* @method CcFilesQuery innerJoinCcPlaylistcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
|
* @method CcFilesQuery innerJoinCcPlaylistcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
|
||||||
*
|
*
|
||||||
|
* @method CcFilesQuery leftJoinCcSchedule($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSchedule relation
|
||||||
|
* @method CcFilesQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSchedule relation
|
||||||
|
* @method CcFilesQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation
|
||||||
|
*
|
||||||
* @method CcFiles findOne(PropelPDO $con = null) Return the first CcFiles matching the query
|
* @method CcFiles findOne(PropelPDO $con = null) Return the first CcFiles matching the query
|
||||||
* @method CcFiles findOneOrCreate(PropelPDO $con = null) Return the first CcFiles matching the query, or a new CcFiles object populated from the query conditions when no match is found
|
* @method CcFiles findOneOrCreate(PropelPDO $con = null) Return the first CcFiles matching the query, or a new CcFiles object populated from the query conditions when no match is found
|
||||||
*
|
*
|
||||||
|
@ -1885,6 +1889,70 @@ abstract class BaseCcFilesQuery extends ModelCriteria
|
||||||
->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcontents', 'CcPlaylistcontentsQuery');
|
->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcontents', 'CcPlaylistcontentsQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 CcFilesQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCcSchedule($ccSchedule, $comparison = null)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CcFilesPeer::ID, $ccSchedule->getDbFileId(), $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 CcFilesQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCcSchedule($relationAlias = '', $joinType = Criteria::LEFT_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::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCcSchedule($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude object from result
|
* Exclude object from result
|
||||||
*
|
*
|
||||||
|
|
|
@ -120,6 +120,11 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
*/
|
*/
|
||||||
protected $aCcShowInstances;
|
protected $aCcShowInstances;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var CcFiles
|
||||||
|
*/
|
||||||
|
protected $aCcFiles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
@ -640,6 +645,10 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
$this->modifiedColumns[] = CcSchedulePeer::FILE_ID;
|
$this->modifiedColumns[] = CcSchedulePeer::FILE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->aCcFiles !== null && $this->aCcFiles->getDbId() !== $v) {
|
||||||
|
$this->aCcFiles = null;
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
} // setDbFileId()
|
} // setDbFileId()
|
||||||
|
|
||||||
|
@ -1062,6 +1071,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
public function ensureConsistency()
|
public function ensureConsistency()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if ($this->aCcFiles !== null && $this->file_id !== $this->aCcFiles->getDbId()) {
|
||||||
|
$this->aCcFiles = null;
|
||||||
|
}
|
||||||
if ($this->aCcShowInstances !== null && $this->instance_id !== $this->aCcShowInstances->getDbId()) {
|
if ($this->aCcShowInstances !== null && $this->instance_id !== $this->aCcShowInstances->getDbId()) {
|
||||||
$this->aCcShowInstances = null;
|
$this->aCcShowInstances = null;
|
||||||
}
|
}
|
||||||
|
@ -1105,6 +1117,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;
|
$this->aCcShowInstances = null;
|
||||||
|
$this->aCcFiles = null;
|
||||||
} // if (deep)
|
} // if (deep)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1229,6 +1242,13 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
$this->setCcShowInstances($this->aCcShowInstances);
|
$this->setCcShowInstances($this->aCcShowInstances);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->aCcFiles !== null) {
|
||||||
|
if ($this->aCcFiles->isModified() || $this->aCcFiles->isNew()) {
|
||||||
|
$affectedRows += $this->aCcFiles->save($con);
|
||||||
|
}
|
||||||
|
$this->setCcFiles($this->aCcFiles);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->isNew() ) {
|
if ($this->isNew() ) {
|
||||||
$this->modifiedColumns[] = CcSchedulePeer::ID;
|
$this->modifiedColumns[] = CcSchedulePeer::ID;
|
||||||
}
|
}
|
||||||
|
@ -1329,6 +1349,12 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->aCcFiles !== null) {
|
||||||
|
if (!$this->aCcFiles->validate($columns)) {
|
||||||
|
$failureMap = array_merge($failureMap, $this->aCcFiles->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);
|
||||||
|
@ -1453,6 +1479,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
if (null !== $this->aCcShowInstances) {
|
if (null !== $this->aCcShowInstances) {
|
||||||
$result['CcShowInstances'] = $this->aCcShowInstances->toArray($keyType, $includeLazyLoadColumns, true);
|
$result['CcShowInstances'] = $this->aCcShowInstances->toArray($keyType, $includeLazyLoadColumns, true);
|
||||||
}
|
}
|
||||||
|
if (null !== $this->aCcFiles) {
|
||||||
|
$result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -1759,6 +1788,55 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
return $this->aCcShowInstances;
|
return $this->aCcShowInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Declares an association between this object and a CcFiles object.
|
||||||
|
*
|
||||||
|
* @param CcFiles $v
|
||||||
|
* @return CcSchedule The current object (for fluent API support)
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function setCcFiles(CcFiles $v = null)
|
||||||
|
{
|
||||||
|
if ($v === null) {
|
||||||
|
$this->setDbFileId(NULL);
|
||||||
|
} else {
|
||||||
|
$this->setDbFileId($v->getDbId());
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->aCcFiles = $v;
|
||||||
|
|
||||||
|
// Add binding for other direction of this n:n relationship.
|
||||||
|
// If this object has already been added to the CcFiles object, it will not be re-added.
|
||||||
|
if ($v !== null) {
|
||||||
|
$v->addCcSchedule($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the associated CcFiles object
|
||||||
|
*
|
||||||
|
* @param PropelPDO Optional Connection object.
|
||||||
|
* @return CcFiles The associated CcFiles object.
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function getCcFiles(PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
if ($this->aCcFiles === null && ($this->file_id !== null)) {
|
||||||
|
$this->aCcFiles = CcFilesQuery::create()->findPk($this->file_id, $con);
|
||||||
|
/* The following can be used additionally to
|
||||||
|
guarantee the related object contains a reference
|
||||||
|
to this object. This level of coupling may, however, be
|
||||||
|
undesirable since it could result in an only partially populated collection
|
||||||
|
in the referenced object.
|
||||||
|
$this->aCcFiles->addCcSchedules($this);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
return $this->aCcFiles;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the current object and sets all attributes to their default values
|
* Clears the current object and sets all attributes to their default values
|
||||||
*/
|
*/
|
||||||
|
@ -1802,6 +1880,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
} // if ($deep)
|
} // if ($deep)
|
||||||
|
|
||||||
$this->aCcShowInstances = null;
|
$this->aCcShowInstances = null;
|
||||||
|
$this->aCcFiles = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// aggregate_column_relation behavior
|
// aggregate_column_relation behavior
|
||||||
|
|
|
@ -545,6 +545,56 @@ abstract class BaseCcSchedulePeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of rows matching criteria, joining the related CcFiles table
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||||
|
* @return int Number of matching rows.
|
||||||
|
*/
|
||||||
|
public static function doCountJoinCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
// we're going to modify criteria, so copy it first
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// We need to set the primary table name, since in the case that there are no WHERE columns
|
||||||
|
// it will be impossible for the BasePeer::createSelectSql() method to determine which
|
||||||
|
// tables go into the FROM clause.
|
||||||
|
$criteria->setPrimaryTableName(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::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 CcSchedule objects pre-filled with their CcShowInstances objects.
|
* Selects a collection of CcSchedule objects pre-filled with their CcShowInstances objects.
|
||||||
* @param Criteria $criteria
|
* @param Criteria $criteria
|
||||||
|
@ -611,6 +661,72 @@ abstract class BaseCcSchedulePeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects a collection of CcSchedule objects pre-filled with their CcFiles objects.
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||||
|
* @return array Array of CcSchedule objects.
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function doSelectJoinCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// Set the correct dbName if it has not been overridden
|
||||||
|
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||||
|
$criteria->setDbName(self::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
CcSchedulePeer::addSelectColumns($criteria);
|
||||||
|
$startcol = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
CcFilesPeer::addSelectColumns($criteria);
|
||||||
|
|
||||||
|
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::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 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||||
|
if ($key2 !== null) {
|
||||||
|
$obj2 = CcFilesPeer::getInstanceFromPool($key2);
|
||||||
|
if (!$obj2) {
|
||||||
|
|
||||||
|
$cls = CcFilesPeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj2 = new $cls();
|
||||||
|
$obj2->hydrate($row, $startcol);
|
||||||
|
CcFilesPeer::addInstanceToPool($obj2, $key2);
|
||||||
|
} // if obj2 already loaded
|
||||||
|
|
||||||
|
// Add the $obj1 (CcSchedule) to $obj2 (CcFiles)
|
||||||
|
$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
|
* Returns the number of rows matching criteria, joining all related tables
|
||||||
*
|
*
|
||||||
|
@ -649,6 +765,8 @@ abstract class BaseCcSchedulePeer {
|
||||||
|
|
||||||
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
|
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
|
||||||
|
|
||||||
$stmt = BasePeer::doCount($criteria, $con);
|
$stmt = BasePeer::doCount($criteria, $con);
|
||||||
|
|
||||||
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
@ -685,8 +803,13 @@ abstract class BaseCcSchedulePeer {
|
||||||
CcShowInstancesPeer::addSelectColumns($criteria);
|
CcShowInstancesPeer::addSelectColumns($criteria);
|
||||||
$startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
|
$startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
|
CcFilesPeer::addSelectColumns($criteria);
|
||||||
|
$startcol4 = $startcol3 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
|
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
|
||||||
|
|
||||||
$stmt = BasePeer::doSelect($criteria, $con);
|
$stmt = BasePeer::doSelect($criteria, $con);
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
|
@ -722,6 +845,270 @@ abstract class BaseCcSchedulePeer {
|
||||||
$obj2->addCcSchedule($obj1);
|
$obj2->addCcSchedule($obj1);
|
||||||
} // if joined row not null
|
} // if joined row not null
|
||||||
|
|
||||||
|
// Add objects for joined CcFiles rows
|
||||||
|
|
||||||
|
$key3 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol3);
|
||||||
|
if ($key3 !== null) {
|
||||||
|
$obj3 = CcFilesPeer::getInstanceFromPool($key3);
|
||||||
|
if (!$obj3) {
|
||||||
|
|
||||||
|
$cls = CcFilesPeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj3 = new $cls();
|
||||||
|
$obj3->hydrate($row, $startcol3);
|
||||||
|
CcFilesPeer::addInstanceToPool($obj3, $key3);
|
||||||
|
} // if obj3 loaded
|
||||||
|
|
||||||
|
// Add the $obj1 (CcSchedule) to the collection in $obj3 (CcFiles)
|
||||||
|
$obj3->addCcSchedule($obj1);
|
||||||
|
} // if joined row not null
|
||||||
|
|
||||||
|
$results[] = $obj1;
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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(CcSchedulePeer::TABLE_NAME);
|
||||||
|
|
||||||
|
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||||
|
$criteria->setDistinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$criteria->hasSelectClause()) {
|
||||||
|
CcSchedulePeer::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(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->addJoin(CcSchedulePeer::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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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(CcSchedulePeer::TABLE_NAME);
|
||||||
|
|
||||||
|
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||||
|
$criteria->setDistinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$criteria->hasSelectClause()) {
|
||||||
|
CcSchedulePeer::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(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 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 CcSchedule 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
CcSchedulePeer::addSelectColumns($criteria);
|
||||||
|
$startcol2 = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
|
CcFilesPeer::addSelectColumns($criteria);
|
||||||
|
$startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
|
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::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 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 (CcSchedule) to the collection in $obj2 (CcFiles)
|
||||||
|
$obj2->addCcSchedule($obj1);
|
||||||
|
|
||||||
|
} // if joined row is not null
|
||||||
|
|
||||||
|
$results[] = $obj1;
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects a collection of CcSchedule 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 CcSchedule 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 already loaded
|
||||||
|
|
||||||
|
// Add the $obj1 (CcSchedule) to the collection in $obj2 (CcShowInstances)
|
||||||
|
$obj2->addCcSchedule($obj1);
|
||||||
|
|
||||||
|
} // if joined row is not null
|
||||||
|
|
||||||
$results[] = $obj1;
|
$results[] = $obj1;
|
||||||
}
|
}
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
* @method CcScheduleQuery rightJoinCcShowInstances($relationAlias = '') Adds a RIGHT 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 CcScheduleQuery innerJoinCcShowInstances($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstances relation
|
||||||
*
|
*
|
||||||
|
* @method CcScheduleQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation
|
||||||
|
* @method CcScheduleQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
|
||||||
|
* @method CcScheduleQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles 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
|
||||||
*
|
*
|
||||||
|
@ -641,6 +645,70 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
|
||||||
->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery');
|
->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related CcFiles object
|
||||||
|
*
|
||||||
|
* @param CcFiles $ccFiles the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CcScheduleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCcFiles($ccFiles, $comparison = null)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CcSchedulePeer::FILE_ID, $ccFiles->getDbId(), $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the CcFiles relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return CcScheduleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('CcFiles');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'CcFiles');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the CcFiles relation CcFiles object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return CcFilesQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCcFiles($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude object from result
|
* Exclude object from result
|
||||||
*
|
*
|
||||||
|
|
|
@ -1809,6 +1809,31 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 CcSchedules 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 CcSchedule[] List of CcSchedule objects
|
||||||
|
*/
|
||||||
|
public function getCcSchedulesJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$query = CcScheduleQuery::create(null, $criteria);
|
||||||
|
$query->joinWith('CcFiles', $join_behavior);
|
||||||
|
|
||||||
|
return $this->getCcSchedules($query, $con);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the current object and sets all attributes to their default values
|
* Clears the current object and sets all attributes to their default values
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -263,6 +263,9 @@
|
||||||
<foreign-key foreignTable="cc_show_instances" name="cc_show_inst_fkey" onDelete="CASCADE">
|
<foreign-key foreignTable="cc_show_instances" name="cc_show_inst_fkey" onDelete="CASCADE">
|
||||||
<reference local="instance_id" foreign="id"/>
|
<reference local="instance_id" foreign="id"/>
|
||||||
</foreign-key>
|
</foreign-key>
|
||||||
|
<foreign-key foreignTable="cc_files" name="cc_show_file_fkey" onDelete="CASCADE">
|
||||||
|
<reference local="file_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"/>
|
||||||
|
|
|
@ -493,4 +493,6 @@ ALTER TABLE "cc_pref" ADD CONSTRAINT "cc_pref_subjid_fkey" FOREIGN KEY ("subjid"
|
||||||
|
|
||||||
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_schedule" ADD CONSTRAINT "cc_show_inst_fkey" FOREIGN KEY ("instance_id") REFERENCES "cc_show_instances" ("id") ON DELETE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_file_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue