It’s not uncommon to come across something like this if your PHP is not working:
<?php
$models = [];
foreach ($inputValues as $inputValue) {
$models[] = $valueRepository->findByValue($inputValue);
}
?>
While there may be absolutely nothing wrong here, but if you follow the logic in the code, you may find that the innocent looking call above to $valueRepository->findByValue() ultimately results in a query of some sort, such as:
<?php
$result = $connection->query("SELECT `x`,`y` FROM `values` WHERE `value`=" . $inputValue);
$data = [];
if (count($ids)) {
$result = $connection->query("SELECT `x`, `y` FROM `values` WHERE `id` IN (" . implode(',', $ids)); while ($row = $result->fetch_row()) {
$data[] = $row;
}
}
?>
https://www.toptal.com/php/10-most-common-mistakes-php-programmers-make