2012-05-01 41 views
1

我有一个推动奇怪的问题。 我在config.yml配置:Symfony 2/Propel:Class'Phing'未找到,自动加载?

propel: 

    dbal: 
     driver:  %database_driver% 
     user:  %database_user% 
     password: %database_password% 
     dsn:  %database_driver%:host=%database_host%;dbname=%database_name%;charset=UTF8 
     path:  %kernel.root_dir%/../vendor/propel 
     phing_path: %kernel.root_dir%/../vendor/phing 

我创造了我的数据库与该命令:php app/console propel:database:create和它的工作非常好,但是当我试图创建我的第一个表php app/console propel:model:build我一个致命的错误有说服力:PHP Fatal error: Class 'Phing' not found.

我在文件夹中验证过,一切都在那里。我想这是一个自动加载问题,但我已经按照http://www.propelorm.org/cookbook/symfony2/working-with-symfony2.htmlhttp://symfony.com/doc/master/book/propel.html

的文档有任何想法吗?非常感谢!

+0

在哪个文件中以及在哪一行是错误报告? – hakre

回答

1

您使用哪种依赖关系管理系统?

这是一个自动加载的问题,您应该加上以下定义:

$loader->registerPrefixes(array(
    ... 

    'Phing' => __DIR__.'/../path/to/phing/classes/phing', 
)); 

其中path/to/phing是安装Phing的路径。

+0

我使用作曲家,实际上我忘了添加phing包。因为我添加了它,所以它工作:)或者也许是因为我改变了composer.json中的propel版本(在packagist中选中)。 –

+0

是的,您可以在作曲家文件中添加Phing,或使用最新的Propel版本。 –