我是蛋糕新手,在烘焙时遇到了一些问题...我在 MAC OS 上的 MAMP 服务器上使用 cake php 2.2.1。我已经关闭了复数/单数感染器......我试着烤一些桌子:
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伙计们%)