クラスの自動生成
CakePHP のBake コマンドでスケルトンクラスの生成
※ ここで作成しているクラスの意味は後で調べて記述します。
# cd /var/www/app/app/Plugin/
# Console/cake bake plugin Simpletexts
Welcome to CakePHP v2.8.9 Console
---------------------------------------------------------------
App : app
Path: /var/www/app/app/
---------------------------------------------------------------
1. /var/www/app/app/Plugin/
2. /var/www/app/vendors/cakephp/cakephp/plugins/
Choose a plugin path from the paths above.
[1] >
---------------------------------------------------------------
Plugin Name: Simpletexts
Plugin Directory: /var/www/app/app/Plugin/Simpletexts
---------------------------------------------------------------
Look okay? (y/n/q)
[y] > y
Creating file /var/www/app/app/Plugin/Simpletexts/Controller/SimpletextsAppController.php
Wrote `/var/www/app/app/Plugin/Simpletexts/Controller/SimpletextsAppController.php`
Creating file /var/www/app/app/Plugin/Simpletexts/Model/SimpletextsAppModel.php
Wrote `/var/www/app/app/Plugin/Simpletexts/Model/SimpletextsAppModel.php`
/var/www/app/app/Config/bootstrap.php modified
---------------------------------------------------------------
Created: Simpletexts in /var/www/app/app/Plugin/Simpletexts
Simpletexts テーブルに対するモデルクラスの生成
# cd /var/www/app/app # Console/cake bake model Simpletexts --plugin Simpletexts -c master Welcome to CakePHP v2.8.9 Console --------------------------------------------------------------- App : app Path: /var/www/app/app/ --------------------------------------------------------------- --------------------------------------------------------------- You have more than one set of templates installed. Please choose the template set you wish to use: --------------------------------------------------------------- 1. NetCommons 2. default Which bake theme would you like to use? (1/2) [1] > Baking model class for Simpletext... Creating file /var/www/app/app/Plugin/Simpletexts/Model/Simpletext.php Wrote `/var/www/app/app/Plugin/Simpletexts/Model/Simpletext.php` Baking test fixture for Simpletext... Creating file /var/www/app/app/Plugin/Simpletexts/Test/Fixture/SimpletextFixture.php Wrote `/var/www/app/app/Plugin/Simpletexts/Test/Fixture/SimpletextFixture.php` Bake is detecting possible fixtures... Baking test case for Simpletext Model ... Creating file /var/www/app/app/Plugin/Simpletexts/Test/Case/Model/SimpletextTest.php Wrote `/var/www/app/app/Plugin/Simpletexts/Test/Case/Model/SimpletextTest.php`
SimpletextFrameSettings テーブルに対するモデルクラスの生成
# Console/cake bake model SimpletextFrameSettings --plugin Simpletexts -c master
Welcome to CakePHP v2.8.9 Console
---------------------------------------------------------------
App : app
Path: /var/www/app/app/
---------------------------------------------------------------
---------------------------------------------------------------
You have more than one set of templates installed.
Please choose the template set you wish to use:
---------------------------------------------------------------
1. NetCommons
2. default
Which bake theme would you like to use? (1/2)
[1] >
Baking model class for SimpletextFrameSetting...
Creating file /var/www/app/app/Plugin/Simpletexts/Model/SimpletextFrameSetting.php
Wrote `/var/www/app/app/Plugin/Simpletexts/Model/SimpletextFrameSetting.php`
Baking test fixture for SimpletextFrameSetting...
Creating file /var/www/app/app/Plugin/Simpletexts/Test/Fixture/SimpletextFrameSettingFixture.php
Wrote `/var/www/app/app/Plugin/Simpletexts/Test/Fixture/SimpletextFrameSettingFixture.php`
Bake is detecting possible fixtures...
Baking test case for SimpletextFrameSetting Model ...
Creating file /var/www/app/app/Plugin/Simpletexts/Test/Case/Model/SimpletextFrameSettingTest.php
Wrote `/var/www/app/app/Plugin/Simpletexts/Test/Case/Model/SimpletextFrameSettingTest.php`
コントローラの生成(表示画面)
# Console/cake bake controller Simpletexts --plugin Simpletexts -c master
Welcome to CakePHP v2.8.9 Console
---------------------------------------------------------------
App : app
Path: /var/www/app/app/
---------------------------------------------------------------
Baking controller class for Simpletexts...
---------------------------------------------------------------
You have more than one set of templates installed.
Please choose the template set you wish to use:
---------------------------------------------------------------
1. NetCommons
2. default
Which bake theme would you like to use? (1/2)
[1] >
Creating file /var/www/app/app/Plugin/Simpletexts/Controller/SimpletextsController.php
Wrote `/var/www/app/app/Plugin/Simpletexts/Controller/SimpletextsController.php`
Bake is detecting possible fixtures...
Baking test case for Simpletexts Controller ...
Creating file /var/www/app/app/Plugin/Simpletexts/Test/Case/Controller/SimpletextsControllerTest.php
Wrote `/var/www/app/app/Plugin/Simpletexts/Test/Case/Controller/SimpletextsControllerTest.php`
コントローラの生成(表示設定画面)
# Console/cake bake controller SimpletextFrameSettings --plugin Simpletexts -c master Welcome to CakePHP v2.8.9 Console --------------------------------------------------------------- App : app Path: /var/www/app/app/ --------------------------------------------------------------- Baking controller class for SimpletextFrameSettings... --------------------------------------------------------------- You have more than one set of templates installed. Please choose the template set you wish to use: --------------------------------------------------------------- 1. NetCommons 2. default Which bake theme would you like to use? (1/2) [1] > Creating file /var/www/app/app/Plugin/Simpletexts/Controller/SimpletextFrameSettingsController.php Wrote `/var/www/app/app/Plugin/Simpletexts/Controller/SimpletextFrameSettingsController.php` Bake is detecting possible fixtures... Baking test case for SimpletextFrameSettings Controller ... Creating file /var/www/app/app/Plugin/Simpletexts/Test/Case/Controller/SimpletextFrameSettingsControllerTest.php Wrote `/var/www/app/app/Plugin/Simpletexts/Test/Case/Controller/SimpletextFrameSettingsControllerTest.php`
コントローラの生成(Viewの生成 1)
# Console/cake bake view Simpletexts --plugin Simpletexts -c master
Welcome to CakePHP v2.8.9 Console
---------------------------------------------------------------
App : app
Path: /var/www/app/app/
---------------------------------------------------------------
---------------------------------------------------------------
You have more than one set of templates installed.
Please choose the template set you wish to use:
---------------------------------------------------------------
1. NetCommons
2. default
Which bake theme would you like to use? (1/2)
[1] >
Baking `index` view file...
Creating file /var/www/app/app/Plugin/Simpletexts/View/Simpletexts/index.ctp
Wrote `/var/www/app/app/Plugin/Simpletexts/View/Simpletexts/index.ctp`
Baking `view` view file...
Creating file /var/www/app/app/Plugin/Simpletexts/View/Simpletexts/view.ctp
Wrote `/var/www/app/app/Plugin/Simpletexts/View/Simpletexts/view.ctp`
Baking `add` view file...
Creating file /var/www/app/app/Plugin/Simpletexts/View/Simpletexts/add.ctp
Wrote `/var/www/app/app/Plugin/Simpletexts/View/Simpletexts/add.ctp`
Baking `edit` view file...
Creating file /var/www/app/app/Plugin/Simpletexts/View/Simpletexts/edit.ctp
Wrote `/var/www/app/app/Plugin/Simpletexts/View/Simpletexts/edit.ctp`
コントローラの生成(Viewの生成 2)
# Console/cake bake view SimpletextFrameSettings --plugin Simpletexts -c master
Welcome to CakePHP v2.8.9 Console
---------------------------------------------------------------
App : app
Path: /var/www/app/app/
---------------------------------------------------------------
---------------------------------------------------------------
You have more than one set of templates installed.
Please choose the template set you wish to use:
---------------------------------------------------------------
1. NetCommons
2. default
Which bake theme would you like to use? (1/2)
[1] >
Baking `index` view file...
Creating file /var/www/app/app/Plugin/Simpletexts/View/SimpletextFrameSettings/index.ctp
Wrote `/var/www/app/app/Plugin/Simpletexts/View/SimpletextFrameSettings/index.ctp`
Baking `view` view file...
Creating file /var/www/app/app/Plugin/Simpletexts/View/SimpletextFrameSettings/view.ctp
Wrote `/var/www/app/app/Plugin/Simpletexts/View/SimpletextFrameSettings/view.ctp`
Baking `add` view file...
Creating file /var/www/app/app/Plugin/Simpletexts/View/SimpletextFrameSettings/add.ctp
Wrote `/var/www/app/app/Plugin/Simpletexts/View/SimpletextFrameSettings/add.ctp`
Baking `edit` view file...
Creating file /var/www/app/app/Plugin/Simpletexts/View/SimpletextFrameSettings/edit.ctp
Wrote `/var/www/app/app/Plugin/Simpletexts/View/SimpletextFrameSettings/edit.ctp`