error 500 if store name is missing
Summary
if the name of a store is not present, a database error will occur.
Steps to reproduce
- https://beta.foodsharing.de/?id=34031&page=fsbetrieb
- remove store name in database, load the store and show in browser console
What is the current bug behavior?
What is the expected correct behavior?
Relevant error messages and/or screenshots
Sentry Issue: FOODSHARINGDE-BETA-BACKEND-118
Foodsharing\Modules\Core\DatabaseNoValueFoundException: Expected one or more results, but none was returned.
File "/src/Modules/Core/Database.php", line 492, in Foodsharing\Modules\Core\Database::fetchValue
throw new DatabaseNoValueFoundException('Expected one or more results, but none was returned.');
File "/src/Modules/Core/Database.php", line 133, in Foodsharing\Modules\Core\Database::fetchValueByCriteria
return $this->fetchValue(...$this->generateSelectStatement($table, [$column], $criteria));
File "/src/Modules/Region/RegionGateway.php", line 522, in Foodsharing\Modules\Region\RegionGateway::getRegionName
return $this->db->fetchValueByCriteria('fs_bezirk', 'name', ['id' => $regionId]);
File "/src/Modules/Store/StoreGateway.php", line 88, in Foodsharing\Modules\Store\StoreGateway::getBetrieb
if ($bezirk = $this->regionGateway->getRegionName($result['bezirk_id'])) {
File "/src/Modules/StoreUser/StoreUserControl.php", line 234, in Foodsharing\Modules\StoreUser\StoreUserControl::index
if ($store = $this->storeGateway->getBetrieb($storeId)) {
...
(5 additional frame(s) were not displayed)
Possible fixes
Edited by Christian Walgenbach