Пример #1
0
 function getAllUsersByRole()
 {
     $oCriteria = new Criteria('rbac');
     $oCriteria->addSelectColumn(UsersRolesPeer::ROL_UID);
     $oCriteria->addSelectColumn('COUNT(*) AS CNT');
     $oCriteria->addJoin(RbacUsersPeer::USR_UID, UsersRolesPeer::USR_UID, Criteria::INNER_JOIN);
     $oCriteria->add(RbacUsersPeer::USR_STATUS, 0, Criteria::NOT_EQUAL);
     $oCriteria->addGroupByColumn(UsersRolesPeer::ROL_UID);
     $oDataset = UsersRolesPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $aRoles = array();
     while ($oDataset->next()) {
         $row = $oDataset->getRow();
         $aRoles[$row['ROL_UID']] = $row['CNT'];
     }
     return $aRoles;
 }
Пример #2
0
 /**
  * Method to do selects.
  *
  * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
  * @param      Connection $con
  * @return     array Array of selected Objects
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelect(Criteria $criteria, $con = null)
 {
     return UsersRolesPeer::populateObjects(UsersRolesPeer::doSelectRS($criteria, $con));
 }