* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * * @package symfony * @subpackage plugin * @author Fabien Potencier * @version SVN: $Id: sfGuardUserPeer.php 4 2008-09-24 08:40:58Z marek $ */ class sfGuardUserPeer extends BasesfGuardUserPeer { public static function retrieveByUsername($username, $isActive = true) { $c = new Criteria(); $c->add(self::USERNAME, $username); $c->add(self::IS_ACTIVE, $isActive); return self::doSelectOne($c); } /** * Tworzy nową instancję modelu użytkownika i ustawia go jako anonymowego * Użytkownik nie jest zapisywany do bazy i wymaga wywołania sfGuardUser::save() * * @param string $username Nazwa użytkownika/email * @return sfGuardUser|null * @throws sfException * @throws sfException * @throws PropelException */ public static function createAnonymous($username) { $user = new sfGuardUser(); $user->setUsername($username); $user->setPassword('anonymous'); $user->setHashCode(md5(microtime())); $group = sfGuardGroupPeer::retrieveByName('user'); $guardUserGroup = new sfGuardUserGroup(); $guardUserGroup->setGroupId($group->getId()); $user->addsfGuardUserGroup($guardUserGroup); return $user; } }