Skip to content

Commit 7d2b9f3

Browse files
added tenant to the result
1 parent aa0116b commit 7d2b9f3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Database/Adapter/MariaDB.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,6 +1661,7 @@ public function find(string $collection, array $queries = [], ?int $limit = 25,
16611661
}
16621662
if (\array_key_exists('_tenant', $document)) {
16631663
$document['$tenant'] = $document['_tenant'] === null ? null : (int)$document['_tenant'];
1664+
$results[$index]['$tenant'] = $document['$tenant'];
16641665
unset($results[$index]['_tenant']);
16651666
}
16661667
if (\array_key_exists('_createdAt', $document)) {

tests/e2e/Adapter/Scopes/DocumentTests.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4245,6 +4245,14 @@ public function testEmptyTenant(): void
42454245
$database = static::getDatabase();
42464246

42474247
if ($database->getAdapter()->getSharedTables()) {
4248+
$documents = $database->find(
4249+
'documents',
4250+
[Query::select(['*'])] // Mongo bug with Integer UID
4251+
);
4252+
4253+
$document = $documents[0];
4254+
$doc = $database->getDocument($document->getCollection(), $document->getId());
4255+
$this->assertEquals($document->getTenant(), $doc->getTenant());
42484256
$this->expectNotToPerformAssertions();
42494257
return;
42504258
}

0 commit comments

Comments
 (0)