Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model Properties set to NULL are not updated in DB #87

Open
GoogleCodeExporter opened this issue Jan 8, 2016 · 0 comments
Open

Model Properties set to NULL are not updated in DB #87

GoogleCodeExporter opened this issue Jan 8, 2016 · 0 comments

Comments

@GoogleCodeExporter
Copy link

If a DooModel property is set to null, then it is not updated in the Database 
when using updateAttributes method of DooModel.php.

Following steps will reproduce the problem:
1. Set a model property to null
2. update the model using $object->updateAttributes ($modelPropertiesArray) 
method.
3. Model property which is set to null is not updated in database.

Expected output:
1. If a model property is set to null, then it should be updated in the 
database, e.g. set a timestamp value to null should update it in the database 
and clear any value.

Possible Solution:
Line no. 2340 in DdooSqlMagic.php may be changed:
FROM
====
2340:    if(isset($v) && in_array($o, $model->_fields)){

TO
===
2340:    if(in_array($o, $model->_fields)){

I am using r732 of Doophp from the trunk and PHP 5.4.4-14+deb7u3. 

Original issue reported on code.google.com by mohit.ch...@gmail.com on 14 Aug 2013 at 9:49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant