diff --git a/src/php/Entities/Games/Game.php b/src/php/Entities/Games/Game.php index c6d954d..90ed9be 100644 --- a/src/php/Entities/Games/Game.php +++ b/src/php/Entities/Games/Game.php @@ -15,8 +15,6 @@ class Game private int|null $id; #[ORM\Column] private string $name; - #[ORM\Column(nullable: true)] - private string|null $internalName; public function getName(): string { @@ -27,23 +25,12 @@ class Game { return $this->id; } - - public function getInternalName(): string - { - return $this->internalName ?? $this->name; - } - - public function setInternalName(string $internalName): void - { - $this->internalName = $internalName; - } /** * @param string $name */ - public function __construct(string $internalName, string $name) + public function __construct(string $name) { - $this->internalName = $internalName; $this->name = $name; } } \ No newline at end of file diff --git a/src/php/Importer/GameImporter.php b/src/php/Importer/GameImporter.php index 965cbf3..dd275db 100644 --- a/src/php/Importer/GameImporter.php +++ b/src/php/Importer/GameImporter.php @@ -3,17 +3,14 @@ declare(strict_types=1); namespace GamesShop\Importer; -use Doctrine\Common\Collections\Criteria; use Doctrine\ORM\EntityManagerInterface; use Exception; -use GamesShop\ContainerHandler; use GamesShop\Entities\Account\User; use GamesShop\Entities\Games\Game; use GamesShop\Entities\Games\Key; use GamesShop\Entities\Games\KeyAttribute; use GamesShop\Entities\Games\Store; use GamesShop\Entities\GamesList; -use Monolog\Logger; use PhpOffice\PhpSpreadsheet\IOFactory; final class GameImporter @@ -130,27 +127,19 @@ final class GameImporter continue; } - $internalName = $this->prepareGameName($values['name']); - $game = array_key_exists($internalName, $foundGames) ? $foundGames[$internalName] : null; - - ContainerHandler::get(Logger::class)->debug('importing game ' . $internalName); + $game = array_key_exists($values['name'], $foundGames) ? $foundGames[$values['name']] : null; if ($game === null) { - $game = $this->entityManager->getRepository(Game::class)->matching( - Criteria::create() - ->where(Criteria::expr()->eq('name', $values['name'])) - ->orWhere(Criteria::expr()->eq('internalName', $internalName)) - )->first(); + $game = $this->entityManager->getRepository(Game::class)->findOneBy([ 'name' => $values['name'] ]); } - if ($game === false) { - $game = new Game($internalName, $values['name']); + if ($game === null) { + $game = new Game($values['name']); $this->entityManager->persist($game); } - $foundGames[$internalName] = $game; - $game->setInternalName($internalName); - + $foundGames[$values['name']] = $game; + $key = new Key( $game, $list, @@ -185,20 +174,4 @@ final class GameImporter return Store::EXTERNAL; } - - private function prepareGameName(string $name): string - { - $replacements = [ - ':' => '', - '-' => '', - ',' => '', - '!' => '', - '?' => '', - ' ' => ' ', - ' ' => '_', - ]; - - $name = strtoupper($name); - return str_replace(array_keys($replacements), array_values($replacements), $name); - } } \ No newline at end of file diff --git a/src/templates/layout/main.php b/src/templates/layout/main.php index 0ad21c9..c1cb854 100644 --- a/src/templates/layout/main.php +++ b/src/templates/layout/main.php @@ -45,16 +45,5 @@ $resource = $resources->getResource($resourceEntry); PROTOTYPE / POC -
- - - You found a bug? Please report it. - - - - Interested to help? Checkout the git repository. - -
- diff --git a/src/templates/layout/navbar.php b/src/templates/layout/navbar.php index 6477edb..e16c5ba 100644 --- a/src/templates/layout/navbar.php +++ b/src/templates/layout/navbar.php @@ -29,24 +29,25 @@ $currentPermission = $activeUser === null ? UserPermission::NONE : $activeUser-> } ?> + -
- - - -
insert('layout/accountDisplay'); ?> +
+ + + +
\ No newline at end of file