Author: garak
Date: 2010-09-06 16:12:12 +0200 (Mon, 06 Sep 2010)
New Revision: 30840
Modified:
plugins/sfGuardExtraPlugin/branches/1.3/README
Log:
[sfGuardExtraPlugin] fixed README. Closes #7157 and #9046
Modified: plugins/sfGuardExtraPlugin/branches/1.3/README
===================================================================
--- plugins/sfGuardExtraPlugin/branches/1.3/README 2010-09-06 14:00:13 UTC
(rev 30839)
+++ plugins/sfGuardExtraPlugin/branches/1.3/README 2010-09-06 14:12:12 UTC
(rev 30840)
@@ -50,20 +50,25 @@
}
- * Add method `retrieveByUsernameOrEmail` to get a user by email or username
in `lib/model/sfGuardPlugin/sfGuardUserPeer.class`
+ * Add method `retrieveByUsernameOrEmail` to get a user by email or username
in `lib/model/sfGuardPlugin/sfGuardUserPeer.class`.
+ The following is a working example, if you use sfGuardUserProfile:
[php]
public static function retrieveByUsernameOrEmail($usernameOrEmail,
$isActive = true )
{
$c = new Criteria();
- $c->add(self::USERNAME, $usernameOrEmail);
- $c->add(self::EMAIL, $usernameOrEmail);
- $c->add(self::IS_ACTIVE, $isActive);
+ $c->addJoin(self::ID, sfGuardUserProfilePeer::USER_ID,
Criteria::LEFT_JOIN);
+ $c0 = $c->getNewCriterion(self::USERNAME, $usernameOrEmail);
+ $c1 = $c->getNewCriterion(sfGuardUserProfilePeer::EMAIL,
$usernameOrEmail);
+ $c2 = $c->getNewCriterion(self::IS_ACTIVE, $isActive);
+ $c0->addOr($c1);
+ $c0->addAnd($c2);
+ $c->add($c0);
return self::doSelectOne($c);
}
- * Clear you cache
+ * Clear your cache
symfony cc
@@ -88,4 +93,4 @@
`sfGuardExtraPlugin` comes with a validator that you can use in your modules:
`sfGuardValidatorUsernameOrEmail`.
-This validator is used by the `sfGuardForgotPassword` module to check if user
exists for username or email.
\ No newline at end of file
+This validator is used by the `sfGuardForgotPassword` module to check if user
exists for username or email.
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.