Skip to content

Commit 25c71c9

Browse files
committed
Fix dropping search index
Error Cannot use object of type stdClass as array
1 parent 6af8698 commit 25c71c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Doctrine/ODM/MongoDB/SchemaManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ public function updateDocumentSearchIndexes(string $documentName): void
413413

414414
$definedNames = array_column($searchIndexes, 'name');
415415
try {
416-
$existingNames = array_column(iterator_to_array($collection->listSearchIndexes()), 'name');
416+
$existingNames = array_column(iterator_to_array($collection->listSearchIndexes(['typeMap' => ['root' => 'array']])), 'name');
417417
} catch (CommandException $e) {
418418
/* If $listSearchIndexes doesn't exist, only throw if search indexes have been defined.
419419
* If no search indexes are defined and the server doesn't support search indexes, there's
@@ -465,7 +465,7 @@ public function deleteDocumentSearchIndexes(string $documentName): void
465465
$collection = $this->dm->getDocumentCollection($class->name);
466466

467467
try {
468-
$searchIndexes = $collection->listSearchIndexes();
468+
$searchIndexes = $collection->listSearchIndexes(['typeMap' => ['root' => 'array']]);
469469
} catch (CommandException $e) {
470470
// If the server does not support search indexes, there are no indexes to remove in any case
471471
if ($this->isSearchIndexCommandException($e)) {

0 commit comments

Comments
 (0)