public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null) { myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2; $c = new Criteria(); $c->add(kvotePeer::PARTNER_ID, kCurrentContext::$ks_partner_id); if ($this->entryIdEqual) { $c->add(kvotePeer::ENTRY_ID, $this->entryIdEqual); } if ($this->userIdEqual) { $c->add(kvotePeer::PUSER_ID, $this->userIdEqual); } $pager->attachToCriteria($c); $list = kvotePeer::doSelect($c); $response = new KalturaLikeListResponse(); $response->objects = KalturaLikeArray::fromDbArray($list, $responseProfile); $response->totalCount = count($list); return $response; }
/** * Gets an array of kvote objects which contain a foreign key that references this object. * * If this collection has already been initialized with an identical Criteria, it returns the collection. * Otherwise if this kshow has previously been saved, it will retrieve * related kvotesRelatedByKuserId from storage. If this kshow is new, it will return * an empty collection or the current collection, the criteria is ignored on a new object. * * @param PropelPDO $con * @param Criteria $criteria * @return array kvote[] * @throws PropelException */ public function getkvotesRelatedByKuserId($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(kshowPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collkvotesRelatedByKuserId === null) { if ($this->isNew()) { $this->collkvotesRelatedByKuserId = array(); } else { $criteria->add(kvotePeer::KUSER_ID, $this->id); kvotePeer::addSelectColumns($criteria); $this->collkvotesRelatedByKuserId = kvotePeer::doSelect($criteria, $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 the collection. $criteria->add(kvotePeer::KUSER_ID, $this->id); kvotePeer::addSelectColumns($criteria); if (!isset($this->lastkvoteRelatedByKuserIdCriteria) || !$this->lastkvoteRelatedByKuserIdCriteria->equals($criteria)) { $this->collkvotesRelatedByKuserId = kvotePeer::doSelect($criteria, $con); } } } $this->lastkvoteRelatedByKuserIdCriteria = $criteria; return $this->collkvotesRelatedByKuserId; }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(kvotePeer::DATABASE_NAME); $criteria->add(kvotePeer::ID, $pks, Criteria::IN); $objs = kvotePeer::doSelect($criteria, $con); } return $objs; }
<?php const LIMIT = 500; const INITIAL_CREATED_AT_VALUE = '2000-01-01 00:00:00'; require_once __DIR__ . "/../../../alpha/scripts/bootstrap.php"; $c = new Criteria(); $c->addAscendingOrderByColumn(kvotePeer::CREATED_AT); $c->setLimit(LIMIT); $createdAtValue = INITIAL_CREATED_AT_VALUE; $kVotes = array(1); while (!empty($kVotes)) { $c->add(kvotePeer::CREATED_AT, $createdAtValue, Criteria::GREATER_THAN); kvotePeer::setUseCriteriaFilter(false); $kVotes = kvotePeer::doSelect($c); kvotePeer::setUseCriteriaFilter(true); foreach ($kVotes as $kVote) { $kuserId = $kVote->getKuserId(); kuserPeer::setUseCriteriaFilter(false); $kuser = kuserPeer::retrieveByPKNoFilter($kuserId); kuserPeer::setUseCriteriaFilter(true); if (!$kuser) { KalturaLog::err("no user found with id {$kuserId}"); continue; } $puserId = $kuser->getPuserId(); $kVote->setPuserId($puserId); $kVote->save(); } KalturaLog::debug("created is - " . $kVote->getCreatedAt()); $createdAtValue = $kVote->getCreatedAt(); }