Skip to content

Commit e36a14a

Browse files
committed
Fix remaining conflicts and tests
1 parent 2346197 commit e36a14a

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

src/Models/Model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,9 +1146,9 @@ public function delete(bool $recursive = false): void
11461146
*/
11471147
protected function deleteLeafNodes(): void
11481148
{
1149-
Entry::query()
1150-
->list()
1149+
$this->newQueryWithoutScopes()
11511150
->in($this->dn)
1151+
->list()
11521152
->each(function (Model $model) {
11531153
$model->delete(recursive: true);
11541154
});

src/Query/Filter/Parser.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ protected static function match(string $string): array
4848
*/
4949
public static function assemble(Filter|array $filters = []): string
5050
{
51-
return implode(Arr::wrap($filters));
51+
return implode(array_map(
52+
fn (Filter $filter) => (string) $filter,
53+
Arr::wrap($filters)
54+
));
5255
}
5356

5457
/**

src/Query/Model/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ public function newQueryWithoutScopes(): static
831831
*/
832832
protected function newNestedModelInstance(Closure $closure): static
833833
{
834-
$query = $this->model->newQueryWithoutScopes()->nested();
834+
$query = (new static($this->model, $this->query->newInstance()))->nested();
835835

836836
$closure($query);
837837

tests/Unit/Query/Model/BuilderScopeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public function test_class_scopes_can_be_applied()
3333

3434
$b->withGlobalScope('foo', new TestModelScope);
3535

36-
$this->assertEquals('(foo=LdapRecord\Models\Entry)', $b->getUnescapedQuery());
36+
// Scopes are wrapped in an AndGroup to prevent negation
37+
$this->assertEquals('(&(foo=LdapRecord\Models\Entry))', $b->getUnescapedQuery());
3738

3839
$this->assertCount(1, $b->appliedScopes());
3940
$this->assertArrayHasKey('foo', $b->appliedScopes());

0 commit comments

Comments
 (0)