Commit 5da4e29a authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Cache de récup d'entités pour + de perfs

parent e6651229
Loading
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@ class BddService

    protected array $viewCache = [];

    protected array $entityCache = [];


    /**
     * Echappe une chaîne de caractères pour convertir en SQL
@@ -217,6 +219,18 @@ class BddService
    }



    public function entityGet(string $class, int $id): mixed
    {
        if (!isset($this->entityCache[$class][$id])){
            $this->entityCache[$class][$id] = $this->getEntityManager()->find($class, $id);
        }

        return $this->entityCache[$class][$id];
    }



    /**
     * exécute un ordre SQL
     *