Search code examples
ormbooleanmagento-1.5magento

Using boolean fields with 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.

I have tried:

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

None seem to persist a change to my database.

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

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.


Solution

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