v2.0.1をインストールしたはいいが、ORMもサポートしていないことにがっかり。
ま、それはそれとして、scaffoldingも削除されたためデバッグが難しい。
やむなく まずCIのpackage managerである Sparkをインストール。その後table_torchをインストール。
php tools/spark install -v1.0.8 table_torch
sparks/table_torch/1.0.8/language/ には english しかなく、japanese がないと怒られるので フォルダごとenglishをコピーしておく
sparks/table_torch/1.0.8/config/table_torch.php の中を編集、
$config['table_torch_tables'] = array( のところを書き換える
$config['table_torch_tables'] = array( 'disease'=>array( 'edit'=>TRUE, 'delete'=>TRUE, 'add'=>TRUE ), #編集したいテーブル /* そのほかはコメントアウト 'accounts'=>array( 'edit'=>TRUE, 'delete'=>TRUE, 'add'=>TRUE ), 'users'=>array( 'edit'=>TRUE, 'delete'=>TRUE, 'add'=>FALSE, 'disabled'=>'created_at,last_logged,salt,crypted_password' ), 'templates'=>array( 'edit'=>TRUE, 'delete'=>TRUE, 'add'=>TRUE ), 'media_items'=>array( 'edit'=>TRUE, 'delete'=>TRUE, 'add'=>FALSE ), */ );
以下のファイルをdbtest.phpと名前を付けcontrollersの中に入れる
<?php class Dbtest extends CI_Controller { public function index() { $this->load->spark( 'table_torch/1.0.8'); $this->table_torch->route(); } } ?>
データベースなのにPRIMARY KEYをセットしていなかったのでセットしておく
mysql> ALTER TABLE disease ADD PRIMARY KEY (ID);
http://hogehoge.com/index.php/dbtest/ にアクセスすると、
なかなかかっちょいいscaffoldingですなあ