加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 如何在Doctrine中的表中设置NULL

发布时间:2020-12-13 13:12:36 所属栏目:PHP教程 来源:网络整理
导读:我有一些表store_section(id,parent_id,label),我想改变一些行,设置parent_id = null. 我试图: $record = $table-getTable()-find( $id );$record-parent_id = null;$record-save(); 但这不行.如何在Doctrine中将NULL设置为表,在上面的示例中,parent_id变为
我有一些表store_section(id,parent_id,label),我想改变一些行,设置parent_id = null.

我试图:

$record = $table->getTable()->find( $id );
$record->parent_id = null;
$record->save();

但这不行.如何在Doctrine中将NULL设置为表,在上面的示例中,parent_id变为= 0(not = NULL)?

Thnx的回应!

我会尝试以下之一:

1:

$record = $table->getTable()->find( $id );
$record->parent_id = new Doctrine_Null();
$record->save();

2:

$record = $table->getTable()->find( $id );
$record->parent_id = "NULL";
$record->save();

我没有测试过这些,但我记得有一个类似的问题,只是不记得我如何解决它.希望这可以帮助!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读