Example #1
0
 public function executeUserroles()
 {
     $this->type = $this->getRequestParameter('type');
     $c = new Criteria();
     $c->add(UserrolePeer::ROLE_ID, sfConfig::get('app_role_' . $this->type));
     $c->addJoin(UserPeer::ID, UserrolePeer::USER_ID);
     $c->addAscendingOrderByColumn(UserPeer::GRADUATIONYEAR);
     $this->userroles = UserrolePeer::doSelect($c);
 }
Example #2
0
 public static function retrieveByPKUser($pk, $user, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria(UserrolePeer::DATABASE_NAME);
     $criteria->add(UserrolePeer::ROLE_ID, $pk);
     $criteria->add(UserrolePeer::USER_ID, $user);
     $v = UserrolePeer::doSelect($criteria, $con);
     return !empty($v) > 0 ? $v[0] : null;
 }
 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(UserrolePeer::ID, $pks, Criteria::IN);
         $objs = UserrolePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Example #4
0
 public function executeList()
 {
     $this->userroles = UserrolePeer::doSelect(new Criteria());
 }
Example #5
0
 public function getUserroles($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseUserrolePeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collUserroles === null) {
         if ($this->isNew()) {
             $this->collUserroles = array();
         } else {
             $criteria->add(UserrolePeer::ROLE_ID, $this->getId());
             UserrolePeer::addSelectColumns($criteria);
             $this->collUserroles = UserrolePeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(UserrolePeer::ROLE_ID, $this->getId());
             UserrolePeer::addSelectColumns($criteria);
             if (!isset($this->lastUserroleCriteria) || !$this->lastUserroleCriteria->equals($criteria)) {
                 $this->collUserroles = UserrolePeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastUserroleCriteria = $criteria;
     return $this->collUserroles;
 }