Author: kingpin393
Date: 2010-05-10 15:58:20 +0200 (Mon, 10 May 2010)
New Revision: 29403

Modified:
   plugins/zsToolboxPlugin/trunk/lib/behaviors/zsUsertraceableListener.class.php
Log:
[zsToolboxPlugin] added ability to use fixtures for user-traceable behaviour

Modified: 
plugins/zsToolboxPlugin/trunk/lib/behaviors/zsUsertraceableListener.class.php
===================================================================
--- 
plugins/zsToolboxPlugin/trunk/lib/behaviors/zsUsertraceableListener.class.php   
    2010-05-09 20:25:30 UTC (rev 29402)
+++ 
plugins/zsToolboxPlugin/trunk/lib/behaviors/zsUsertraceableListener.class.php   
    2010-05-10 13:58:20 UTC (rev 29403)
@@ -22,12 +22,21 @@
    */
   public function preInsert(Doctrine_Event $event)
   {
-    $guard_user = sfContext::getInstance()->getUser()->getGuardUser();
+    /*if(!sfContext::hasInstance())
+      return;*/
 
+    try
+    {
+      $guard_user = sfContext::getInstance()->getUser()->getGuardUser();
+    } catch (Exception $e)
+    {
+      return;
+    }
+
     if ( ! $this->_options['created']['disabled'])
     {
       $createdName = $event->getInvoker()->getTable()
-          ->getFieldName($this->_options['created']['name']);
+              ->getFieldName($this->_options['created']['name']);
 
       $modified = $event->getInvoker()->getModified();
 
@@ -40,7 +49,7 @@
     if ( ! $this->_options['updated']['disabled'])
     {
       $updatedName = $event->getInvoker()->getTable()
-          ->getFieldName($this->_options['updated']['name']);
+              ->getFieldName($this->_options['updated']['name']);
 
       $modified = $event->getInvoker()->getModified();
 
@@ -58,12 +67,18 @@
    */
   public function preUpdate(Doctrine_Event $event)
   {
-    $guard_user = sfContext::getInstance()->getUser()->getGuardUser();
-    //die(var_dump($guard_user));
+    try
+    {
+      $guard_user = sfContext::getInstance()->getUser()->getGuardUser();
+    } catch (Exception $e)
+    {
+      return;
+    }
+
     if ( ! $this->_options['updated']['disabled'])
     {
       $updatedName = $event->getInvoker()->getTable()
-          ->getFieldName($this->_options['updated']['name']);
+              ->getFieldName($this->_options['updated']['name']);
 
       $modified = $event->getInvoker()->getModified();
 
@@ -82,13 +97,19 @@
    */
   public function preDqlUpdate(Doctrine_Event $event)
   {
-    $guard_user = sfContext::getInstance()->getUser()->getGuardUser();
+    try
+    {
+      $guard_user = sfContext::getInstance()->getUser()->getGuardUser();
+    } catch (Exception $e)
+    {
+      return;
+    }
 
     if ( ! $this->_options['updated']['disabled'])
     {
       $params = $event->getParams();
       $updatedName = $event->getInvoker()->getTable()
-          ->getFieldName($this->_options['updated']['name']);
+              ->getFieldName($this->_options['updated']['name']);
 
       $field = $params['alias'] . '.' . $updatedName;
 

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