cakePHPでのbake(ソース自動生成)手順(windows開発)

ソフト

一時CakePHPの開発から離れたのでbakeコマンドではまってしまった。

ここは手順を整理せねば、ということで備忘録です。

[amazonjs asin=”4865421629″ locale=”JP” title=”AUTO STYLE vol.4 SUZUKI ALTO WORKS & ALTO (CARTOPMOOK)”]

テーブル生成

use test;
DROP TABLE `companys`;
CREATE TABLE companys (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    company  varchar(5),
    company_name VARCHAR(50),
    company_icon VARCHAR(50),
    crcompanyeated DATETIME DEFAULT NULL,
    modified DATETIME DEFAULT NULL
);

 

コマンドプロンプトを開いてプロジェクトに移動し一時パス変更

D:\xampp\htdocs\testProject\app>cd console

D:\xampp\htdocs\testProject\app\Console>SET PATH=%PATH%;%CD%

D:\xampp\htdocs\testProject\app\Console>cd ../../

 

“cake bake all ” コマンド実行

D:\xampp\htdocs\testProject>cake bake all


Welcome to CakePHP v2.9.4 Console
---------------------------------------------------------------
App : app
Path: D:\xampp\htdocs\testProject\app\
---------------------------------------------------------------
Bake All
---------------------------------------------------------------
Possible Models based on your current database:
1. Company
2. User
Enter a number from the list above,
type in the name of another model, or 'q' to exit
[q] > 1

Baking model class for Company...

Creating file D:\xampp\htdocs\testProject\app\Model\Company.php
Wrote `D:\xampp\htdocs\testProject\app\Model\Company.php`

Baking controller class for Companies...

Creating file D:\xampp\htdocs\testProject\app\Controller\CompaniesController.php
Wrote `D:\xampp\htdocs\testProject\app\Controller\CompaniesController.php`
Bake is detecting possible fixtures...

Baking test case for Companies Controller ...

Creating file D:\xampp\htdocs\testProject\app\Test\Case\Controller\CompaniesControllerTest.php
Wrote `D:\xampp\htdocs\testProject\app\Test\Case\Controller\CompaniesControllerTest.php`

Baking `index` view file...

Creating file D:\xampp\htdocs\testProject\app\View\Companies\index.ctp
Wrote `D:\xampp\htdocs\testProject\app\View\Companies\index.ctp`

Baking `view` view file...

Creating file D:\xampp\htdocs\testProject\app\View\Companies\view.ctp
Wrote `D:\xampp\htdocs\testProject\app\View\Companies\view.ctp`

Baking `add` view file...

Creating file D:\xampp\htdocs\testProject\app\View\Companies\add.ctp
Wrote `D:\xampp\htdocs\testProject\app\View\Companies\add.ctp`

Baking `edit` view file...

Creating file D:\xampp\htdocs\testProject\app\View\Companies\edit.ctp
Wrote `D:\xampp\htdocs\testProject\app\View\Companies\edit.ctp`

Bake All complete


D:\xampp\htdocs\testProject>

実行確認

http://localhost:8081/testProject/companies

最近は

すぐ忘れる。年だな。

[amazonjs asin=”4798048577″ locale=”JP” title=”PHPフレームワーク CakePHP 3入門”]

ソフト
スポンサーリンク
sutaruhinをフォローする
システム・スタルヒン合同会社
タイトルとURLをコピーしました