Esempio n. 1
0
 /**
  * Returns the counters. The possible options are :
  *  * limit : maximal number of counters to be returned
  *  * order : asc or desc, based on the counter field.
  * 
  * @param      Criteria  $c
  * @param      array  $options
  */
 public static function getCounters(Criteria $c = null, $options = array())
 {
     if ($c == null) {
         $c = new Criteria();
     }
     if (isset($options['limit'])) {
         $c->setLimit($options['limit']);
     }
     if (isset($options['order'])) {
         if ($options['order'] == 'asc') {
             $c->addAscendingOrderByColumn(sfCounterPeer::COUNTER);
         } else {
             $c->addDescendingOrderByColumn(sfCounterPeer::COUNTER);
         }
     }
     return sfCounterPeer::doSelect($c);
 }
Esempio n. 2
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(sfCounterPeer::ID, $pks, Criteria::IN);
         $objs = sfCounterPeer::doSelect($criteria, $con);
     }
     return $objs;
 }