action コマンド
説明
action コマンドは、アクション名に対して命名規則に従いアクションメソッド、ダイコンファイル、html テンプレートを作成します。 アクション名が「 hello 」の場合、アクションメソッドは helloAction、ダイコンファイルは helloAction.dicon、html テンプレートは hello.html となります。 アクションメソッドは、アクションコントローラに「/** S2BASE_PHP5 ACTION METHOD **/」コメントが記述されている箇所に追加されます。
実行例
% s2base [INFO ] s2base directory : /seasar.php/workspace/s2base.php5/lib/S2Base/build/s2base.php5 [INFO ] project directory : /seasar.php/workspace/s2base.php5 [INFO ] project type : zf [INFO ] command type : command [ Command list ] 0 : (exit) 1 : action 2 : dao 3 : entity 4 : service & dao 5 : interceptor 6 : model 7 : module & controller 8 : service choice ? : 1 <--- 1 : action を選択 [ Module list ] 0 : (exit) 1 : default choice ? : 1 [ Controller list ] 0 : (exit) 1 : index choice ? : 1 action name ? : foo [ generate information ] module name : default controller name : index controller class name : IndexController action name : foo action method name : fooAction action template file : foo.phtml confirm ? (y/n) : y [INFO ] modify : /seasar.php/workspace/s2base.php5/app/modules/default/controllers/IndexController.php [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/views/scripts/index/foo.phtml [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/models/index/validate/foo.ini [ Command list ] 0 : (exit) ・・・ choice ? : 0 %
dao コマンド
説明
S2Dao で必要な dao インタフェース、entity クラス、テストクラスを生成します。
実行例
% s2base
[INFO ] s2base directory : /seasar.php/workspace/s2base.php5/lib/S2Base/build/s2base.php5
[INFO ] project directory : /seasar.php/workspace/s2base.php5
[INFO ] project type : zf
[INFO ] command type : command
[ Command list ]
0 : (exit)
1 : action
2 : dao
3 : entity
4 : service & dao
5 : interceptor
6 : model
7 : module & controller
8 : service
choice ? : 2 <--- 2 : dao を選択
[ Module list ]
0 : (exit)
1 : default
choice ? : 1
[ Controller list ]
0 : (exit)
1 : index
choice ? : 1
use database ? (y/n) : y <--- データベースのテーブル一覧を取得します。
[ table list ]
0 : (exit)
1 : CD
2 : DEPT
3 : EMP
4 : SHELF
5 : USERS
choices ? (1,2,--,) : 1 <--- 複数のテーブルを選択した場合は、先頭のテーブルが Entity の
テーブルに使用されます。残りのテーブルのカラムが Entity のプロパティに追加されます。
dao interface name [CdDao]? :
entity class name ? [CdEntity] :
[ generate information ]
module name : default
controller name : index
dao interface name : CdDao
dao test class name : CdDaoTest
entity class name : CdEntity
table name : CD
columns : ID, TITLE, CONTENT
confirm ? (y/n) : y
[INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/models/index/dao/CdDao.php
[INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/models/index/entity/CdEntity.php
[INFO ] create : /seasar.php/workspace/s2base.php5/test/modules/default/models/index/dao/CdDaoTest.php
[ Command list ]
0 : (exit)
・・・
choice ? : 0
%
entity コマンド
説明
S2Dao で用いる Entity クラスを作成します。columns でカンマ区切りのカラム名を入力すると、対応するプロパティとアクセッサメソッドを追加します。
実行例
% s2base
[INFO ] s2base directory : /seasar.php/workspace/s2base.php5/lib/S2Base/build/s2base.php5
[INFO ] project directory : /seasar.php/workspace/s2base.php5
[INFO ] project type : zf
[INFO ] command type : command
[ Command list ]
0 : (exit)
1 : action
2 : dao
3 : entity
4 : service & dao
5 : interceptor
6 : model
7 : module & controller
8 : service
choice ? : 4 <--- 4 : entity を選択
[ Module list ]
0 : (exit)
1 : default
choice ? : 1
[ Controller list ]
0 : (exit)
1 : index
choice ? : 1
use database ? (y/n) : y <--- データベースのテーブル一覧を取得します。
[ table list ]
0 : (exit)
1 : CD
2 : DEPT
3 : EMP
4 : SHELF
5 : USERS
choices ? (1,2,--,) : 2,3 <--- 複数のテーブルを選択した場合は、先頭のテーブルが Entity の
テーブルに使用されます。残りのテーブルのカラムが Entity のプロパティに追加されます。
entity class name ? [DeptEntity] :
[ generate information ]
module name : default
controller name : index
entity class name : DeptEntity
table name : DEPT
columns : DEPTNO, DNAME, LOC, VERSIONNO, EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM
confirm ? (y/n) : y
[INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/models/index/entity/DeptEntity.php
[ Command list ]
0 : (exit)
・・・
choice ? : 0
%
service & dao コマンド
説明
service & dao コマンドはアクション名を決めると、命名規則に従ってアクションメソッドの追加、サービス、dao、enitity、ダイコンファイル、テストクラスを生成します。 actionコマンド、service コマンドと dao コマンドを同時に実行することとほぼ同じ処理になります。 例えばサービス名を「 cdList 」とすると、アクションメソッドは cdListAction、サービスクラスは CdListService、dao クラスは CdListDao、entity クラスは CdListEntitiy となります。
実行例
% s2base
[INFO ] s2base directory : /seasar.php/workspace/s2base.php5/lib/S2Base/build/s2base.php5
[INFO ] project directory : /seasar.php/workspace/s2base.php5
[INFO ] project type : zf
[INFO ] command type : command
[ Command list ]
0 : (exit)
1 : action
2 : dao
3 : entity
4 : service & dao
5 : interceptor
6 : model
7 : module & controller
8 : service
choice ? : 4 <--- 4 : service & dao を選択
[ Module list ]
0 : (exit)
1 : default
choice ? : 1
[ Controller list ]
0 : (exit)
1 : index
choice ? : 1
action name ? : service & dao
use dao ? (y/n) : y
use database ? (y/n) : y <--- データベースのテーブル一覧を取得します。
[ table list ]
0 : (exit)
1 : CD
2 : DEPT
3 : EMP
4 : SHELF
5 : USERS
choices ? (1,2,--,) : 3 <--- 複数のテーブルを選択した場合は、先頭のテーブルが Entity の
テーブルに使用されます。残りのテーブルのカラムが Entity のプロパティに追加されます。
dao interface name [EmpDao]? :
entity class name ? [EmpEntity] :
[ generate information ]
module name : default
controller name : index
action name : goya
format action name : Goya
action method name : goyaAction
action template file : goya.phtml
service class name : GoyaService
service test class name : GoyaServiceTest
dao interface name : EmpDao
dao test class name : EmpDaoTest
entity class name : EmpEntity
table name : EMP
columns : EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO
confirm ? (y/n) : y
[INFO ] modify : /seasar.php/workspace/s2base.php5/app/modules/default/controllers/IndexController.php
・・・
[INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/models/index/entity/EmpEntity.php
[ Command list ]
0 : (exit)
・・・
choice ? : 0
%
interceptor コマンド
説明
S2Aop の MethodInterceptor を実装するクラスを生成します。
実行例
% s2base [INFO ] s2base directory : /seasar.php/workspace/s2base.php5/lib/S2Base/build/s2base.php5 [INFO ] project directory : /seasar.php/workspace/s2base.php5 [INFO ] project type : zf [INFO ] command type : command [ Command list ] 0 : (exit) 1 : action 2 : dao 3 : entity 4 : service & dao 5 : interceptor 6 : model 7 : module & controller 8 : service choice ? : 5 <--- 5 : interceptor を選択 [ Module list ] 0 : (exit) 1 : default choice ? : 1 [ Controller list ] 0 : (exit) 1 : index choice ? : 1 interceptor class name ? : HogeInterceptor [ generate information ] module name : default controoler name : index interceptor class name : HogeInterceptor confirm ? (y/n) : y [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/models/index/interceptor/HogeInterceptor.php [ Command list ] 0 : (exit) ・・・ choice ? : 0 %
model コマンド
説明
Zend_Db_Table クラスを継承した model クラスとそのテストクラスを生成します。
実行例
% s2base [INFO ] s2base directory : /seasar.php/workspace/s2base.php5/lib/S2Base/build/s2base.php5 [INFO ] project directory : /seasar.php/workspace/s2base.php5 [INFO ] project type : zf [INFO ] command type : command [ Command list ] 0 : (exit) 1 : action 2 : dao 3 : entity 4 : service & dao 5 : interceptor 6 : model 7 : module & controller 8 : service choice ? : 6 <--- 6 : model を選択 [ Module list ] 0 : (exit) 1 : default choice ? : 1 [ Controller list ] 0 : (exit) 1 : index choice ? : 1 use database ? (y/n) : y [ table list ] 0 : (exit) 1 : CD 2 : DEPT 3 : EMP 4 : SHELF 5 : USERS choice ? : 1 model class name ? [CdModel] : [ generate information ] module name : default controller name : index table name : CD primary key : ID model class name : CdModel confirm ? (y/n) : y [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/models/index/model/CdModel.php [INFO ] create : /seasar.php/workspace/s2base.php5/test/modules/default/models/index/model/CdModelTest.php [ Command list ] 0 : (exit) ・・・ choice ? : 0 %
module & controller コマンド
説明
module & controller コマンドはモジュールディレクトリにアクションコントローラとそのコントローラディレクトリを作成し、テストディレクトリに機能テストを作成します。
実行例
% s2base [INFO ] s2base directory : /seasar.php/workspace/s2base.php5/lib/S2Base/build/s2base.php5 [INFO ] project directory : /seasar.php/workspace/s2base.php5 [INFO ] project type : zf [INFO ] command type : command [ Command list ] 0 : (exit) 1 : action 2 : dao 3 : entity 4 : service & dao 5 : interceptor 6 : model 7 : module & controller 8 : service choice ? : 7 <--- 7 : module & controller を選択 [ Module list ] 0 : (exit) 1 : (new module) <---Zend Controller のモジュール機能を使用しない場合は 2 : default default を選択します。 choice ? : 2 controller name ? : index [ generate information ] module name : default controller name : index controller class name : IndexController confirm ? (y/n) : y [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/ ・・・ [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/index/view/index.html [ Command list ] 0 : (exit) ・・・ choice ? : 0 %
service コマンド
説明
サービス実装クラス、テストクラスを生成します。
実行例
% s2base [INFO ] s2base directory : /seasar.php/workspace/s2base.php5/lib/S2Base/build/s2base.php5 [INFO ] project directory : /seasar.php/workspace/s2base.php5 [INFO ] project type : zf [INFO ] command type : command [ Command list ] 0 : (exit) 1 : action 2 : dao 3 : entity 4 : service & dao 5 : interceptor 6 : model 7 : module & controller 8 : service choice ? : 8 <--- 8 : service を選択 [ Module list ] 0 : (exit) 1 : default choice ? : 1 [ Controller list ] 0 : (exit) 1 : index choice ? : 1 service class name ? : BarService [ generate information ] module name : default controller name : index service class name : BarService service test class name : BarServiceTest confirm ? (y/n) : y [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/models/index/service/BarService.php [INFO ] create : /seasar.php/workspace/s2base.php5/test/modules/default/models/index/service/BarServiceTest.php [ Command list ] 0 : (exit) ・・・ choice ? : 0 %