Author: ornicar2
Date: 2010-02-08 11:11:01 +0100 (Mon, 08 Feb 2010)
New Revision: 27706

Modified:
   plugins/diemPlugin/trunk/dmCorePlugin/lib/action/dmBaseActions.php
Log:
[Diem]
- added action.method_not_found to allow to extend actions with new methods
- made some action getters public to ease actions extension

Modified: plugins/diemPlugin/trunk/dmCorePlugin/lib/action/dmBaseActions.php
===================================================================
--- plugins/diemPlugin/trunk/dmCorePlugin/lib/action/dmBaseActions.php  
2010-02-08 10:09:48 UTC (rev 27705)
+++ plugins/diemPlugin/trunk/dmCorePlugin/lib/action/dmBaseActions.php  
2010-02-08 10:11:01 UTC (rev 27706)
@@ -113,27 +113,27 @@
     return $backUrl;
   }
   
-  protected function getRouting()
+  public function getRouting()
   {
     return $this->context->getRouting();
   }
   
-  protected function getHelper()
+  public function getHelper()
   {
     return $this->context->getHelper();
   }
 
-  protected function getI18n()
+  public function getI18n()
   {
     return $this->context->getI18n();
   }
   
-  protected function getServiceContainer()
+  public function getServiceContainer()
   {
     return $this->context->getServiceContainer();
   }
   
-  protected function getService($serviceName, $class = null)
+  public function getService($serviceName, $class = null)
   {
     return $this->getServiceContainer()->getService($serviceName, $class);
   }
@@ -191,5 +191,25 @@
     print $data;
     exit;
   }
+  
+  /**
+   * Calls methods defined via sfEventDispatcher.
+   *
+   * @param string $method The method name
+   * @param array  $arguments The method arguments
+   *
+   * @return mixed The returned value of the called method
+   *
+   * @throws sfException If called method is undefined
+   */
+  public function __call($method, $arguments)
+  {
+    $event = $this->dispatcher->notifyUntil(new sfEvent($this, 
'action.method_not_found', array('method' => $method, 'arguments' => 
$arguments)));
+    if (!$event->isProcessed())
+    {
+      throw new sfException(sprintf('Call to undefined method %s::%s.', 
get_class($this), $method));
+    }
 
+    return $event->getReturnValue();
+  }
 }
\ No newline at end of file

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