Summary
I want to create create a boolean workflow attribute with a null default value, but it is converted to false automatically
Steps to reproduce
Add something like that in the appropriate workflow :
workflows:
<workflow_name>:
attributes:
boolean_att:
property_path: <path>
type: boolean
default: null
Actual Result
In the database, the column boolean_att is set to false.
Expected Result
The boolean_att have to be set to null by default to have a rendered unchecked radio buttons.
Details about your environment
- OroPlatform version: 6.1.6
- PHP version: 8.4.11
- Database (MySQL, PostgreSQL) version
Additional information
I have managed to set it to a nullable attributes by updating the condition in WorkflowConfiguration.php#L271-L273 to the following :
if (!empty($value['type']) && in_array($value['type'], $castedTypes, true) && (!array_key_exists('default', $value) || !is_null($value['default']))) {
settype($value['default'], $value['type']);
}
I've done a patch for it in our project by I just want to ask if this is the suitable approach. If yes, maybe this should help for the next release.
Summary
I want to create create a boolean workflow attribute with a null default value, but it is converted to
falseautomaticallySteps to reproduce
Add something like that in the appropriate workflow :
Actual Result
In the database, the column
boolean_attis set tofalse.Expected Result
The
boolean_atthave to be set tonullby default to have a rendered unchecked radio buttons.Details about your environment
Additional information
I have managed to set it to a nullable attributes by updating the condition in WorkflowConfiguration.php#L271-L273 to the following :
I've done a patch for it in our project by I just want to ask if this is the suitable approach. If yes, maybe this should help for the next release.