/**
  * Cleans up the environment after running a test.
  */
 protected function tearDown()
 {
     $this->ks = null;
     parent::tearDown();
     foreach ($this->createdUserIds as $userId) {
         // delete all kusers created during the tests
         $c = new Criteria();
         $c->addAnd(kuserPeer::PUSER_ID, $userId, Criteria::EQUAL);
         $kusers = kuserPeer::doSelect($c);
         foreach ($kusers as $kuser) {
             @$kuser->delete();
         }
         // delete all kuser pusers created during the tests
         $c = new Criteria();
         $c->addAnd(PuserKuserPeer::PUSER_ID, $userId, Criteria::EQUAL);
         $puserKusers = PuserKuserPeer::doSelect($c);
         foreach ($puserKusers as $puserKuser) {
             @$puserKuser->delete();
         }
     }
 }
示例#2
0
 /**
  * Gets an array of PuserKuser 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 kuser has previously been saved, it will retrieve
  * related PuserKusers from storage. If this kuser 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 PuserKuser[]
  * @throws     PropelException
  */
 public function getPuserKusers($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(kuserPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collPuserKusers === null) {
         if ($this->isNew()) {
             $this->collPuserKusers = array();
         } else {
             $criteria->add(PuserKuserPeer::KUSER_ID, $this->id);
             PuserKuserPeer::addSelectColumns($criteria);
             $this->collPuserKusers = PuserKuserPeer::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(PuserKuserPeer::KUSER_ID, $this->id);
             PuserKuserPeer::addSelectColumns($criteria);
             if (!isset($this->lastPuserKuserCriteria) || !$this->lastPuserKuserCriteria->equals($criteria)) {
                 $this->collPuserKusers = PuserKuserPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastPuserKuserCriteria = $criteria;
     return $this->collPuserKusers;
 }
function getPuserKusers($lastPuserKuser, $userLimitEachLoop)
{
    PuserKuserPeer::clearInstancePool();
    $c = new Criteria();
    $c->add(PuserKuserPeer::ID, $lastPuserKuser, Criteria::GREATER_THAN);
    $c->addAscendingOrderByColumn(PuserKuserPeer::ID);
    $c->setLimit($userLimitEachLoop);
    PuserKuserPeer::setUseCriteriaFilter(false);
    $puserKusers = PuserKuserPeer::doSelect($c);
    PuserKuserPeer::setUseCriteriaFilter(true);
    return $puserKusers;
}
 /**
  * 
  * Gets all the pusers from the puser table
  * @param int $lastPuserId - the last puser id 
  * @param int $limit - the limit for the query
  */
 private function getAllPusersInPuser($lastPuserId, $limit)
 {
     $pusers = array();
     PuserKuserPeer::clearInstancePool();
     $c = new Criteria();
     $c->add(PuserKuserPeer::ID, $lastPuserId, Criteria::GREATER_THAN);
     // if case we have several entries in the same date (and we stop in the middle)
     $c->addAnd(PuserKuserPeer::PUSER_ID, null, Criteria::NOT_EQUAL);
     $c->addAnd(PuserKuserPeer::PUSER_ID, "", Criteria::NOT_EQUAL);
     if ($this->partnerId) {
         $c->addAnd(PuserKuserPeer::PARTNER_ID, $this->partnerId, Criteria::EQUAL);
     }
     $c->addAnd(PuserKuserPeer::PARTNER_ID, $this->ignorePartners, Criteria::NOT_IN);
     $c->addAscendingOrderByColumn(PuserKuserPeer::ID);
     $c->setLimit($limit);
     PuserKuserPeer::setUseCriteriaFilter(false);
     $pusers1 = PuserKuserPeer::doSelect($c);
     PuserKuserPeer::setUseCriteriaFilter(true);
     foreach ($pusers1 as $puser) {
         //	$this->printToLog("Found puser with id [{$puser->getId()}], partner [{$puser->getPartnerId()}]");
         $pusers[] = new puserDetails($puser->getPuserId(), $puser->getPartnerId());
         file_put_contents($this->lastPuserFile, $puser->getId());
     }
     return $pusers;
 }
示例#5
0
 /**
  * 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(PuserKuserPeer::DATABASE_NAME);
         $criteria->add(PuserKuserPeer::ID, $pks, Criteria::IN);
         $objs = PuserKuserPeer::doSelect($criteria, $con);
     }
     return $objs;
 }