使用generate.php时出现Doctrine致命错误
我正在 http://www.Doctrine-project.org/ 上编写 Doctrine 教程当我尝试运行我的generate.php脚本时,我收到一个致命错误,该脚本使我的模型并在数据库中创建表:
Fatal error: Class 'BaseCharity' not found in ...\models\Charity.php on line 14
generate.php:
require_once('bootstrap.php');
Doctrine_Core::dropDatabases();
Doctrine_Core::createDatabases();
Doctrine_Core::generateModelsFromYaml('schema.yml', 'models');
Doctrine_Core::createTablesFromModels('models');
和schema.yml
Charity:
actAs: [Timestampable]
columns:
active:
type: boolean
default: '1'
owed: decimal(32,2)
totalPayed: decimal(32,2)
name: string(255)
website: string(255)
description: text
icon: string(255)
我对此感到非常困惑,我可以让它正确创建其他与此表非常相似或更复杂的表。我也尝试过重写它。我真的不知道这个错误是从哪里来的。
I'm working on the Doctrine tutorial at http://www.Doctrine-project.org/ and I receive a fatal error when I try to run my generate.php script which makes my models and makes tables in the database:
Fatal error: Class 'BaseCharity' not found in ...\models\Charity.php on line 14
generate.php:
require_once('bootstrap.php');
Doctrine_Core::dropDatabases();
Doctrine_Core::createDatabases();
Doctrine_Core::generateModelsFromYaml('schema.yml', 'models');
Doctrine_Core::createTablesFromModels('models');
and schema.yml
Charity:
actAs: [Timestampable]
columns:
active:
type: boolean
default: '1'
owed: decimal(32,2)
totalPayed: decimal(32,2)
name: string(255)
website: string(255)
description: text
icon: string(255)
I am quite stumped by this, I can get it to correctly create other tables that are very similar or much more complicated then this one. I've tried rewriting it as well. I really have no clue where this error is coming from.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要使用 Doctrine 提供的自动加载器注册模型。不需要使用任何迭代器或其他什么
你当然可以使用它多次:
You need to register the models with the autoloader provided by Doctrine. No need to use any Iterators or what so ever
You can of course use it sevaral times:
找到这个:
http://www.doctrine-project.org/jira/browse /DC-344
Found this:
http://www.doctrine-project.org/jira/browse/DC-344