From da9d014c9d6b731335daf05331ddcb276c732267 Mon Sep 17 00:00:00 2001 From: Robin Krahnen Date: Wed, 4 Apr 2018 23:50:19 +0200 Subject: [PATCH] optimized query for getLastNumberFor function --- Classes/Service/SequenceGenerator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/Service/SequenceGenerator.php b/Classes/Service/SequenceGenerator.php index fd65201..9dcc82f 100644 --- a/Classes/Service/SequenceGenerator.php +++ b/Classes/Service/SequenceGenerator.php @@ -112,9 +112,9 @@ class SequenceGenerator $em = $this->entityManager; return $em->getConnection()->executeQuery( - 'SELECT MAX(number) AS count FROM ' . $em->getClassMetadata(Insert::class)->getTableName() . ' WHERE type=:type', + 'SELECT MAX(number) FROM ' . $em->getClassMetadata(Insert::class)->getTableName() . ' WHERE type = :type', ['type' => $this->inferTypeFromSource($type)] - )->fetchAll()[0]['count']; + )->fetchAll(\PDO::FETCH_COLUMN)[0]; } /**