File tree Expand file tree Collapse file tree 4 files changed +9
-5
lines changed
Expand file tree Collapse file tree 4 files changed +9
-5
lines changed Original file line number Diff line number Diff 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 });
Original file line number Diff line number Diff 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 /**
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ());
You can’t perform that action at this time.
0 commit comments