Open mvorisek opened 2 years ago
@mvorisek There is another issue with ScopeBuilder and boolean
type - please use the following conditioned model in scopebuilder demo and you'll see it:
$model = new File($app->db, ['caption' => 'Demo Stat']);
$model->addCondition($model->fieldName()->is_folder, false);
As type strictness has increased in atk4/data, the getOption function passing a $value = false
will render an exception and not allow boolean type in this function:
https://github.com/atk4/ui/blob/28fc62448334a72943b23527c3889e8a4dda0d79/src/Form/Control/ScopeBuilder.php#L689
If you don't require $value to be string, it works as intended.
P.S. Only if is_folder = false is converted to "0" in string, the radio buttons of the rule are properly pre-selected to "No". So a proper type conversion from boolean to string for $value in this case is required to make it work properly.
Since https://github.com/atk4/ui/pull/1915 upgrade there is another known issue - enum/checkbox is broken, boolean/radio has no support by upstream https://github.com/nightswinger/vue-fomantic-ui/issues/16 lib (see _unit-test/scope-builder.php
demo for reproduce).
When I open
demos/form-control/scope-builder.php
demo and change the model toAtk4\Ui\Demos\File
which hasboolean
field and then:click/add that boolean field:
and click
Save
(on the ScopeBuilder demo) I get: