-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[BUG]: Model - Update - Postgres Bool False/True Not Working Phalcon 4 [temp fix at the end] #14722
Comments
just that a notice, if ask the values again even with useDynamicUpdate(true) |
Work $model = new Model();
|
Have some way to return all as string, something to turn around ? |
One more info, the fields does not appear on getChangedFields |
@tidytrax |
I tried this on Postgres 12 but unable to reproduce this behaviour. Can you share your model? |
they came with boolean type if i do a $resultset->toArray(); Same result as before.
I didn't updated this 2 fields, they are filled, but ask again, and if i try
This is fine.
So always when i want to update a record i have to pass all boolean columns as int again, even if they are already filledup, phalcon does not accept to save bool, How i have to do to update a record on database or save.
|
|
Configuration of model, i already try all options mix.
|
On phalcon 3.4.4 works fine, i'm trying to migrate an aplication to the Phalcon 4, works fine all, less postges bool |
The hydrate stuff is not for this issue. |
I know sorry only saw the wrong tab after reply |
You was able to reproduce the behavior? It's that a way to return all values as string? |
id: (boolean) true
And on cache metadata if enabled, |
Could be on Phalcon\MVC\Model.zep Line 4594, value is returned as string on metadata 'false' !== false
|
@ruudboon Worked if i go to meta-app_models_model.php and removed from int type
BECAME
Works
//Works
If i disable models metadata does not work, so the problem isn't on cache, is on the field Type = numeric |
Fix for who has the same problem, must use cache on model metadata.
Using this, does not bring on metadata as numeric field. |
@tidytrax Thnx! This is some great research and really helpful. |
Thank you @ruudboon i'm using about 7 years phalcon, i will as help as i can. But i found the problem, and fix here for me, and is describe below how to fix for who use postgresql Adapter\Pdo\Postgresql.zep
Tinyint is already treated on Line 248
FIX So the fix, extends PDO, and change describeColumns.
Do not set column as numeric, or will come back to the same problem
Just use it only phalcon team does not fix, after they did come back to original Service should look like something...
Before F5 and reload to test, clear metadata folder(if use it). And now you can use again true/false or update a row without passing all values(boolean) again as int.
|
Why the problem does not occur on phalcon 3.4 @ruudboon . No numeric type is set for smallint(tinyint) or boolean
|
Remove is numeric for boolean type Related to this bug. phalcon#14722
Remove is numeric for boolean type Related to this bug. #14722
Resolved in #14781 Thank you again @tidytrax for the report, investigation and fix |
i will keeping test v4. |
excelent thahk!... |
When I try to save a boolean value on postgresql, it does not save;
$model->getMessages() "return field1,field2,field3.... is required
Do not work If I use true/false
$find = Model::findFirst('id='.$id);
Do not Work
Throw required field allowed and enabled
Manually.
Do not Work If i want to change the value or auto update the column;
Work
Work On Create
Return values empty on object after create.
And i don't need to set all fields values, does not set bool field as required
$find->assign(['test' => false])->update();
Works if I use 0/1
$find->assign(['test' => 0,])->update();
Config
Phalcon 4.0.2 / PHP 7.4.1 / Postgresql 12.1/Nginx 1.16.1
The text was updated successfully, but these errors were encountered: