Kohana:Jelly Auth和Jelly Formo赢得';我们不能一起玩得很好。。。引起错误
尝试使用模块:Jelly Auth和Jelly Formo导致2个错误。取决于我如何安排我的boostrap文件,我可以摆脱一个或另一个错误,但不能两者兼而有之 错误1:Auth工作正常,formo不: 错误2:Formo工作正常,验证时身份验证中断: 任何帮助都将不胜感激。。。谢谢 更新: 我用一种骇人的方式修正了错误2。。。一个更好的方法将不胜感激 我只是注释掉了formo jelly/classes/jelly/model.php的第81行和第82行 我希望能够使用果冻formo验证。。。但由于它现在导致身份验证出现问题。。。我愿意暂时放弃这两行Kohana:Jelly Auth和Jelly Formo赢得';我们不能一起玩得很好。。。引起错误,kohana,kohana-auth,jelly,Kohana,Kohana Auth,Jelly,尝试使用模块:Jelly Auth和Jelly Formo导致2个错误。取决于我如何安排我的boostrap文件,我可以摆脱一个或另一个错误,但不能两者兼而有之 错误1:Auth工作正常,formo不: 错误2:Formo工作正常,验证时身份验证中断: 任何帮助都将不胜感激。。。谢谢 更新: 我用一种骇人的方式修正了错误2。。。一个更好的方法将不胜感激 我只是注释掉了formo jelly/classes/jelly/model.php的第81行和第82行 我希望能够使用果冻formo验证。
81: if ( ! $this->form->validate(TRUE))
82: throw new Validator_Exception($this->form->errors(), 'Failed to validate form');
保存Jelly对象时,应始终使用
try…catch()
块:
try {
$model->save();
// object saved successfully
}
catch (Validate_Exception $e)
{
// get validation errors
$errors = $e->array->errors();
}
模块之间的不兼容性来自kohana formo jelly/classes/jelly/model.php:
// If the formo object to validate against doesn't exist, make it
$this->generate_form();
if (!$this->form->validate(TRUE))
throw new Validator_Exception($this->form->errors(), 'Failed to validate form');
这是我的变化,我没有经过深思熟虑的测试,因为我刚刚开始使用jelly auth/formo:
if (isset($this->form))
{
// If the formo object to validate against doesn't exist, make it
$this->generate_form();
if (!$this->form->validate(TRUE))
throw new Validator_Exception($this->form->errors(), 'Failed to validate form');
}
补丁:谢谢你的建议,但这对解决手头的问题没有多大帮助……这是针对你的错误2的情况。Auth->login()尝试保存用户对象-使用try…catch()。。。谢谢我不明白。。。哈哈。。我刚刚注释掉了两行代码…刚刚注意到我的formo代码中有一个错误。。。仍然使用->渲染而不是->生成,但这对错误没有影响…我看到您也发现了问题。如果您尝试我建议的代码更改,如果您看到任何副作用,您能告诉我吗?谢谢
// If the formo object to validate against doesn't exist, make it
$this->generate_form();
if (!$this->form->validate(TRUE))
throw new Validator_Exception($this->form->errors(), 'Failed to validate form');
if (isset($this->form))
{
// If the formo object to validate against doesn't exist, make it
$this->generate_form();
if (!$this->form->validate(TRUE))
throw new Validator_Exception($this->form->errors(), 'Failed to validate form');
}