Created
January 6, 2011 03:39
-
-
Save MASA-P/767472 to your computer and use it in GitHub Desktop.
Setup parent Shell object to Task objects.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP versions 5 | |
* | |
* Expanded Shell class for CakePHP | |
* Copyright 2011, Masaharu Takishita(ECWorks) | |
* Licensed under The MIT License | |
* Redistributions of files must retain the above copyright notice. | |
* | |
* @copyright Copyright 2011, ECWorks. | |
* @link http://blog.ecworks.jp/ ECWorks blog. | |
* @version 1.0.0 | |
* @lastmodified $Date: 2011-01-06 12:00:00 +0900 (Thu, 06 Jan 2011) $ | |
* @license http://www.opensource.org/licenses/mit-license.php The MIT License | |
*/ | |
class ShellEx extends Shell { | |
/** | |
* Parent Shell object for Task. | |
* | |
* @var array | |
* @access public | |
*/ | |
public $parentShell = null; | |
/** | |
* Setup $parentShell property. | |
* Initialize Task object for using in Shell, and set $this to them. | |
* | |
* @access public | |
*/ | |
public function setupParentShell(){ | |
$this->loadTasks(); | |
foreach($this->taskNames as $task){ | |
$this->{$task}->parentShell =& $this; | |
} | |
} | |
/** | |
* Initializing callback for shell. | |
* | |
* @access public | |
*/ | |
public function initialize(){ | |
parent::initialize(); | |
$this->setupParentShell(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment