「bake」の編集履歴(バックアップ)一覧に戻る
bake - (2006/07/30 (日) 00:11:28) のソース
/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が自動生成されました。 ※OSX MAMP環境の場合、 'host'=>'localhost' でもCakePHP自体は動作しますが、bake.phpを使う場合、 'host'=>'127.0.0.1:8889' というように、ポートまで指定する必要があります。