CC-1665: Scheduled stream rebroadcasting and recording
-getting closer to being able to schedule a webstream
This commit is contained in:
parent
3735579378
commit
c90495d2d3
16 changed files with 1073 additions and 77 deletions
|
@ -73,6 +73,11 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $utime;
|
||||
|
||||
/**
|
||||
* @var array CcSchedule[] Collection to store aggregation of CcSchedule objects.
|
||||
*/
|
||||
protected $collCcSchedules;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
|
@ -566,6 +571,8 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
|
|||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->collCcSchedules = null;
|
||||
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
|
@ -699,6 +706,14 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
|
|||
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
|
||||
}
|
||||
|
||||
if ($this->collCcSchedules !== null) {
|
||||
foreach ($this->collCcSchedules as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted()) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
|
@ -770,6 +785,14 @@ abstract class BaseCcWebstream 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;
|
||||
}
|
||||
|
@ -1033,6 +1056,20 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
|
|||
$copyObj->setDbMtime($this->mtime);
|
||||
$copyObj->setDbUtime($this->utime);
|
||||
|
||||
if ($deepCopy) {
|
||||
// important: temporarily setNew(false) because this affects the behavior of
|
||||
// the getter/setter methods for fkey referrer objects.
|
||||
$copyObj->setNew(false);
|
||||
|
||||
foreach ($this->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)
|
||||
|
||||
|
||||
$copyObj->setNew(true);
|
||||
$copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
|
||||
}
|
||||
|
@ -1075,6 +1112,165 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
|
|||
return self::$peer;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 CcWebstream 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)
|
||||
->filterByCcWebstream($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
|
||||
->filterByCcWebstream($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->setCcWebstream($this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this CcWebstream is new, it will return
|
||||
* an empty collection; or if this CcWebstream 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 CcWebstream.
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this CcWebstream is new, it will return
|
||||
* an empty collection; or if this CcWebstream 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 CcWebstream.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
|
@ -1109,8 +1305,14 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
|
|||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->collCcSchedules) {
|
||||
foreach ((array) $this->collCcSchedules as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
$this->collCcSchedules = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue