Author: fabriceb
Date: 2010-04-19 15:55:34 +0200 (Mon, 19 Apr 2010)
New Revision: 29207

Modified:
   plugins/sfFacebookConnectPlugin/trunk/lib/sfFacebookGuardAdapter.class.php
   
plugins/sfFacebookConnectPlugin/trunk/lib/sfFacebookPropelGuardAdapter.class.php
Log:
[sfFacebookConnectPlugin] Better handling of the user null case for Propel

Modified: 
plugins/sfFacebookConnectPlugin/trunk/lib/sfFacebookGuardAdapter.class.php
===================================================================
--- plugins/sfFacebookConnectPlugin/trunk/lib/sfFacebookGuardAdapter.class.php  
2010-04-19 13:29:17 UTC (rev 29206)
+++ plugins/sfFacebookConnectPlugin/trunk/lib/sfFacebookGuardAdapter.class.php  
2010-04-19 13:55:34 UTC (rev 29207)
@@ -84,7 +84,8 @@
    * @since 2009-05-17
    */
   public function getUserFacebookUid($user)
-  {
+  {     
+
     return $this->getUserProfileProperty($user, 'facebook_uid');
   }
 
@@ -212,7 +213,7 @@
     $sfGuardUser = new sfGuardUser();
     $sfGuardUser->setUsername('Facebook_'.$facebook_uid);
     $this->setUserFacebookUid($sfGuardUser, $facebook_uid);
-    sfFacebookConnect::newSfGuardConnectionHook(&$sfGuardUser, $facebook_uid);
+    sfFacebookConnect::newSfGuardConnectionHook($sfGuardUser, $facebook_uid);
 
     // Save them into the database using a transaction to ensure a Facebook 
sfGuardUser cannot be stored without its facebook uid
     try

Modified: 
plugins/sfFacebookConnectPlugin/trunk/lib/sfFacebookPropelGuardAdapter.class.php
===================================================================
--- 
plugins/sfFacebookConnectPlugin/trunk/lib/sfFacebookPropelGuardAdapter.class.php
    2010-04-19 13:29:17 UTC (rev 29206)
+++ 
plugins/sfFacebookConnectPlugin/trunk/lib/sfFacebookPropelGuardAdapter.class.php
    2010-04-19 13:55:34 UTC (rev 29207)
@@ -141,7 +141,10 @@
   public function setUserProfileProperty(&$user, $property_name, $property)
   {
     $setPropertyMethod = 'set'.$this->getProfilePhpName($property_name);
-    $user->getProfile()->$setPropertyMethod($property);
+    if ($user)
+    {
+      $user->getProfile()->$setPropertyMethod($property);
+    }
   }
 
   /**
@@ -156,8 +159,16 @@
   public function getUserProfileProperty($user, $property_name)
   {
     $getPropertyMethod = 'get'.$this->getProfilePhpName($property_name);
+    if ($user)
+    {
 
-    return $user->getProfile()->$getPropertyMethod();
+      return $user->getProfile()->$getPropertyMethod();
+    }
+    else
+    {
+      
+      return null;
+    }
   }
 
 

-- 
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.

Reply via email to