プロが教える店舗&オフィスのセキュリティ対策術

Bakeの使い方について教えてください。

モデルを作るときに
「Table sales does not exist, cannot bake a model without a table.」
というメッセージが出て、そこから先に進むことができません。


まず、Bakeを立ち上げて下記の画面でモデルを選びました。

Welcome to CakePHP v1.3.14 Console
---------------------------------------------------------------
App : photo
Path: /home/me/sample
---------------------------------------------------------------
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
---------------------------------------------------------------

MySQLに登録されているテーブル名が下記のように表示されました。
(テーブル名が出てくるので、MySQLの接続はOKだとは思います)


---------------------------------------------------------------
Bake Model
Path: /home/me/sample/models/
---------------------------------------------------------------
Use Database Config: (default/test)
[default] >
Possible Models based on your current database:
1. Sample
2. Customer
3. Sale
Enter a number from the list above,
type in the name of another model, or 'q' to exit
[q] > 3
---------------------------------------------------------------

3番目の「Sale」のモデルを作りたいので3を入力しました。

すると下記のようなメッセージがでて、bakeが終了してしまいます。

---------------------------------------------------------------

Given your model named 'Sale',
Cake would expect a database table named 'sales'
Do you want to use this table? (y/n)
[y] >y
Table sales does not exist, cannot bake a model without a table.
---------------------------------------------------------------

A 回答 (1件)

実際のtable 名は何ですか? 複数形にしてないのかと思われますが。


| Cake would expect a database table named 'sales'
| Do you want to use this table? (y/n)
この質問は、「sales」 という複数形のtable名で存在するなら [y] 、名前が違うのならば [n] をいれて、実際のtable名を指定し直す部分です。
    • good
    • 0
この回答へのお礼

mpro-gramさん。
ご回答ありがとうございます。

テーブル名をチェックしてみました。
現在書籍を使って学習しているのですが、テーブルを作成するSQL文をインポートしたところ、テーブル名の頭文字が大文字になっていました。
小文字に修正したらうまく動きました。

お礼日時:2012/12/23 02:07

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!