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

ScopeBuilder does not work with boolean type #1855

Open
mvorisek opened this issue Sep 5, 2022 · 3 comments
Open

ScopeBuilder does not work with boolean type #1855

mvorisek opened this issue Sep 5, 2022 · 3 comments
Labels

Comments

@mvorisek
Copy link
Member

mvorisek commented Sep 5, 2022

When I open demos/form-control/scope-builder.php demo and change the model to Atk4\Ui\Demos\File which has boolean field and then:

click/add that boolean field:

image

and click Save (on the ScopeBuilder demo) I get:

image

@mkrecek234
Copy link
Contributor

@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:

protected static function getOption(string $type, string $value, Condition $condition): ?array

If you don't require $value to be string, it works as intended.

@mkrecek234
Copy link
Contributor

mkrecek234 commented Sep 6, 2022

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.

@mvorisek
Copy link
Member Author

mvorisek commented Nov 28, 2022

Since #1915 upgrade there is another known issue - enum/checkbox is broken, boolean/radio has no support by upstream nightswinger/vue-fomantic-ui#16 lib (see _unit-test/scope-builder.php demo for reproduce).

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

No branches or pull requests

2 participants