我是新蛋糕,我在烘烤时遇到一些问题...我在MAc OS上的MAMP服务器上使用cake php 2.2.1。 我已经关掉了plurar / singlar infector ......我试着烤一些桌子:
CREATE TABLE users (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL UNIQUE,
password CHAR(40) NOT NULL,
email VARCHAR(40) NOT NULL,
group_id INT(11) NOT NULL,
created DATETIME,
modified DATETIME
);# MySQL returned an empty result set (i.e. zero rows).
CREATE TABLE users_groups (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
created DATETIME,
modified DATETIME
);# MySQL returned an empty result set (i.e. zero rows).
CREATE TABLE novosti (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
url VARCHAR(255) NOT NULL UNIQUE KEY,
user_id INT(11) NOT NULL,
title VARCHAR(255) NOT NULL,
body TEXT,
published INT(1) DEFAULT 1,
created DATETIME,
modified DATETIME
);# MySQL returned an empty result set (i.e. zero rows).
CREATE TABLE meta (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
controller VARCHAR(255) NOT NULL UNIQUE KEY,
action_name VARCHAR(255) NOT NULL,
action_id VARCHAR(255),
title VARCHAR(255) NOT NULL,
keywords VARCHAR(255) NOT NULL,
description VARCHAR(255) NOT NULL,
created DATETIME,
modified DATETIME
);# MySQL returned an empty result set (i.e. zero rows).
所以,当我“蛋糕烘烤所有” - “users_groups”我不会得到错误,但如果“蛋糕烘烤所有”其他3个表我得到相同的错误,所以我得到一个模型和一个控制器文件,但不是视图文件...所以问题在于烘焙视图文件..这是我的控制台日志:
What would you like to Bake? (D/M/V/C/P/F/T/Q)
> v
---------------------------------------------------------------
Bake View
Path: /Applications/MAMP/htdocs/app/View/
---------------------------------------------------------------
Use Database Config: (default/test)
[default] >
Possible Controllers based on your current database:
---------------------------------------------------------------
1. Meta
2. Novosti
3. Users
4. UsersGroups
Enter a number from the list above,
type in the name of another controller, or 'q' to exit
[q] > 1
Would you like bake to build your views interactively?
Warning: Choosing no will overwrite Meta views if it exist. (y/n)
[n] > y
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] > y
Would you like to create the views for admin routing? (y/n)
[n] > n
Error: Table action for model Action was not found in datasource default.
#0 /Applications/MAMP/htdocs/lib/Cake/Model/Model.php(3180): Model->setSource('action')
#1 /Applications/MAMP/htdocs/lib/Cake/Model/Model.php(1301): Model->getDataSource()
#2 /Applications/MAMP/htdocs/lib/Cake/Model/Model.php(1389): Model->schema()
#3 /Applications/MAMP/htdocs/lib/Cake/Model/Model.php(1375): Model->hasField('title', false)
#4 /Applications/MAMP/htdocs/lib/Cake/Model/Model.php(863): Model->hasField(Array)
#5 /Applications/MAMP/htdocs/lib/Cake/Console/Command/Task/ViewTask.php(459): Model->__get('displayField')
#6 /Applications/MAMP/htdocs/lib/Cake/Console/Command/Task/ViewTask.php(284): ViewTask->_associations(Object(Meta))
#7 /Applications/MAMP/htdocs/lib/Cake/Console/Command/Task/ViewTask.php(223): ViewTask->_loadController()
#8 /Applications/MAMP/htdocs/lib/Cake/Console/Command/Task/ViewTask.php(90): ViewTask->_interactive()
#9 /Applications/MAMP/htdocs/lib/Cake/Console/Command/BakeShell.php(110): ViewTask->execute()
#10 /Applications/MAMP/htdocs/lib/Cake/Console/Command/BakeShell.php(131): BakeShell->main()
#11 /Applications/MAMP/htdocs/lib/Cake/Console/Command/BakeShell.php(131): BakeShell->main()
#12 /Applications/MAMP/htdocs/lib/Cake/Console/Shell.php(393): BakeShell->main()
#13 /Applications/MAMP/htdocs/lib/Cake/Console/ShellDispatcher.php(201): Shell->runCommand(NULL, Array)
#14 /Applications/MAMP/htdocs/lib/Cake/Console/ShellDispatcher.php(69): ShellDispatcher->dispatch()
#15 /Applications/MAMP/htdocs/app/Console/cake.php(33): ShellDispatcher::run(Array)
#16 {main}
帮助plz家伙%)
答案 0 :(得分:0)
我遇到了类似的问题。在“meta”表中,您有一个名为“action_id”的字段。 Cake正在尝试将关联与表/模型命名为actions。看起来你错过了那张桌子。创建您的操作表并尝试。我看到我遇到的另一个问题。蛋糕喜欢你最低限度地拥有id,名称,创建和修改。有时它没有名字就可以工作,但是当我没有名字时我就遇到了问题。
祝你好运!吉姆