Thanks to visit codestin.com
Credit goes to github.com

Skip to content

add 'guid' to list of exception to filter out #17668

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

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ public function getEntitiesByIds($identifier, array $values)
$values = array_values(array_filter($values, function ($v) {
return (string) $v === (string) (int) $v;
}));
} elseif ('guid' === $metadata->getTypeOfField($identifier)) {
$parameterType = Connection::PARAM_STR_ARRAY;

// Like above, but we just filter out empty strings.
$values = array_values(array_filter($values, function ($v) {
return (string) $v !== '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this actually need to validate the pattern of uuids, otherwise postgresql will still break for invalid uuids.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But validation can already be done via constraint
The purpose here is allowing empty strings for non-required uuid fields

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it cannot be done via constraint, as transforming the value is done before validating the model data (as it is necessary to build the model data).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, as I already told in PR comment, the purpose here is not validating the uuid. The purpose is just allowing empty values, otherwise an optional uuid is not working.

}));
} else {
$parameterType = Connection::PARAM_STR_ARRAY;
}
Expand Down