예제 #1
0
 /**
  * Retrieve all the permissions.
  * @return Array with all the sfGuardPermission objects
  */
 public static function getAllPermissions()
 {
     $array = array();
     $permissions = sfGuardPermissionPeer::doSelect(new Criteria());
     foreach ($permissions as $permission) {
         if (in_array($permission->getName(), array_keys(sfPlop::getSafePluginModules()))) {
             $array[$permission->getName()] = array('id' => $permission->getId(), 'name' => $permission->getName(), 'description' => $permission->getDescription());
         }
     }
     foreach (sfPlop::getSafePluginModules() as $key => $options) {
         if (!isset($array[$key])) {
             $array[$key] = array('id' => $key, 'name' => $key, 'description' => $options['name']);
         }
     }
     return $array;
 }
 /**
  * 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(sfGuardPermissionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(sfGuardPermissionPeer::DATABASE_NAME);
         $criteria->add(sfGuardPermissionPeer::ID, $pks, Criteria::IN);
         $objs = sfGuardPermissionPeer::doSelect($criteria, $con);
     }
     return $objs;
 }