/**
  * gets an array of Agent objects related to a user
  *
  * @return Agent
  */
 public static function getAgentsForCurrentUser()
 {
     $isAdmin = sfContext::getInstance()->getUser()->hasCredential(array(0 => 'administrator'));
     $c = new Criteria();
     if (!$isAdmin) {
         $userId = sfContext::getInstance()->getUser()->getSubscriberId();
         $c->addJoin(AgentHasUserPeer::AGENT_ID, AgentPeer::ID);
         $c->add(AgentHasUserPeer::USER_ID, $userId);
     }
     $c->addAscendingOrderByColumn(AgentPeer::ORG_NAME);
     $result = AgentPeer::doSelect($c);
     return $result;
 }
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      Connection $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 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(AgentPeer::ID, $pks, Criteria::IN);
         $objs = AgentPeer::doSelect($criteria, $con);
     }
     return $objs;
 }