-
Notifications
You must be signed in to change notification settings - Fork 12
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
boolean values update issues #107
Comments
Thank you @tristanbsn we are going to look at it. |
@tristanbsn could you clarify this point please, I am not sure to understand 🙇
|
@ecourtial In my case I use a transformer with a callback that take a date as source and transform it as string This value get stored in a Boolean field in my PostgreSQL database. |
To clarify the issue is mainly caused by the loose comparision in the
In my case if the value is true in my PostegreSQL database, it cannot be updated to false because this line prevent the update to be triggered : |
Thank you. I will look at it today. |
Thank you, I made a quick patch if it can help you :
|
After a quick look, I am still not sure to understand 😅
So here the comparison is between keys of the array.
So if we would like to really strictly compare keys, we could use a callback. But I am not sure why we should do that, because the keys of the array are supposed to represent columns names, not values. Let me know if I am missing something, I would be very glad to help you. |
the comparison is true because |
My bad indeed. Easily reproduced... after your explanations. |
It works for me, thank you ! |
With Postgresql database, update are not handled correctly in some cases.
Working :
Not working :
After some search I found that there is an issue in the
update(array $row, array $current)
function of src/Loaders/InsertUpdate.php file.This section use loose comparison between old values array and new values array :
if ($row == array_intersect_key($current, $row)) { return; }
The
$current
array return boolean from database as a PHP Boolean while the$row
array take string('true', 't', 'false', 'f') or NULL value to define booleans.This prevent database update when it should be.
The text was updated successfully, but these errors were encountered: