Commit 5a4d35ec authored by Sven Oos's avatar Sven Oos

Extracted method commaSeparatedIds($ids) into DataHelper

parent 0227f291
Pipeline #107502793 failed with stages
in 2 minutes and 37 seconds
......@@ -60,4 +60,15 @@ class DataHelper
return $out;
}
/**
* Creates a comma separated string of IDs.
*
* @param array $ids The IDs (may be of type <code>int</code> of <code>string</code>).
* @return string
*/
public function commaSeparatedIds(array $ids): string
{
return implode(',', array_map('intval', $ids));
}
}
......@@ -358,7 +358,7 @@ final class FoodsaverGateway extends BaseGateway
INNER JOIN fs_foodsaver_has_bezirk hb
ON hb.foodsaver_id = fs.id
WHERE hb.bezirk_id IN(' . implode(',', $regionIds) . ')
WHERE hb.bezirk_id IN(' . $this->dataHelper->commaSeparatedIds($regionIds) . ')
AND fs.deleted_at IS NULL
');
}
......@@ -443,7 +443,7 @@ final class FoodsaverGateway extends BaseGateway
WHERE fs.deleted_at IS NULL
AND b.`bezirk_id` > 0
AND b.`bezirk_id` IN(' . implode(',', array_map('intval', $regionIds)) . ')
AND b.`bezirk_id` IN(' . $this->dataHelper->commaSeparatedIds($regionIds) . ')
');
return $this->dataHelper->useIdAsKey($foodsavers);
......@@ -461,7 +461,7 @@ final class FoodsaverGateway extends BaseGateway
WHERE fs.deleted_at IS NULL
AND b.`bezirk_id` > 0
AND b.`bezirk_id` IN(' . implode(',', array_map('intval', $regionIds)) . ')
AND b.`bezirk_id` IN(' . $this->dataHelper->commaSeparatedIds($regionIds) . ')
');
return $this->dataHelper->useIdAsKey($foodsavers);
......@@ -666,7 +666,7 @@ final class FoodsaverGateway extends BaseGateway
ON fs.id = fb.foodsaver_id
WHERE fs.deleted_at IS NULL
AND fb.`bezirk_id` IN(' . implode(',', $regions) . ')'
AND fb.`bezirk_id` IN(' . $this->dataHelper->commaSeparatedIds($regions) . ')'
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment