示例#1
0
 public function executeIndex(sfWebRequest $request)
 {
     $this->step = sfConfig::get('app_max_features_on_featurelist');
     $this->getUser()->syncParameters($this, 'feature', 'index', array('offset', 'limit', 'sort_column', 'sort_direction'), $request);
     if (is_null($this->sort_column)) {
         $this->sort_column = 'name';
         $this->sort_direction = 'up';
     }
     if (is_null($this->offset)) {
         $this->offset = 0;
     }
     if (is_null($this->limit) || $this->limit <= 0) {
         $this->limit = $this->step;
     }
     $c = new Criteria();
     SortCriteria::addSortCriteria($c, $this->sort_column, FeaturePeer::getSortAliases(), $this->sort_direction);
     $c->setOffset($this->offset);
     if ($this->limit >= 0) {
         $c->setLimit($this->limit);
     }
     $this->feature_list = FeaturePeer::doSelect($c);
     $this->count = FeaturePeer::doCount(new Criteria());
     if ($this->offset < 0 || $this->offset >= $this->count && $this->count > 0) {
         $this->forward404();
     }
 }
示例#2
0
 public function getFeatures()
 {
     $c = new Criteria();
     $c->addJoin(FeaturePeer::ID, ActivityHasFeaturePeer::FEATURE_ID);
     $c->add(ActivityHasFeaturePeer::ACTIVITY_ID, $this->getId());
     $c->addAscendingOrderByColumn(FeaturePeer::NAME);
     return FeaturePeer::doSelect($c);
 }
示例#3
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)
 {
     if ($con === null) {
         $con = Propel::getConnection(FeaturePeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(FeaturePeer::DATABASE_NAME);
         $criteria->add(FeaturePeer::ID, $pks, Criteria::IN);
         $objs = FeaturePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
示例#4
0
文件: Room.php 项目: jfesquet/tempos
 public function getFeatures()
 {
     $c = new Criteria();
     $c->addJoin(ActivityHasFeaturePeer::FEATURE_ID, FeaturePeer::ID);
     $c->addJoin(RoomHasActivityPeer::ACTIVITY_ID, ActivityHasFeaturePeer::ACTIVITY_ID);
     $c->add(RoomHasActivityPeer::ROOM_ID, $this->getId(), Criteria::EQUAL);
     $c->addGroupByColumn(FeaturePeer::ID);
     return FeaturePeer::doSelect($c);
 }