[limb-svn] r5814 - 3.x/trunk/limb/web_app/src/controller

svn at limb-project.com svn at limb-project.com
Sat May 5 16:28:11 MSD 2007


Author: pachanga
Date: 2007-05-05 16:28:11 +0400 (Sat, 05 May 2007)
New Revision: 5814
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5814

Modified:
   3.x/trunk/limb/web_app/src/controller/lmbAbstractController.class.php
Log:
-- initial mixins support added into lmbAbstractController, mixed instance can be accessed via $mixed attribute

Modified: 3.x/trunk/limb/web_app/src/controller/lmbAbstractController.class.php
===================================================================
--- 3.x/trunk/limb/web_app/src/controller/lmbAbstractController.class.php	2007-05-05 12:24:24 UTC (rev 5813)
+++ 3.x/trunk/limb/web_app/src/controller/lmbAbstractController.class.php	2007-05-05 12:28:11 UTC (rev 5814)
@@ -11,6 +11,7 @@
  */
 
 lmb_require('limb/core/src/lmbClassPath.class.php');
+lmb_require('limb/core/src/lmbMixable.class.php');
 
 /**
  * Base class for all controllers
@@ -31,8 +32,15 @@
    * @var string
    */
   protected $current_action;
+  /**
+   * @var array array of mixins
+   */
+  protected $mixins = array();
+  /**
+   * @var object lmbMixable instance
+   */
+  protected $mixed;
 
-
   /**
    *  Constructor.
    *  Guesses controller {@link $name} if $name attribute is not defined
@@ -41,8 +49,24 @@
   {
     if(!$this->name)
      $this->name = $this->_guessName();
+
+    $this->mixed = new lmbMixable();
+    $this->mixed->setOwner($this);
+    foreach($this->mixins as $mixin)
+      $this->mixed->mixin($mixin);
   }
 
+  /**
+   * Using this hacky method mixins can access controller variables
+   * @param string variable name
+   * @return mixed
+   */
+  function _get($name)
+  {
+    if(isset($this->$name))
+      return $this->$name;
+  }
+
   protected function _guessName()
   {
     if($pos = strpos(get_class($this), 'Controller'))



More information about the limb-svn mailing list