Skip to content

Commit 94815bf

Browse files
authored
Merge pull request #808 from utopia-php/fix-filter-break
2 parents 83bd5bf + ef60326 commit 94815bf

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/Database/Validator/Query/Filter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ protected function isValidAttributeAndValues(string $attribute, array $values, s
184184
// For dotted attributes on objects, validate as string (path queries)
185185
if ($isDottedOnObject) {
186186
$validator = new Text(0, 0);
187-
continue 2;
187+
break;
188188
}
189189

190190
// object containment queries on the base object attribute

tests/e2e/Adapter/Scopes/ObjectAttributeTests.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,18 @@ public function testNestedObjectAttributeEdgeCases(): void
13791379
])
13801380
]);
13811381

1382+
if ($database->getAdapter()->getSupportForAttributes()) {
1383+
try {
1384+
$database->find($collectionId, [
1385+
Query::equal('profile.level1.level2.level3.level4.value', [10])
1386+
]);
1387+
$this->fail('Expected nesting as string');
1388+
} catch (Exception $e) {
1389+
$this->assertInstanceOf(QueryException::class, $e);
1390+
$this->assertEquals('Invalid query: Query value is invalid for attribute "profile"', $e->getMessage());
1391+
}
1392+
}
1393+
13821394
$results = $database->find($collectionId, [
13831395
Query::equal('profile.level1.level2.level3.level4.value', ['deep_value_1'])
13841396
]);

0 commit comments

Comments
 (0)