Author: Jonathan.Wage
Date: 2010-02-10 17:39:28 +0100 (Wed, 10 Feb 2010)
New Revision: 27828

Modified:
   plugins/sfSympalPlugin/trunk/lib/helper/SympalContentSlotHelper.php
   
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalDataGridPlugin/lib/sfSympalDataGrid.class.php
Log:
[1.4][sfSympalPlugin][1.0] Fixing issue with CreatedBy is not present


Modified: plugins/sfSympalPlugin/trunk/lib/helper/SympalContentSlotHelper.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/helper/SympalContentSlotHelper.php 
2010-02-10 16:31:27 UTC (rev 27827)
+++ plugins/sfSympalPlugin/trunk/lib/helper/SympalContentSlotHelper.php 
2010-02-10 16:39:28 UTC (rev 27828)
@@ -14,13 +14,18 @@
 
 function render_content_author(sfSympalContent $content, $slot)
 {
-  return $content->CreatedBy->username;
+  return $content->created_by_id ? $content->CreatedBy->username : 'nobody';
 }
 
 function render_content_date_published(sfSympalContent $content, $slot)
 {
-  use_helper('Date');
-  return format_datetime($content->date_published, 
sfSympalConfig::get('date_published_format'));
+  if ($content->date_published)
+  {
+    use_helper('Date');
+    return format_datetime($content->date_published, 
sfSympalConfig::get('date_published_format'));
+  } else {
+    return '0000-00-00';
+  }
 }
 
 /**

Modified: 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php 
    2010-02-10 16:31:27 UTC (rev 27827)
+++ 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php 
    2010-02-10 16:39:28 UTC (rev 27828)
@@ -469,12 +469,12 @@
 
   public function getAuthorName()
   {
-    return $this->getCreatedBy()->getName();
+    return $this->getCreatedById() ? $this->getCreatedBy()->getName() : null;
   }
 
   public function getAuthorEmail()
   {
-    return $this->getCreatedBy()->getEmailAddress();
+    return $this->getCreatedById() ? $this->getCreatedBy()->getEmailAddress() 
: null;
   }
 
   public function getUniqueId()

Modified: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalDataGridPlugin/lib/sfSympalDataGrid.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalDataGridPlugin/lib/sfSympalDataGrid.class.php
      2010-02-10 16:31:27 UTC (rev 27827)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalDataGridPlugin/lib/sfSympalDataGrid.class.php
      2010-02-10 16:39:28 UTC (rev 27828)
@@ -401,7 +401,7 @@
         }
       }
     }
-    return $current[$column['fieldName']];
+    return isset($current[$column['fieldName']]) ? 
$current[$column['fieldName']] : null;
   }
 
   public function getSymfonyResource($module, $action = null, $variables = 
array())

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