Skip to content

Commit

Permalink
Fix for AppTemplate issue shopwareArchive#14
Browse files Browse the repository at this point in the history
- add null as a possible return type in ShopRepositoryInterface
- adjust implementation of ShopRepository to return null if shop by id does not exist
- adjust RegistrationService to call create shop in db only if not exist yet
  • Loading branch information
FK committed Sep 6, 2022
1 parent 269e6d3 commit dd58e36
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Shop/ShopRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function createShop(ShopInterface $shop): void
$queryBuilder->execute();
}

public function getShopFromId(string $shopId): ShopInterface
public function getShopFromId(string $shopId): ?ShopInterface
{
$queryBuilder = $this->connection->createQueryBuilder();
$queryBuilder->select('shop_id', 'shop_url', 'shop_secret', 'api_key', 'secret_key')
Expand All @@ -43,6 +43,10 @@ public function getShopFromId(string $shopId): ShopInterface

$shop = $queryBuilder->execute()->fetchAssociative();

if ($shop === false) {
return null;
}

return new ShopEntity(
$shop['shop_id'],
$shop['shop_url'],
Expand Down Expand Up @@ -80,4 +84,4 @@ public function deleteShop(ShopInterface $shop): void

$queryBuilder->execute();
}
}
}

0 comments on commit dd58e36

Please sign in to comment.