action コマンド
説明
action コマンドは、アクション名に対して命名規則に従いアクションメソッド、ダイコンファイル、html テンプレートを作成します。 アクション名が「 hello 」の場合、アクションメソッドは helloAction、ダイコンファイルは helloAction.dicon、html テンプレートは hello.html となります。 アクションメソッドは、アクションコントローラに「/** S2BASE_PHP5 ACTION METHOD **/」コメントが記述されている箇所に追加されます。
実行例
% phing zf Buildfile: /seasar.php/workspace/s2base.php5/build.xml ・・・ project > command: [ Command list ] 0 : (exit) 1 : action 2 : dao 3 : entity 4 : goya 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 dicon file : fooAction.dicon action template file : foo.html confirm ? (y/n) : y [INFO ] modify : /seasar.php/workspace/s2base.php5/app/modules/default/IndexController.class.php [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/index/view/foo.html [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/index/dicon/fooAction.dicon [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/index/validate/foo.ini [ Command list ] 0 : (exit) ・・・ choice ? : 0 BUILD FINISHED Total time: 17.7941 seconds %
dao コマンド
説明
S2Dao で必要な dao インタフェース、entity クラス、dao コンポーネント定義済みの dicon ファイル、テストクラスを生成します。
実行例
% phing zf
Buildfile: /seasar.php/workspace/s2base.php5/build.xml
・・・
project > command:
[ Command list ]
0 : (exit)
1 : action
2 : dao
3 : entity
4 : goya
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
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
dao dicon file name : CdDao.dicon
confirm ? (y/n) : y
[INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/index/dao/CdDao.class.php
[INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/index/entity/CdEntity.class.php
[INFO ] create : /seasar.php/workspace/s2base.php5/test/modules/default/index/dao/CdDaoTest.class.php
[INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/index/dicon/CdDao.dicon
[ Command list ]
0 : (exit)
・・・
choice ? : 0
BUILD FINISHED
Total time: 17.7941 seconds
%
entity コマンド
説明
S2Dao で用いる Entity クラスを作成します。columns でカンマ区切りのカラム名を入力すると、対応するプロパティとアクセッサメソッドを追加します。
実行例
% phing zf
Buildfile: /seasar.php/workspace/s2base.php5/build.xml
・・・
project > command:
[ Command list ]
0 : (exit)
1 : action
2 : dao
3 : entity
4 : goya
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
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/index/entity/DeptEntity.class.php
[ Command list ]
0 : (exit)
・・・
choice ? : 0
BUILD FINISHED
Total time: 17.7941 seconds
%
goya コマンド
説明
goya コマンドはアクション名を決めると、命名規則に従ってアクションメソッドの追加、サービス、dao、enitity、ダイコンファイル、テストクラスを生成します。 actionコマンド、service コマンドと dao コマンドを同時に実行することとほぼ同じ処理になります。 例えばサービス名を「 cdList 」とすると、アクションメソッドは cdListAction、サービスクラスは CdListService、dao クラスは CdListDao、entity クラスは CdListEntitiy となります。
実行例
% phing zf
Buildfile: /seasar.php/workspace/s2base.php5/build.xml
・・・
project > command:
[ Command list ]
0 : (exit)
1 : action
2 : dao
3 : entity
4 : goya
5 : interceptor
6 : model
7 : module & controller
8 : service
choice ? : 4 <--- 4 : goya を選択
[ Module list ]
0 : (exit)
1 : default
choice ? : 1
[ Controller list ]
0 : (exit)
1 : index
choice ? : 1
action name ? : goya
use dao ? (y/n) : y
use database ? (y/n) : y <--- データベースのテーブル一覧を取得します。
[ table list ]
0 : (exit)
1 : CD
2 : DEPT
3 : EMP
4 : SHELF
choices ? (1,2,--,) : 3 <--- 複数のテーブルを選択した場合は、先頭のテーブルが Entity の
テーブルに使用されます。残りのテーブルのカラムが Entity のプロパティに追加されます。
dao interface name [GoyaDao]? :
entity class name ? [GoyaEntity] :
[ generate information ]
module name : default
controller name : index
action name : goya
format action name : Goya
action method name : goyaAction
action dicon file name : goyaAction.dicon
action template file : goya.html
service interface name : GoyaService
service class name : GoyaServiceImpl
service test class name : GoyaServiceImplTest
service dicon file name : GoyaServiceImpl.dicon
dao interface name : GoyaDao
dao test class name : GoyaDaoTest
entity class name : GoyaEntity
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/IndexController.class.php
・・・
[INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/index/entity/GoyaEntity.class.php
[ Command list ]
0 : (exit)
・・・
choice ? : 0
BUILD FINISHED
Total time: 17.7941 seconds
%
interceptor コマンド
説明
S2Aop の MethodInterceptor を実装するクラスを生成します。
実行例
% phing zf Buildfile: /seasar.php/workspace/s2base.php5/build.xml ・・・ project > command: [ Command list ] 0 : (exit) 1 : action 2 : dao 3 : entity 4 : goya 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/index/interceptor/HogeInterceptor.class.php [ Command list ] 0 : (exit) ・・・ choice ? : 0 BUILD FINISHED Total time: 17.7941 seconds %
model コマンド
説明
Zend_Db_Table クラスを継承した model クラスとそのテストクラスを生成します。
実行例
% phing zf Buildfile: /seasar.php/workspace/s2base.php5/build.xml ・・・ project > command: [ Command list ] 0 : (exit) 1 : action 2 : dao 3 : entity 4 : goya 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 choice ? : 1 model interface name ? [CDModel] : model class name ? [CDModelImpl] : [ generate information ] module name : default controller name : index table name : CD primary key : ID model interface name : CDModel model class name : CDModelImpl confirm ? (y/n) : y [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/index/model/CDModelImpl.class.php [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/index/model/CDModel.class.php [INFO ] create : /seasar.php/workspace/s2base.php5/test/modules/default/index/model/CDModelImplTest.class.php [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/index/dicon/CDModelImpl.dicon [ Command list ] 0 : (exit) ・・・ choice ? : 0 BUILD FINISHED Total time: 17.7941 seconds %
module & controller コマンド
説明
module & controller コマンドはモジュールディレクトリにアクションコントローラとそのコントローラディレクトリを作成します。
実行例
% phing zf Buildfile: /seasar.php/workspace/s2base.php5/build.xml ・・・ project > command: [ Command list ] 0 : (exit) 1 : action 2 : dao 3 : entity 4 : goya 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 controller interface name : IndexService 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 BUILD FINISHED Total time: 17.7941 seconds %
service コマンド
説明
サービスインタフェース、実装クラス、ダイコンファイル、テストクラスを生成します。
実行例
% phing zf Buildfile: /seasar.php/workspace/s2base.php5/build.xml ・・・ project > command: [ Command list ] 0 : (exit) 1 : action 2 : dao 3 : entity 4 : goya 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 interface name ? : BarService implements IndexService ? (y/n) : y service class name ? [BarServiceImpl] : [ generate information ] module name : default controller name : index service interface name : BarService implements module service : Yes (IndexService) service class name : BarServiceImpl service test class name : BarServiceImplTest service dicon file name : BarServiceImpl.dicon confirm ? (y/n) : y [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/index/service/BarServiceImpl.class.php [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/index/service/BarService.class.php [INFO ] create : /seasar.php/workspace/s2base.php5/test/modules/default/index/service/BarServiceImplTest.class.php [INFO ] create : /seasar.php/workspace/s2base.php5/app/modules/default/index/dicon/BarServiceImpl.dicon [ Command list ] 0 : (exit) ・・・ choice ? : 0 BUILD FINISHED Total time: 17.7941 seconds %
UnitTest タスク
説明
S2Base コマンドの service、dao、goya、model では、UnitTestが生成されます。これらの UnitTest を実行するタスクです。 テストの実行は、phing コマンドを サブタスク( -Dst )を指定して実行します。
実行例
% phing zf -Dst=test
Buildfile: /seasar.php/workspace/s2base.php5/build.xml
・・・
[phing] Calling Buildfile '/seasar.php/workspace/s2base.php5/vendor/plugs/zf/zf.xml' with target 'test'
project > prepare:
[php] Evaluating PHP expression: require_once('vendor/plugins/zf/config/evironment.inc.php')
project > test:
[echo] test directory : test/
[echo] test target : **/*Test*.php
GoyaDaoTest::testA
[phpunit2] Testsuite: GoyaDaoTest
[phpunit2] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.03941 sec
GoyaServiceImplTest::testA
[phpunit2] Testsuite: GoyaServiceImplTest
[phpunit2] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.02663 sec
BUILD FINISHED
Total time: 3.6707 seconds
%