使用与Magento的ORM布尔字段 [英] Using boolean fields with Magento ORM

查看:112
本文介绍了使用与Magento的ORM布尔字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在后台编辑页面上为我的自定义实体。我几乎一切工作,包括节省了一堆不同的文本字段。我有一个问题,虽然,试图设置一个布尔值字段的值时。

I am working on a backend edit page for my custom entity. I have almost everything working, including saving a bunch of different text fields. I have a problem, though, when trying to set the value of a boolean field.

我曾尝试:

$landingPage->setEnabled(1);
$landingPage->setEnabled(TRUE);
$landingPage->setEnabled(0);
$landingPage->setEnabled(FALSE);

似乎都不坚持更改我的数据库。

None seem to persist a change to my database.

您是如何使用应该Magento的ORM设置一个布尔字段?

How are you supposed to set a boolean field using magento ORM?

修改
看着我的数据库,MySQL是存储领域一个TINYINT(1),所以Magento的,可以看到这是一个int不是一个布尔值。仍然无法得到它的设置虽然。

edit Looking at my database, mysql is storing the field as a tinyint(1), so magento may be seeing this as an int not a bool. Still can't get it to set though.

推荐答案

删除VAR /缓存/ * - 您的数据库模式由Magento的缓存,即使新列已经被添加到MySQL表

Delete var/cache/* - your DB schema is cached by Magento even though the new column is already added to the MySQL table.

这篇关于使用与Magento的ORM布尔字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆