Issues

ZF-12354: Create Row do not accept false value

Issue Type: Bug Created: 2012-07-31T18:20:35.000+0000 Last Updated: 2012-08-01T21:43:06.000+0000 Status: Closed Fix version(s): Reporter: Renato Gabriel (tidytrax) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db_Table

Related issues: Attachments:

Description

When i go to create a new row $model->createRow(); if my array has a key with false value it's change to null.

So if I save it and the field at the database don't accept null value, i get an error.

Comments

Posted by Andries Seutens (andries) on 2012-08-01T18:40:25.000+0000

You must manually cast the value to whatever your database expects. This is not the responsibility of Zend Framework.

For example to cast to an ENUM value "true" or "false", you can do:

<pre class="highlight">
$x = false;
$foo->createRow(
    array(
       'baz' => $x ? 'true' : 'false'
    )
);

Or to cast to an integer:

<pre class="highlight">
$x = false;
$foo->createRow(
    array(
       'baz' => (int) $x
    )
);

Closing this issue.

Posted by Renato Gabriel (tidytrax) on 2012-08-01T21:43:06.000+0000

I'm already doing like this, convert to a string, But it's not nice.

I've made some test's an seems to me that is a PHP bug at __set, i have made some var_dump's over there.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts