Skip to content

Commit

Permalink
Improve create the index
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Jan 2, 2025
1 parent 3661c3f commit b52a3e5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/seal-memory-adapter/src/MemoryStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class MemoryStorage
public static function getDocuments(Index $index): array
{
if (!\array_key_exists($index->name, self::$indexes)) {
self::$documents[$index->name] = [];
self::createIndex($index);
}

return self::$documents[$index->name];
Expand All @@ -50,7 +50,7 @@ public static function getDocuments(Index $index): array
public static function save(Index $index, array $document): array
{
if (!\array_key_exists($index->name, self::$indexes)) {
self::$documents[$index->name] = [];
self::createIndex($index);
}

$identifierField = $index->getIdentifierField();
Expand All @@ -66,7 +66,7 @@ public static function save(Index $index, array $document): array
public static function delete(Index $index, string $identifier): void
{
if (!\array_key_exists($index->name, self::$indexes)) {
self::$documents[$index->name] = [];
self::createIndex($index);
}

unset(self::$documents[$index->name][$identifier]);
Expand Down

0 comments on commit b52a3e5

Please sign in to comment.