メニュー

ドキュメント

init-app コマンド

説明

 init-app コマンドは symfony の init-app コマンドをラップし、S2Containerを利用する為の設定ファイルを配置します。

実行例

% s2base 
[INFO ] s2base  directory : /opt/local/lib/php/S2Base
[INFO ] project directory : /work/web/s2sf
[INFO ] project type      : symfony
[INFO ] command type      : command

[ Command list ]
0 : (exit)
1 : clear-cache
2 : dao
3 : entity
4 : init-app
5 : init-module
6 : service
choice ? : 4               <--- 4 : init-app を選択

application name ? : demo

[ generate information ]
  application name   : demo

confirm ? (y/n) : y

>> dir+      /work/web/s2sf/apps/demo/config
>> file+     /work/web/s2sf/apps/demo/config/app.yml
.......
>> chmod 777 web/uploads/assets
>> dir+      /work/web/s2sf/test/functional/demo
[INFO ] create : /work/web/s2sf/apps/demo/lib/S2Base_FrontWebController.class.php
[INFO ] create : /work/web/s2sf/apps/demo/config/factories.yml
[INFO ] create : /work/web/s2sf/lib/dao
[INFO ] create : /work/web/s2sf/lib/entity
[INFO ] create : /work/web/s2sf/test/unit/dao
[INFO ] create : /work/web/s2sf/test/unit/TestHelper.php

[ Command list ]
0 : (exit)
・・・
choice ? : 0
%

init-module コマンド

説明

 init-module コマンドは symfony の init-module コマンドをラップし、S2Containerを呼び出すための Controller や 設定ファイルを配置します。

実行例

% s2base
[INFO ] s2base  directory : /opt/local/lib/php/S2Base
[INFO ] project directory : /work/web/s2sf
[INFO ] project type      : symfony
[INFO ] command type      : command

[ Command list ]
0 : (exit)
1 : clear-cache
2 : dao
3 : entity
4 : init-app
5 : init-module
6 : service
choice ? : 5               <--- 1 : init-module を選択

[ App list ]
0 : (exit)
1 : demo
choice ? : 1

module name ? : products  

[ generate information ]
  application name   : demo
  module name        : products

confirm ? (y/n) : y

>> dir+      /work/web/s2sf/apps/demo/modules/products/actions
>> file+     /work/web/s2sf/apps/demo/module...ducts/actions/actions.class.php
>> dir+      /work/web/s2sf/apps/demo/modules/products/config
>> dir+      /work/web/s2sf/apps/demo/modules/products/lib
>> dir+      /work/web/s2sf/apps/demo/modules/products/templates
>> file+     /work/web/s2sf/apps/demo/module...ucts/templates/indexSuccess.php
>> dir+      /work/web/s2sf/apps/demo/modules/products/validate
>> file+     /work/web/s2sf/test/functional/demo/productsActionsTest.php
>> tokens    /work/web/s2sf/test/functional/demo/productsActionsTest.php
>> tokens    /work/web/s2sf/apps/demo/module...ducts/actions/actions.class.php
>> tokens    /work/web/s2sf/apps/demo/module...ucts/templates/indexSuccess.php
[INFO ] create : /work/web/s2sf/apps/demo/modules/products/interceptor
[INFO ] create : /work/web/s2sf/apps/demo/modules/products/service
[INFO ] create : /work/web/s2sf/test/unit/demo/products/service
[INFO ] create : /work/web/s2sf/apps/demo/config/autoload.yml

[ Command list ]
0 : (exit)
・・・
choice ? : 0
%

clear-cache コマンド

説明

 symfonyのclear-cacheコマンドをラップし、プロジェクトのキャッシュを削除します。

dao コマンド

説明

 S2Dao で必要な dao インタフェース、entity クラス、テストクラスを生成します。生成先は sf_root_dir/lib/dao, sf_root_dir/lib/entity, sf_root_dir/test/unit/dao になります。

実行例

% s2base             
[INFO ] s2base  directory : /opt/local/lib/php/S2Base
[INFO ] project directory : /work/web/s2sf
[INFO ] project type      : symfony
[INFO ] command type      : command

[ Command list ]
0 : (exit)
1 : clear-cache
2 : dao
3 : entity
4 : init-app
5 : init-module
6 : service
choice ? : 2                 <--- 2 : dao を選択

use database ? (y/n) : y     <--- データベースのテーブル一覧を取得します。

[ table list ]
0 : (exit)
1 : groups
2 : members
3 : memberships
choices ? (1,2,--,) : 1     <--- 複数のテーブルを選択した場合は、先頭のテーブルが Entity の
                                 テーブルに使用されます。残りのテーブルのカラムが Entity のプロパティに追加されます。

dao interface name [GroupsDao]? : GroupDao

entity class name ? [GroupsEntity] : GroupEntity

[ generate information ]
  dao interface name   : GroupDao 
  dao test class name  : GroupDaoTest 
  entity class name    : GroupEntity 

confirm ? (y/n) : y

[INFO ] create : /work/web/s2sf/lib/dao/GroupDao.class.php
[INFO ] create : /work/web/s2sf/lib/entity/GroupEntity.class.php
[INFO ] create : /work/web/s2sf/test/unit/dao/GroupDaoTest.class.php

[ Command list ]
0 : (exit)
・・・
choice ? : 0
%

entity コマンド

説明

 S2Dao で用いる Entity クラスを作成します。columns でカンマ区切りのカラム名を入力すると、対応するプロパティとアクセッサメソッドを追加します。

実行例

% s2base 
[INFO ] s2base  directory : /opt/local/lib/php/S2Base
[INFO ] project directory : /work/web/s2sf
[INFO ] project type      : symfony
[INFO ] command type      : command

[ Command list ]
0 : (exit)
1 : clear-cache
2 : dao
3 : entity
4 : init-app
5 : init-module
6 : service
choice ? : 3

use database ? (y/n) : y     <--- データベースのテーブル一覧を取得します。

[ table list ]
0 : (exit)
1 : groups
2 : members
3 : memberships
choices ? (1,2,--,) : 2      <--- 複数のテーブルを選択した場合は、先頭のテーブルが Entity の
                                  テーブルに使用されます。残りのテーブルのカラムが Entity のプロパティに追加されます。


entity class name ? [MembersEntity] : MemberEntity

[ generate information ]
  entity class name    : MemberEntity
  table name           : members
  columns              : id, name, password, created_at

confirm ? (y/n) : y

[INFO ] create : /work/web/s2sf/lib/entity/MemberEntity.class.php

[ Command list ]
0 : (exit)
・・・
choice ? : 0

%

service コマンド

説明

サービス実装クラス、テストクラスを生成します。

実行例

% s2base
[INFO ] s2base  directory : /opt/local/lib/php/S2Base
[INFO ] project directory : /work/web/s2sf
[INFO ] project type      : symfony
[INFO ] command type      : command

[ Command list ]
0 : (exit)
1 : clear-cache
2 : dao
3 : entity
4 : init-app
5 : init-module
6 : service
choice ? : 6                 <--- 6 : service を選択

[ App list ]
0 : (exit)
1 : demo
choice ? : 1

[ Module list ]
0 : (exit)
1 : products
choice ? : 1

service class name ? : ProductsListService

[ generate information ]
  module name             : products
  service class name      : ProductsListService
  service test class name : ProductsListServiceTest

confirm ? (y/n) : y

[INFO ] create : /work/web/s2sf/apps/demo/modules/products/service/ProductsListService.class.php
[INFO ] create : /work/web/s2sf/test/unit/demo/products/service/ProductsListServiceTest.class.php


[ Command list ]
0 : (exit)
・・・
choice ? : 0
%