bakeがなんだか出来なかった訳
unix_socketってのを追加した
[php]
public $default = array(
‘datasource’ => ‘Database/Mysql’,
‘persistent’ => false,
‘host’ => ‘localhost’,
‘unix_socket’ => ‘/Applications/MAMP/tmp/mysql/mysql.sock’,
‘login’ => ‘root’,
‘password’ => ‘root’,
‘database’ => ‘cakedictionary’,
‘prefix’ => ”,
//’encoding’ => ‘utf8’,
);
[/php]
「bake」カテゴリーアーカイブ
cakephp 1.3 bakeの仕方 [mac]
ディレクトリに移動
[text]cd /Applications/MAMP/htdocs/cakephp[/text]
bake
[text]./cake/console/cake bake[/text]
エラーが出るので変更
[text]var $default = array(‘driver’ => ‘mysql’,
‘connect’ => ‘mysql_connect’,
‘host’ => ‘127.0.0.1:3306’,
‘login’ => ‘dbuser’,
‘password’ => ‘dbpassword’,
‘database’ => ‘databasename’,
‘prefix’ => ”);[/text]
cake1.3 bake
bakeコマンド
ヘルプ
[text]cake bake -h[/text]
bake
[text]cake bake[/text]
オール作成
[text]cake bake all[/text]
「D」――データベース設定を作成
「M」――モデルの作成
「V」――ビューの作成
「C」――コントローラーの作成
「P」――プロジェクトを作成します。
「F」――フィクスチャ(テスト用データベースデータ)を作成
「T」――テストの作成
「Q」――プログラムを終了
まずモデル
どのモデルを作成しますか?
[text]Possible Models based on your current database:
1. User
Enter a number from the list above,
type in the name of another model, or ‘q’ to exit
[q] > [/text]
バリデーションの設定[テーブルに用意されている1つずつの項目にバリデーションを設定するか?]
[text]Would you like to supply validation criteria
for the fields in your model? (y/n)
[y] > [/text]
どういう連携処理をどのモデルと行うか
[text]Would you like to define model associations
(hasMany, hasOne, belongsTo, etc.)? (y/n)
[y] > [/text]
設定の確認画面
[text]——————————————————
The following Model will be created:
——————————————————
Name: User
DB Table: `users`
——————————————————
Look okay? (y/n)
[y] >[/text]
ユニットテストを作成するか?
[text]PHPUnit is not installed. Do you want to bake unit test files anyway? (y/n)
[y] >[/text]
次にコントローラー
どのModelを使用しコントローラーを作成するか?
[text]ossible Controllers based on your current database:
1. Mydatas
Enter a number from the list above,
type in the name of another controller, or ‘q’ to exit
[q] > [/text]
対話形式でControllerを作っていくか?
[text]——————————————————
Baking MydatasController
——————————————————
Would you like to build your controller interactively? (y/n)
[y] >[/text]
「scaffolding」スカフォウドを使うか?
[text]Would you like to use dynamic scaffolding? (y/n)
[n] >[/text]
「index」「add」「viiew」「edit」を作成するか?
[text]Would you like to create some basic class methods
(index(), add(), view(), edit())? (y/n)
[n] > [/text]
アドミン・ルーティングを作成するか?
[text]Would you like to create the basic class methods for admin routing? (y/n)
[n] >[/text]
Html HelperとForm Helper以外のヘルパーを使うか?
[text]Would you like this controller to use other helpers
besides HtmlHelper and FormHelper? (y/n)
[n] >[/text]
他のコンポーネントを使うか?
[text]Would you like this controller to use any components? (y/n)
[n] >[/text]
フラッシュメッセージを使うか?
[text]Would you like to use Session flash messages? (y/n)
[y] >[/text]
確認画面
[text]——————————————————
The following controller will be created:
——————————————————
Controller Name:
Users
——————————————————
Look okay? (y/n)
[y] >[/text]
Viewの作成
どのビューを作成するか?
[text]Bake View
Path: …Viewのパス…
Possible Controllers based on your current database:
1. Users
Enter a number from the list above,
type in the name of another controller, or ‘q’ to exit
[q] > [/text]
対話形式で作成するか?
[text]Would you like bake to build your views interactively?
Warning: Choosing no will overwrite Mydatas views if it exist. (y/n)
[n] > [/text]
CRUDのViewを作るか(Create/Read/Update/Deleteの略)Controllerに用意したこれらの機能のためのViewを自動生成
[text]Would you like to create some CRUD 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)
[y] >[/text]
アドミン・ルーティングのViewを作るか?
[text]Would you like to create the views for admin routing? (y/n)
[n] >[/text]
bakeの使い方 [Mac] cakephp2.3
cakeのディレクトリへ移動
[text]cd /Applications/MAMP/htdocs/cake[/text]
bakeを実行
[text]./app/Console/cake bake[/text]
※bakeのオールコマンドもあるよ
[text]./app/Console/cake bake all[/text]
Macでエラーが出るので修正 hostを変更
[text]var $default = array(‘driver’ => ‘mysql’,
‘connect’ => ‘mysql_connect’,
‘host’ => ‘127.0.0.1:3306’,
‘login’ => ‘dbuser’,
‘password’ => ‘dbpassword’,
‘database’ => ‘databasename’,
‘prefix’ => ”);[/text]
bake使い方「モデルの作成」[Win] cakephp2.3
bake使い方 [Win] cakephp2.3
1. コマンドプロンプトを起動
(xamppを起動してたら動かない?)
myapp/config フォルダに、database.php が作成される
参考:http://hijiriworld.com/web/cakephp-bake/
コピー用
[php]
cd c:\xampp\php
set path=%path%;%cd%
cd c:\xampp\htdocs\cakephp-2.4\lib\Cake\Console
[/php]