Author: allyb
Date: 2010-01-13 11:19:28 +0100 (Wed, 13 Jan 2010)
New Revision: 26559
Modified:
plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUserBasePeer.php
Log:
Added a retrieveByProfileId method tothe easyauthpeer class
Modified: plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUserBasePeer.php
===================================================================
--- plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUserBasePeer.php
2010-01-13 09:55:35 UTC (rev 26558)
+++ plugins/sfEasyAuthPlugin/trunk/lib/model/sfEasyAuthUserBasePeer.php
2010-01-13 10:19:28 UTC (rev 26559)
@@ -34,7 +34,7 @@
* Retrieve all users of a given type
*
* @param string $type
- * @return array
+ * @return mixed
*/
public static function retrieveByType($type)
{
@@ -43,8 +43,34 @@
return self::doSelect($c);
}
-
+
/**
+ * Retrieve a user by a profile id, or null if no user exists
+ * with that profile id
+ *
+ * @param int $profileId
+ * @return mixed
+ */
+ public static function retrieveByProfileId($profileId)
+ {
+ // first, try to retrieve a user whose default profile id is $profileId
+ $c = new Criteria();
+ $c->add(self::PROFILE_ID, $profileId);
+
+ if ($user = self::doSelect($c))
+ {
+ return $user;
+ }
+
+ // if no user was returned, search the extra credentials table
+ $c = new Criteria();
+ $c->addJoin(self::PROFILE_ID, sfEasyAuthUserCredentialPeer::ID);
+ $c->add(sfEasyAuthUserCredentialPeer::PROFILE_ID, $profileId);
+
+ return self::doSelect($c);
+ }
+
+ /**
* Retrieve a user by their email address
*
* @param string $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.