在根据Askeet教程学习Symfony时,有遇到这样一个问题:Unable to find path for class "francoisPeer",笔者经过仔细研究,终于发现问题所在。
错误代码:
1: D:/workspace/askeet/batch>php load_data.php
2: PHP Fatal error: Uncaught exception 'sfException' with message 'Unable to find path for class "francoisPeer".' in D:/workspace/askeet/lib/vender/symfony/lib/ad on/propel/sfPropelData.class.php:206
3: Stack trace:
4: #0 D:/workspace/askeet/lib/vender/symfony/lib/addon/propel/sfPropelData.class.php(46): sfPropelData->doDeleteCurrentData(Array)
5: #1 D:/workspace/askeet/batch/load_data.php(24): sfPropelData->loadData('D:/workspace/as...')
6: #2 {main}
7: thrown in D:/workspace/askeet/lib/vender/symfony/lib/addon/propel/sfPropelData
8: .class.php on line 206
9:
10: Fatal error: Uncaught exception 'sfException' with message 'Unable to find path for class "francoisPeer".' in D:/workspace/askeet/lib/vender/symfony/lib/addon/propel/sfPropelData.class.php:206
11: Stack trace:
12: #0 D:/workspace/askeet/lib/vender/symfony/lib/addon/propel/sfPropelData.class.php(46): sfPropelData->doDeleteCurrentData(Array)
13: #1 D:/workspace/askeet/batch/load_data.php(24): sfPropelData->loadData('D:/workspace/as...')
14: #2 {main} thrown in D:/workspace/askeet/lib/vender/symfony/lib/addon/propel/sfPropelData .class.php on line 206
这个错误是test_data.yml文件格式书写错误导致的。因为直接拷贝网页上给出的yaml代码会有多余的空格,而yaml文件正是有空格控制格式的,所以要严格按照规范书写。