Symfony 1.4,推进:当我尝试保存记录时,会导致 500 错误

发布于 2024-12-27 03:42:57 字数 1187 浏览 1 评论 0原文

我所拥有的是:

   $rec = new Users();
    $rec->setUsername($username);
    $rec->setPassword(md5($password));
    $rec->setEmail($email);
    $rec->setRealname($rname);
   $rec->save();

save() 方法触发 symfony 中的内部错误 (500)。架构:

  users:
    _attributes:             { phpName: Users }
    ID:                      { type: INTEGER, size: '10', primaryKey: true, autoIncrement: true, required: true }
    USERNAME:                { type: VARCHAR, size: '255', required: true, defaultValue: '' }
    PASSWORD:                { type: VARCHAR, size: '255', required: true, defaultValue: '' }
    EMAIL:                   { type: VARCHAR, size: '255', required: true, defaultValue: '' }
    REALNAME:                { type: VARCHAR, size: '255', required: false }
    STATUS_:                 { type: CHAR, required: true, defaultValue: '2' }
    NUMBEROFDELETEDAUCTIONS: { type: INTEGER, size: '10', required: true, defaultValue: '0' }
    NUMBEROFSUCCEEDAUCTIONS: { type: INTEGER, size: '10', required: true, defaultValue: '0' }
    _uniques:                { Index_USERNAME: [USERNAME] }

有人能看出原因吗?

All I have is:

   $rec = new Users();
    $rec->setUsername($username);
    $rec->setPassword(md5($password));
    $rec->setEmail($email);
    $rec->setRealname($rname);
   $rec->save();

the save() method triggers internal error (500) in symfony. The schema:

  users:
    _attributes:             { phpName: Users }
    ID:                      { type: INTEGER, size: '10', primaryKey: true, autoIncrement: true, required: true }
    USERNAME:                { type: VARCHAR, size: '255', required: true, defaultValue: '' }
    PASSWORD:                { type: VARCHAR, size: '255', required: true, defaultValue: '' }
    EMAIL:                   { type: VARCHAR, size: '255', required: true, defaultValue: '' }
    REALNAME:                { type: VARCHAR, size: '255', required: false }
    STATUS_:                 { type: CHAR, required: true, defaultValue: '2' }
    NUMBEROFDELETEDAUCTIONS: { type: INTEGER, size: '10', required: true, defaultValue: '0' }
    NUMBEROFSUCCEEDAUCTIONS: { type: INTEGER, size: '10', required: true, defaultValue: '0' }
    _uniques:                { Index_USERNAME: [USERNAME] }

can anybody see the reason why?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浊酒尽余欢 2025-01-03 03:42:57

为什么不使用开发环境以便可以查看有关错误的更多详细信息?而不是 http://www.blabla.com/index.php 只需使用 http://www.blabla.com/NAME_OF_YOUR_APP_dev.php(通常是 frontend_dev.php)

Why don't you use the dev environment so you can see more details about the error? Instead of http://www.blabla.com/index.php just use http://www.blabla.com/NAME_OF_YOUR_APP_dev.php (usually frontend_dev.php)

忆离笙 2025-01-03 03:42:57

为什么你的架构是大写的?

异常错误信息是什么?

你尝试过这样的事情吗?

$rec = new Users();
$rec->set('USERNAME', $username);
$rec->set('PASSWORD', md5($password));
...
$rec->save();

不管怎样,这个模式有很多违反 symfony 标准的情况。也许它是强加给你的,但如果不是,请查看一些文档< /a>.

Why are your schema uppercased?

What's the exception error message?

Have you tried with something like this?

$rec = new Users();
$rec->set('USERNAME', $username);
$rec->set('PASSWORD', md5($password));
...
$rec->save();

Anyway, there is a lot of symfony standards violation on this schema. Maybe it's imposed to you, but if it's not, please look at some documentation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文