コンポーネント(共通プログラム) を記述するファイル。
View は GETメソッド、Action はPOST メソッドに対応する
(1) components/View.class.php<?php
class Memo_Components_View
{
var $_db = null;
var $_container = null;
function Memo_Components_View()
{
$this->_container =& DIContainerFactory::getContainer();
$this->_db =& $this->_container->getComponent("DbObject");
}
}
?>
ファイルの配置される場所 components/View.class.php と
クラス名 Memo_Components_View は、
一意的に決められる。
$_containerはコンテナ・クラスのオブジェクト
maple/core/DIContainerFactory.class.php が対応する。
$_dbはデータベース・クラスのオブジェクト
maple/nccore/db/DbObjectAdodb.class.php が対応する。
この手引きでの扱いDB書込みにて変更する。
(2) components/Action.class.php<?php
class Memo_Components_Action
{
var $_db = null;
var $_container = null;
function Memo_Components_Action()
{
$this->_container =& DIContainerFactory::getContainer();
$this->_db =& $this->_container->getComponent("DbObject");
}
}
?>
この手引きでの扱い変更しない。
参考開発ガイド: コンポーネントを使用するMaple Wiki: DIContainerを活用するNetCommons Wiki: DbObjectAdodb