bakeでBancha用のモデルとコントローラの作成
bakeで自動生成します。 まず、カレントディレクトリをappにして
cd UserDir/public_html/app
./Console/cake bake
を実行。
DB設定
Welcome to CakePHP v2.2.0 Console
---------------------------------------------------------------
App : app
Path: /Volumes/DataDrive/UserDir/banchatest2/public_html/app/
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
> D
---------------------------------------------------------------
Database Configuration:
---------------------------------------------------------------
Name:
[default] >
Datasource: (Mysql/Postgres/Sqlite/Sqlserver)
[Mysql] >
Persistent Connection? (y/n)
[n] >
Database Host:
[localhost] >
Port?
[n] >
User:
[root] > web
Password:
> ************************
Database Name:
[cake] > tasks
Table Prefix?
[n] >
Table encoding?
[n] > UTF8
---------------------------------------------------------------
The following database configuration will be created:
---------------------------------------------------------------
Name: default
Datasource: Mysql
Persistent: false
Host: localhost
User: web
Pass: ******
Database: tasks
Encoding: UTF8
---------------------------------------------------------------
Look okay? (y/n)
[y] > y
Do you wish to add another database configuration?
[n] > n
Creating file /Users/froggugugugu/UserDir/banchatest/public_html/app/Config/database.php
Wrote `/Users/froggugugugu/UserDir/banchatest/public_html/app/Config/database.php`
次にモデル。
Welcome to CakePHP v2.2.0 Console
---------------------------------------------------------------
App : app
Path: /Users/froggugugugu/UserDir/cakephpTest/public_html/app/
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
> M
---------------------------------------------------------------
Bake Model
Path: /Users/froggugugugu/UserDir/cakephpTest/public_html/app/Model/
---------------------------------------------------------------
Possible Models based on your current database:
1. TblPlan
2. TblProject
3. TblUser
Enter a number from the list above,
type in the name of another model, or 'q' to exit
[q] > 3
What is the primaryKey?
[Id] >
.....略..................
.....途中でBancha用のテンプレート選択..................
Associations:
---------------------------------------------------------------
Look okay? (y/n)
[y] > y
---------------------------------------------------------------
You have more than one set of templates installed.
Please choose the template set you wish to use:
---------------------------------------------------------------
1. bancha
2. default
Which bake theme would you like to use? (1/2)
[1] > 1
Baking model class for TblUser...
Creating file /Users/froggugugugu/UserDir/banchatest/public_html/app/Model/TblUser.php
Wrote `/Users/froggugugugu/UserDir/banchatest/public_html/app/Model/TblUser.php`
で、モデル出来上がり。
次にコントローラ
What would you like to Bake? (D/M/V/C/P/F/T/Q)
> C
---------------------------------------------------------------
Bake Controller
Path: /Users/froggugugugu/UserDir/banchatest/public_html/app/Controller/
---------------------------------------------------------------
Possible Controllers based on your current database:
---------------------------------------------------------------
1. TblPlans
2. TblProjects
3. TblUsers
Enter a number from the list above,
type in the name of another controller, or 'q' to exit
[q] > 3
---------------------------------------------------------------
Baking TblUsersController
---------------------------------------------------------------
Would you like to build your controller interactively? (y/n)
[y] >
Would you like to use dynamic scaffolding? (y/n)
[n] >
Would you like to create some basic class methods
(index(), add(), view(), edit())? (y/n)
[n] > y
Would you like to create the basic class methods for admin routing? (y/n)
[n] >
Would you like this controller to use other helpers
besides HtmlHelper and FormHelper? (y/n)
[n] >
Would you like this controller to use any components? (y/n)
[n] >
Would you like to use Session flash messages? (y/n)
[y] >
---------------------------------------------------------------
The following controller will be created:
---------------------------------------------------------------
Controller Name:
TblUsers
---------------------------------------------------------------
Look okay? (y/n)
[y] > y
Baking controller class for TblUsers...
Creating file /Users/froggugugugu/UserDir/banchatest/public_html/app/Controller/TblUsersController.php
Wrote `/Users/froggugugugu/UserDir/banchatest/public_html/app/Controller/TblUsersController.php`
ひとまず完了
さっそく出来上がったものを見て見ます。
0 件のコメント:
コメントを投稿