public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null) { $liveChannelSegmentFilter = $this->toObject(); $c = new Criteria(); $liveChannelSegmentFilter->attachToCriteria($c); $totalCount = LiveChannelSegmentPeer::doCount($c); $pager->attachToCriteria($c); $dbList = LiveChannelSegmentPeer::doSelect($c); $list = KalturaLiveChannelSegmentArray::fromDbArray($dbList, $responseProfile); $response = new KalturaLiveChannelSegmentListResponse(); $response->objects = $list; $response->totalCount = $totalCount; return $response; }
/** * Returns the number of related LiveChannelSegment objects. * * @param Criteria $criteria * @param boolean $distinct * @param PropelPDO $con * @return int Count of related LiveChannelSegment objects. * @throws PropelException */ public function countLiveChannelSegmentsRelatedByTriggerSegmentId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(LiveChannelSegmentPeer::DATABASE_NAME); } else { $criteria = clone $criteria; } if ($distinct) { $criteria->setDistinct(); } $count = null; if ($this->collLiveChannelSegmentsRelatedByTriggerSegmentId === null) { if ($this->isNew()) { $count = 0; } else { $criteria->add(LiveChannelSegmentPeer::TRIGGER_SEGMENT_ID, $this->id); $count = LiveChannelSegmentPeer::doCount($criteria, false, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return count of the collection. $criteria->add(LiveChannelSegmentPeer::TRIGGER_SEGMENT_ID, $this->id); if (!isset($this->lastLiveChannelSegmentRelatedByTriggerSegmentIdCriteria) || !$this->lastLiveChannelSegmentRelatedByTriggerSegmentIdCriteria->equals($criteria)) { $count = LiveChannelSegmentPeer::doCount($criteria, false, $con); } else { $count = count($this->collLiveChannelSegmentsRelatedByTriggerSegmentId); } } else { $count = count($this->collLiveChannelSegmentsRelatedByTriggerSegmentId); } } return $count; }
/** * Counts segements by channel id * * @param string $channelId * @return int */ public static function countByChannelId($channelId) { $criteria = new Criteria(); $criteria->add(LiveChannelSegmentPeer::CHANNEL_ID, $channelId); return LiveChannelSegmentPeer::doCount($criteria); }