/**
  * Retrieve all cases that could be started
  *
  * @param      PropelPDO $con the connection to use
  * @return     Ezer_PropelCase
  */
 public static function retrieveReadyToStart(PropelPDO $con = null)
 {
     $criteria = new Criteria(Ezer_PropelCasePeer::DATABASE_NAME);
     $criteria->add(Ezer_PropelCasePeer::STATUS, Ezer_IntStep::STEP_STATUS_ACTIVE);
     $criteria->add(Ezer_PropelCasePeer::NEXT_EXCUTION_TIME, time(), Criteria::LESS_EQUAL);
     return Ezer_PropelCasePeer::doSelect($criteria, $con);
 }
 private function loadCases()
 {
     $dbCases = Ezer_PropelCasePeer::retrieveReadyToStart();
     foreach ($dbCases as $dbCase) {
         $dbCase->incrementExcutionIndex();
         if ($dbCase->getExcutionRepeats() && $dbCase->getCurrentExcutionIndex() >= $dbCase->getExcutionRepeats()) {
             $dbCase->delete();
         } else {
             $nextExcution = time() + $dbCase->getExcutionInterval();
             $dbCase->setNextExcutionTime($nextExcution);
             $dbCase->save();
         }
         $this->cases[] = $this->loadCase(clone $dbCase);
     }
 }
 /**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggreagated array of ValidationFailed objects will be returned.
  *
  * @param      array $columns Array of column names to validate.
  * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         if (($retval = Ezer_PropelCasePeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         $this->alreadyInValidation = false;
     }
     return !empty($failureMap) ? $failureMap : true;
 }
 /**
  * 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)
 {
     if ($con === null) {
         $con = Propel::getConnection(Ezer_PropelCasePeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(Ezer_PropelCasePeer::DATABASE_NAME);
         $criteria->add(Ezer_PropelCasePeer::ID, $pks, Criteria::IN);
         $objs = Ezer_PropelCasePeer::doSelect($criteria, $con);
     }
     return $objs;
 }