Author: marijn
Date: 2010-01-11 18:26:47 +0100 (Mon, 11 Jan 2010)
New Revision: 26483

Modified:
   
plugins/sfPaymentPlugin/branches/1.2-marijn/config/sfPaymentPluginConfiguration.class.php
Log:
[sfPaymentPlugin] Added a hook for the user object to simulate a 
`sfUser#getBasket()` method.

Modified: 
plugins/sfPaymentPlugin/branches/1.2-marijn/config/sfPaymentPluginConfiguration.class.php
===================================================================
--- 
plugins/sfPaymentPlugin/branches/1.2-marijn/config/sfPaymentPluginConfiguration.class.php
   2010-01-11 17:24:34 UTC (rev 26482)
+++ 
plugins/sfPaymentPlugin/branches/1.2-marijn/config/sfPaymentPluginConfiguration.class.php
   2010-01-11 17:26:47 UTC (rev 26483)
@@ -33,12 +33,34 @@
       }
 
       $this->dispatcher->connect('component.method_not_found', array($this, 
'onComponentMethodNotFound'));
+      $this->dispatcher->connect('user.method_not_found', array($this, 
'onUserMethodNotFound'));
       $this->dispatcher->connect('transaction.prepare', array($this, 
'onTransactionPrepare'));
       $this->dispatcher->connect('transaction.request', array($this, 
'onTransactionRequest'));
       $this->dispatcher->connect('transaction.process', array($this, 
'onTransactionProcess'));
     }
 
     /**
+     * Hook for the user.method_not_found event.
+     *
+     * @param   sfEvent $arg_event  The event that caused invocation of the 
hook.
+     *
+     * @return  boolean             Indicator whether a hook was found or not.
+     */
+    public function onUserMethodNotFound (sfEvent $arg_event)
+    {
+      $result = FALSE;
+
+      if ('getBasket' === $arg_event['method'])
+      {
+        
$arg_event->setReturnValue($this->getServiceContainer()->getService('payment.basket'));
+
+        $result = TRUE;
+      }
+
+      return $result;
+    }
+
+    /**
      * Hook for the component.method_not_found event.
      *
      * @param   sfEvent $arg_event  The event that caused invocation of the 
hook.

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