fetus Diary
2008/08/22(金) - これはひどい
<?php
class Inber_Controller_Action extends Mondenkind_Controller_Action {
public function __call($method, $args) {
if(preg_match('/^[[:alnum:]]+Action$/i', $method)) {
$request = $this->getRequest();
$model = Inber_Model_Loader::loadAction($request,
$this->getResponse(),
$request->getModuleName(),
$request->getControllerName(),
$request->getActionName());
if($model) {
$model->execute();
return;
}
}
return parent::__call($method, $args);
}
}
?>
これを Zend_Controller_Action の替わりに基底クラスにして、Controller を作成。すると、
<?php
class IndexController extends Inber_Controller_Action {
}
?>
なんということでsh(ry
思考:「複数個の Action が 1 つのクラスに居ると名前空間がアレで嫌だなぁ」→「Action 関数の実装を全部別のクラスに追い出せばいいんじゃね?」→「じゃあ Model に追い出してしまおう」→「移譲するだけの Controller 書くのアホらしくね?」→「じゃあ __call つかってしまおう」
ということで、どんどん Mojavi っぽい俺様フレームワークが Zend Framework 上に構築されて行っているふいんき(←ATOK だと変換できるけどわざと変換しない
# execute() 呼ぶ前に isSecure() とか呼び出し始めたらいよいよ Mojavi の焼き直しだな
- 08/08/22 21:07
コメント
コメントはありません。