Compare commits
No commits in common. "ab4ebe93a3713d218d25d75f4c4eb095e2ce107a" and "5e77ba32c18879dec4b7eda91843cbd0ee01829e" have entirely different histories.
ab4ebe93a3
...
5e77ba32c1
1 changed files with 4 additions and 15 deletions
|
@ -84,9 +84,6 @@ final class GameImporter
|
|||
$totalRows = 0;
|
||||
$addedAmount = 0;
|
||||
|
||||
$foundGames = [];
|
||||
$rowValues = [];
|
||||
|
||||
foreach ($worksheet->getRowIterator(self::HEADER_ROW_INDEX + 1) as $row) {
|
||||
$totalRows++;
|
||||
$values = [
|
||||
|
@ -99,7 +96,6 @@ final class GameImporter
|
|||
|
||||
foreach ($columnDefinitions as $columnIndex => $attribute) {
|
||||
$value = $worksheet->getCell(sprintf('%s%d', $columnIndex, $row->getRowIndex()))->getValueString();
|
||||
$value = trim($value);
|
||||
|
||||
switch(KeyAttribute::from($attribute)) {
|
||||
case KeyAttribute::NONE:
|
||||
|
@ -127,19 +123,11 @@ final class GameImporter
|
|||
continue;
|
||||
}
|
||||
|
||||
$game = array_key_exists($values['name'], $foundGames) ? $foundGames[$values['name']] : null;
|
||||
|
||||
if ($game === null) {
|
||||
$game = $this->entityManager->getRepository(Game::class)->findOneBy([ 'name' => $values['name'] ]);
|
||||
}
|
||||
|
||||
$game = $this->entityManager->getRepository(Game::class)->findOneBy([ 'name' => $values['name'] ]);
|
||||
if ($game === null) {
|
||||
$game = new Game($values['name']);
|
||||
$this->entityManager->persist($game);
|
||||
}
|
||||
|
||||
$foundGames[$values['name']] = $game;
|
||||
|
||||
$key = new Key(
|
||||
$game,
|
||||
$list,
|
||||
|
@ -149,6 +137,7 @@ final class GameImporter
|
|||
$values['from'],
|
||||
);
|
||||
|
||||
$this->entityManager->persist($game);
|
||||
$this->entityManager->persist($key);
|
||||
$addedAmount++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue