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

Bugfix // Fix search settings error #2650

Merged
merged 1 commit into from Oct 16, 2018

Conversation

Projects
None yet
3 participants
@wouterverstuyf
Contributor

wouterverstuyf commented Oct 5, 2018

Type

  • Non critical bugfix

Resolves the following issues

  • Saving the search settings with not all modules enabled generates an error on the searchable column (expects int and saved as 'null')

Pull request description

  • casting to int to save a 0 instead of 'null'
Wouter Verstuyf

@wouterverstuyf wouterverstuyf changed the title from Bugfix // Cast error on save to Bugfix // Fix search settings error Oct 5, 2018

@StijnVrolijk StijnVrolijk requested review from forkcms/core-contributors Oct 5, 2018

@StijnVrolijk StijnVrolijk added the Bug label Oct 5, 2018

@StijnVrolijk StijnVrolijk added this to the 5.4.1 milestone Oct 5, 2018

@StijnVrolijk

This comment has been minimized.

Contributor

StijnVrolijk commented Oct 5, 2018

@wouterverstuyf can you show us the error you are describing?

BackendSearchModel::insertModuleSettings(string $module, string $searchable, string $weight)

The method expects a string so if there is an issue with inserting the value into the database the issue is either in that method or the getChecked() method of SpoonFormCheckbox

@wouterverstuyf

This comment has been minimized.

Contributor

wouterverstuyf commented Oct 5, 2018

@StijnVrolijk Hmz, the searchable column expects an integer?

schermafbeelding 2018-10-05 om 11 32 07

See below the error:

schermafbeelding 2018-10-05 om 11 31 17

@StijnVrolijk

This comment has been minimized.

Contributor

StijnVrolijk commented Oct 5, 2018

@wouterverstuyf you're receiving an empty string as $searchable, can you check what the ->getChecked() method in your form returns?

@wouterverstuyf

This comment has been minimized.

Contributor

wouterverstuyf commented Oct 5, 2018

@StijnVrolijk Yeah, I know, the first is a bool(true) the second one is empty, cause the second item in the search modules is not checked.
So casting it to an integer makes it 0 so the error is gone.

schermafbeelding 2018-10-05 om 11 39 04

But this is strange. The function is expecting a string like you said, but the db searchable column field is a Tinyint...

@carakas

This comment has been minimized.

Member

carakas commented Oct 11, 2018

@wouterverstuyf it should be a boolean value. Booleans are saved as integers being 0 or 1.
The string thing is probably a left over from when we used Y and N

@carakas carakas merged commit 6b4c02b into forkcms:master Oct 16, 2018

3 checks passed

Scrutinizer No new issues
Details
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment