Ensure same data types for all autocompelete list items

In client code we expect that botch category and product ids
are strings but we send strings for lists based on posts and integers
for lists based on terms. We use mostly string values so this change unifies
that all ids for autocomplete lists are strings.
[MAILPOET-3555]
This commit is contained in:
Rostislav Wolny
2021-04-08 16:38:17 +02:00
committed by Veljko V
parent a7fe876180
commit 6f6bbbd1a3

View File

@@ -54,7 +54,7 @@ class AutocompletePostListLoader {
$result = [];
foreach ($posts as $post) {
$result[] = [
'id' => $post->ID,
'id' => (string)$post->ID,
'name' => $post->post_title,// phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps
];
}
@@ -67,7 +67,7 @@ class AutocompletePostListLoader {
$result = [];
foreach ($terms as $term) {
$result[] = [
'id' => $term->term_id,// phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps
'id' => (string)$term->term_id,// phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps
'name' => $term->name,
];
}