public static function retrieveByPK($pk, PropelPDO $con = null) { if (isset($cache[$pk])) { return $cache[$pk]; } else { return $cache[$pk] = parent::retrieveByPK($pk, $con); } }
public static function getPhpNameMap() { if (self::$phpNameMap === null) { $map = UserPeer::getTableMap(); $columns = $map->getColumns(); $nameMap = array(); foreach ($columns as $column) { $nameMap[$column->getPhpName()] = $column->getColumnName(); } self::$phpNameMap = $nameMap; } return self::$phpNameMap; }
/** * Clear the instance pool. * * @return void */ public static function clearInstancePool() { self::$instances = array(); }
* Returns an array of arrays that contain columns in each unique index. * * @return array */ public static function getUniqueColumnNames() { return array(); } // symfony_behaviors behavior /** * Returns the name of the hook to call from inside the supplied method. * * @param string $method The calling method * * @return string A hook name for {@link sfMixer} * * @throws LogicException If the method name is not recognized */ private static function getMixerPreSelectHook($method) { if (preg_match('/^do(Select|Count)(Join(All(Except)?)?|Stmt)?/', $method, $match)) { return sprintf('BaseUserPeer:%s:%1$s', 'Count' == $match[1] ? 'doCount' : $match[0]); } throw new LogicException(sprintf('Unrecognized function "%s"', $method)); } } // BaseUserPeer // This is the static code needed to register the TableMap for this table with the main Propel class. // BaseUserPeer::buildTableMap();
public static function mayOperateOn($oMe, $oUser, $sOperation) { if (parent::mayOperateOn($oMe, $oUser, $sOperation)) { //Allow operation if user has "users" role return true; } if ($oMe === null) { return false; } if (!$oMe->getIsBackendLoginEnabled()) { return false; } //Allow editing of self. Deletion too? TODO: discuss. if ($sOperation !== 'update') { return false; } ///TODO: Test for modified columns: is_admin_login_enabled, is_admin and such should not be changed return $oMe->getId() === $oUser->getId(); }
public static function setRightsUser($oUser = false) { self::$RIGHTS_USER = $oUser; }
/** * gets an array of User objects related to a group of Agents * * The user group is defined by the agents for which the supplied userID is an admin * or all users if the ShowAll flag is set * * @param user $user The current user object * @param boolean $showAll Show all users in the system if set to true * @return array An array of User objects */ public static function getUsersForAgentUsers(User $user = null, $showAll = false) { $con = Propel::getConnection(self::DATABASE_NAME); //retrieve the current UserId if none is supplied if (!$user) { $userId = sfContext::getInstance()->getUser()->getSubscriberId(); } else { $userId = $user->getId(); } $sql = "SELECT DISTINCT reg_user.* FROM " . UserPeer::TABLE_NAME; if (!$showAll) { $sql .= " INNER JOIN " . AgentHasUserPeer::TABLE_NAME . " ON " . UserPeer::ID . " = " . AgentHasUserPeer::USER_ID . " WHERE " . AgentHasUserPeer::USER_ID . " = " . $userId; } $stmt = $con->createStatement(); $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM); $result = parent::populateObjects($rs); return $result; }