我是symfony framwork的新手,我正在使用我老师推荐的symfony1.4.20,现在的问题是,我无法查询到我的数据库。任何人都可以帮我指出问题吗?
这是我的动作类中的代码,
class contentActions extends sfActions
{
public function executeIndex(sfWebRequest $request)
{
$this->forward('default', 'module');
}
public function executeGetuser(){
$this->user_list = Doctrine::getTable('user')
->createQuery('u')
->execute();
foreach($this->user_list as $row) {
$id = $row->id;
$name = $row->name;
}
}
}
我收到的错误如下,
500 | Internal Server Error | Doctrine_Exception
Couldn't find class user
stack trace
at ()
in SF_SYMFONY_LIB_DIR\plugins\sfDoctrinePlugin\lib\vendor\doctrine\Doctrine\Table.php line 299 ...
{
$name = $this->_options['name'];
if ( ! class_exists($name) || empty($name)) {
throw new Doctrine_Exception("Couldn't find class " . $name);
}
$record = new $name($this);
at Doctrine_Table->initDefinition()
in SF_SYMFONY_LIB_DIR\plugins\sfDoctrinePlugin\lib\vendor\doctrine\Doctrine\Table.php line 256 ...
at Doctrine_Table->__construct('user', object('Doctrine_Connection_Mysql'), 1)
in SF_SYMFONY_LIB_DIR\plugins\sfDoctrinePlugin\lib\vendor\doctrine\Doctrine\Connection.php line 1126 ...
at Doctrine_Connection->getTable('user')
in SF_SYMFONY_LIB_DIR\plugins\sfDoctrinePlugin\lib\vendor\doctrine\Doctrine\Core.php line 1090 ...
at Doctrine_Core::getTable('user')
in SF_ROOT_DIR\apps\userlogin\modules\content\actions\actions.class.php line 32 ...
at contentActions->executeGetuser(object('sfWebRequest'))
in SF_SYMFONY_LIB_DIR\action\sfActions.class.php line 60 ...
at sfActions->execute(object('sfWebRequest'))
in SF_SYMFONY_LIB_DIR\filter\sfExecutionFilter.class.php line 92 ...
at sfExecutionFilter->executeAction(object('contentActions'))
in SF_SYMFONY_LIB_DIR\filter\sfExecutionFilter.class.php line 78 ...
at sfExecutionFilter->handleAction(object('sfFilterChain'), object('contentActions'))
in SF_SYMFONY_LIB_DIR\filter\sfExecutionFilter.class.php line 42 ...
at sfExecutionFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR\filter\sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_SYMFONY_LIB_DIR\filter\sfRenderingFilter.class.php line 33 ...
at sfRenderingFilter->execute(object('sfFilterChain'))
in SF_SYMFONY_LIB_DIR\filter\sfFilterChain.class.php line 53 ...
at sfFilterChain->execute()
in SF_SYMFONY_LIB_DIR\controller\sfController.class.php line 238 ...
at sfController->forward('content', 'getuser')
in SF_SYMFONY_LIB_DIR\controller\sfFrontWebController.class.php line 48 ...
at sfFrontWebController->dispatch()
in SF_SYMFONY_LIB_DIR\util\sfContext.class.php line 170 ...
at sfContext->dispatch()
in SF_ROOT_DIR\web\userlogin_dev.php line 13 ...
任何人都可以帮我修复此错误并使代码在symfony中与数据库一起工作吗?
答案 0 :(得分:0)
试试这个:
$this->user_list = Doctrine::getTable('User')
使用大写U