/**
  *
  * gets an array of Vocabulary objects related to a user
  *
  * @return Agent
  */
 public static function getVocabulariesForCurrentUser()
 {
     $con = Propel::getConnection(self::DATABASE_NAME);
     $isAdmin = sfContext::getInstance()->getUser()->hasCredential(array(0 => 'administrator'));
     $sql = "SELECT DISTINCT * FROM " . VocabularyPeer::TABLE_NAME;
     if (!$isAdmin) {
         $userId = sfContext::getInstance()->getUser()->getSubscriberId();
         $sql .= " INNER JOIN " . AgentHasUserPeer::TABLE_NAME . " ON " . VocabularyPeer::AGENT_ID . " = " . AgentHasUserPeer::AGENT_ID . " WHERE " . AgentHasUserPeer::USER_ID . " = " . $userId;
     }
     $stmt = $con->createStatement();
     $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM);
     $result = parent::populateObjects($rs);
     return $result;
 }
 /**
  * Gets a map (hash) of PHP names to DB column names.
  *
  * @return     array The PHP to DB name map for this peer
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
  */
 public static function getPhpNameMap()
 {
     if (self::$phpNameMap === null) {
         $map = VocabularyPeer::getTableMap();
         $columns = $map->getColumns();
         $nameMap = array();
         foreach ($columns as $column) {
             $nameMap[$column->getPhpName()] = $column->getColumnName();
         }
         self::$phpNameMap = $nameMap;
     }
     return self::$phpNameMap;
 }