如何解决 sfGuard blm 问题?
我正在使用 Symfony 框架。 安装并配置 sfGuard 身份验证器后。我发现了这个问题:
500 | Internal Server Error | Doctrine_Table_Exception
Unknown method SfGuardUserTable::retrieveByUsernameOrEmailAddress
stack trace
* at ()
in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\vendor\doctrine\Doctrine\Table.php line 2856 ...
2853. return call_user_func_array(array($this->getRecordInstance(), $method . 'TableProxy'), $arguments);
2854. } catch (Doctrine_Record_UnknownPropertyException $e) {}
2855.
2856. throw new Doctrine_Table_Exception(sprintf('Unknown method %s::%s', get_class($this), $method));
2857. }
2858. }
2859.
* at Doctrine_Table->__call('retrieveByUsernameOrEmailAddress', array('admin'))
in n/a line n/a ...
* at SfGuardUserTable->retrieveByUsernameOrEmailAddress('admin')
in SF_ROOT_DIR\plugins\sfDoctrineGuardPlugin\lib\validator\sfGuardValidatorUser.class.php line 44 ...
41. {
42. $user = call_user_func_array($callable, array($username));
43. } else {
44. $user = $this->getTable()->$method($username);
45. }
46. // user exists?
47. if($user)
* at sfGuardValidatorUser->doClean(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9', 'remember' => ))
in SF_ROOT_DIR\lib\vendor\symfony\lib\validator\sfValidatorBase.class.php line 327 ...
324. return $this->getEmptyValue();
325. }
326.
327. return $this->doClean($clean);
328. }
329.
330. /**
* at sfValidatorBase->clean(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9', 'remember' => ))
in SF_ROOT_DIR\lib\vendor\symfony\lib\validator\sfValidatorSchema.class.php line 246 ...
243. return $values;
244. }
245.
246. return $validator->clean($values);
247. }
248.
249. /**
* at sfValidatorSchema->postClean(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9', 'remember' => ))
in SF_ROOT_DIR\lib\vendor\symfony\lib\validator\sfValidatorSchema.class.php line 186 ...
183. // post validator
184. try
185. {
186. $clean = $this->postClean($clean);
187. }
188. catch (sfValidatorErrorSchema $e)
189. {
* at sfValidatorSchema->doClean(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\validator\sfValidatorSchema.class.php line 90 ...
87. */
88. public function clean($values)
89. {
90. return $this->doClean($values);
91. }
92.
93. /**
* at sfValidatorSchema->clean(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\form\sfForm.class.php line 247 ...
244. */
245. protected function doBind(array $values)
246. {
247. $this->values = $this->validatorSchema->clean($values);
248. }
249.
250. /**
* at sfForm->doBind(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\form\addon\sfFormSymfony.class.php line 75 ...
72.
73. try
74. {
75. parent::doBind($values);
76. }
77. catch (sfValidatorError $error)
78. {
* at sfFormSymfony->doBind(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\form\sfForm.class.php line 227 ...
224.
225. try
226. {
227. $this->doBind(self::deepArrayUnion($this->taintedValues, self::convertFileInformation($this->taintedFiles)));
228. $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
229.
230. // remove CSRF token
* at sfForm->bind(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9'))
in SF_ROOT_DIR\apps\frontend\modules\sfGuardAuth\lib\BasesfGuardAuthActions.class.php line 33 ...
30.
31. if ($request->isMethod('post'))
32. {
33. $this->form->bind($request->getParameter($this->form->getName()));
34. if ($this->form->isValid())
35. {
36. $values = $this->form->getValues();
* at BasesfGuardAuthActions->executeSignin(object('sfWebRequest'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\action\sfActions.class.php line 60 ...
57. }
58.
59. // run action
60. return $this->$actionToRun($request);
61. }
62. }
63.
* at sfActions->execute(object('sfWebRequest'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\filter\sfExecutionFilter.class.php line 92 ...
89. {
90. // execute the action
91. $actionInstance->preExecute();
92. $viewName = $actionInstance->execute($this->context->getRequest());
93. $actionInstance->postExecute();
94.
95. return null === $viewName ? sfView::SUCCESS : $viewName;
* at sfExecutionFilter->executeAction(object('sfGuardAuthActions'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\filter\sfExecutionFilter.class.php line 78 ...
75. }
76. }
77.
78. return $this->executeAction($actionInstance);
79. }
80.
81. /**
* at sfExecutionFilter->handleAction(object('sfFilterChain'), object('sfGuardAuthActions'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\filter\sfExecutionFilter.class.php line 42 ...
39. {
40. $timer = sfTimerManager::getTimer(sprintf('Action "%s/%s"', $actionInstance->getModuleName(), $actionInstance->getActionName()));
41.
42. $viewName = $this->handleAction($filterChain, $actionInstance);
43.
44. $timer->addTime();
45. $timer = sfTimerManager::getTimer(sprintf('View "%s" for "%s/%s"', $viewName, $actionInstance->getModuleName(), $actionInstance->getActionName()));
* at sfExecutionFilter->execute(object('sfFilterChain'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\filter\sfFilterChain.class.php line 53 ...
50. }
51.
52. // execute the next filter
53. $this->chain[$this->index]->execute($this);
54. }
55. }
56.
* at sfFilterChain->execute()
in SF_ROOT_DIR\lib\vendor\symfony\lib\filter\sfRenderingFilter.class.php line 33 ...
30. public function execute($filterChain)
31. {
32. // execute next filter
33. $filterChain->execute();
34.
35. // get response object
36. $response = $this->context->getResponse();
* at sfRenderingFilter->execute(object('sfFilterChain'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\filter\sfFilterChain.class.php line 53 ...
50. }
51.
52. // execute the next filter
53. $this->chain[$this->index]->execute($this);
54. }
55. }
56.
* at sfFilterChain->execute()
in SF_ROOT_DIR\lib\vendor\symfony\lib\controller\sfController.class.php line 238 ...
235. }
236.
237. // process the filter chain
238. $filterChain->execute();
239. }
240. else
241. {
* at sfController->forward('sfGuardAuth', 'signin')
in SF_ROOT_DIR\lib\vendor\symfony\lib\controller\sfFrontWebController.class.php line 48 ...
45. }
46.
47. // make the first request
48. $this->forward($moduleName, $actionName);
49. }
50. catch (sfException $e)
51. {
* at sfFrontWebController->dispatch()
in SF_ROOT_DIR\lib\vendor\symfony\lib\util\sfContext.class.php line 170 ...
167. */
168. public function dispatch()
169. {
170. $this->getController()->dispatch();
171. }
172.
173. /**
* at sfContext->dispatch()
in SF_ROOT_DIR\web\frontend_dev.php line 13 ...
I'm using Symfony framework.
After Installing it and configuring the sfGuard authentificator. I found that problem :
500 | Internal Server Error | Doctrine_Table_Exception
Unknown method SfGuardUserTable::retrieveByUsernameOrEmailAddress
stack trace
* at ()
in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\vendor\doctrine\Doctrine\Table.php line 2856 ...
2853. return call_user_func_array(array($this->getRecordInstance(), $method . 'TableProxy'), $arguments);
2854. } catch (Doctrine_Record_UnknownPropertyException $e) {}
2855.
2856. throw new Doctrine_Table_Exception(sprintf('Unknown method %s::%s', get_class($this), $method));
2857. }
2858. }
2859.
* at Doctrine_Table->__call('retrieveByUsernameOrEmailAddress', array('admin'))
in n/a line n/a ...
* at SfGuardUserTable->retrieveByUsernameOrEmailAddress('admin')
in SF_ROOT_DIR\plugins\sfDoctrineGuardPlugin\lib\validator\sfGuardValidatorUser.class.php line 44 ...
41. {
42. $user = call_user_func_array($callable, array($username));
43. } else {
44. $user = $this->getTable()->$method($username);
45. }
46. // user exists?
47. if($user)
* at sfGuardValidatorUser->doClean(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9', 'remember' => ))
in SF_ROOT_DIR\lib\vendor\symfony\lib\validator\sfValidatorBase.class.php line 327 ...
324. return $this->getEmptyValue();
325. }
326.
327. return $this->doClean($clean);
328. }
329.
330. /**
* at sfValidatorBase->clean(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9', 'remember' => ))
in SF_ROOT_DIR\lib\vendor\symfony\lib\validator\sfValidatorSchema.class.php line 246 ...
243. return $values;
244. }
245.
246. return $validator->clean($values);
247. }
248.
249. /**
* at sfValidatorSchema->postClean(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9', 'remember' => ))
in SF_ROOT_DIR\lib\vendor\symfony\lib\validator\sfValidatorSchema.class.php line 186 ...
183. // post validator
184. try
185. {
186. $clean = $this->postClean($clean);
187. }
188. catch (sfValidatorErrorSchema $e)
189. {
* at sfValidatorSchema->doClean(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\validator\sfValidatorSchema.class.php line 90 ...
87. */
88. public function clean($values)
89. {
90. return $this->doClean($values);
91. }
92.
93. /**
* at sfValidatorSchema->clean(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\form\sfForm.class.php line 247 ...
244. */
245. protected function doBind(array $values)
246. {
247. $this->values = $this->validatorSchema->clean($values);
248. }
249.
250. /**
* at sfForm->doBind(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\form\addon\sfFormSymfony.class.php line 75 ...
72.
73. try
74. {
75. parent::doBind($values);
76. }
77. catch (sfValidatorError $error)
78. {
* at sfFormSymfony->doBind(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\form\sfForm.class.php line 227 ...
224.
225. try
226. {
227. $this->doBind(self::deepArrayUnion($this->taintedValues, self::convertFileInformation($this->taintedFiles)));
228. $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
229.
230. // remove CSRF token
* at sfForm->bind(array('username' => 'admin', 'password' => 'admin', '_csrf_token' => '0b9b4825a656101613c70c2f1ee7bfa9'))
in SF_ROOT_DIR\apps\frontend\modules\sfGuardAuth\lib\BasesfGuardAuthActions.class.php line 33 ...
30.
31. if ($request->isMethod('post'))
32. {
33. $this->form->bind($request->getParameter($this->form->getName()));
34. if ($this->form->isValid())
35. {
36. $values = $this->form->getValues();
* at BasesfGuardAuthActions->executeSignin(object('sfWebRequest'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\action\sfActions.class.php line 60 ...
57. }
58.
59. // run action
60. return $this->$actionToRun($request);
61. }
62. }
63.
* at sfActions->execute(object('sfWebRequest'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\filter\sfExecutionFilter.class.php line 92 ...
89. {
90. // execute the action
91. $actionInstance->preExecute();
92. $viewName = $actionInstance->execute($this->context->getRequest());
93. $actionInstance->postExecute();
94.
95. return null === $viewName ? sfView::SUCCESS : $viewName;
* at sfExecutionFilter->executeAction(object('sfGuardAuthActions'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\filter\sfExecutionFilter.class.php line 78 ...
75. }
76. }
77.
78. return $this->executeAction($actionInstance);
79. }
80.
81. /**
* at sfExecutionFilter->handleAction(object('sfFilterChain'), object('sfGuardAuthActions'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\filter\sfExecutionFilter.class.php line 42 ...
39. {
40. $timer = sfTimerManager::getTimer(sprintf('Action "%s/%s"', $actionInstance->getModuleName(), $actionInstance->getActionName()));
41.
42. $viewName = $this->handleAction($filterChain, $actionInstance);
43.
44. $timer->addTime();
45. $timer = sfTimerManager::getTimer(sprintf('View "%s" for "%s/%s"', $viewName, $actionInstance->getModuleName(), $actionInstance->getActionName()));
* at sfExecutionFilter->execute(object('sfFilterChain'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\filter\sfFilterChain.class.php line 53 ...
50. }
51.
52. // execute the next filter
53. $this->chain[$this->index]->execute($this);
54. }
55. }
56.
* at sfFilterChain->execute()
in SF_ROOT_DIR\lib\vendor\symfony\lib\filter\sfRenderingFilter.class.php line 33 ...
30. public function execute($filterChain)
31. {
32. // execute next filter
33. $filterChain->execute();
34.
35. // get response object
36. $response = $this->context->getResponse();
* at sfRenderingFilter->execute(object('sfFilterChain'))
in SF_ROOT_DIR\lib\vendor\symfony\lib\filter\sfFilterChain.class.php line 53 ...
50. }
51.
52. // execute the next filter
53. $this->chain[$this->index]->execute($this);
54. }
55. }
56.
* at sfFilterChain->execute()
in SF_ROOT_DIR\lib\vendor\symfony\lib\controller\sfController.class.php line 238 ...
235. }
236.
237. // process the filter chain
238. $filterChain->execute();
239. }
240. else
241. {
* at sfController->forward('sfGuardAuth', 'signin')
in SF_ROOT_DIR\lib\vendor\symfony\lib\controller\sfFrontWebController.class.php line 48 ...
45. }
46.
47. // make the first request
48. $this->forward($moduleName, $actionName);
49. }
50. catch (sfException $e)
51. {
* at sfFrontWebController->dispatch()
in SF_ROOT_DIR\lib\vendor\symfony\lib\util\sfContext.class.php line 170 ...
167. */
168. public function dispatch()
169. {
170. $this->getController()->dispatch();
171. }
172.
173. /**
* at sfContext->dispatch()
in SF_ROOT_DIR\web\frontend_dev.php line 13 ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用“doctrine:clean”来清除项目库中未使用的类。然后重建模型并形成“doctrine:build-model”和“doctrine:build-forms”。
如果这没有帮助检查参数“Doctrine_Core::ATTR_AUTOLOAD_TABLE_CLASSES”是否设置为 true。它应该在 sfDoctrinePluginConfiguration 类中。
try 'doctrine:clean' to clean your project lib from unused classes. Then rebuild model and forms 'doctrine:build-model' and 'doctrine:build-forms'.
If this doesn't help check if parameter 'Doctrine_Core::ATTR_AUTOLOAD_TABLE_CLASSES' is set to true. It should be in sfDoctrinePluginConfiguration class.