Skip to content

Commit 4595a9e

Browse files
authored
Don't double-save descendants (#193)
1 parent 58c1e9f commit 4595a9e

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/Entries/EntryRepository.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ public function save($entry)
5858

5959
Blink::put("eloquent-entry-{$entry->id()}", $entry);
6060
Blink::put("eloquent-entry-{$entry->uri()}", $entry);
61-
62-
$entry->descendants()->each->save();
6361
}
6462

6563
public function delete($entry)

tests/Entries/EntryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public function it_propagates_updating_origin_data_to_descendent_models()
198198
$blueprint->ensureField('too', ['type' => 'test', 'localizable' => true]);
199199
$entry->merge(['too' => 'tar']);
200200

201-
Facades\Entry::save($entry);
201+
$entry->save();
202202

203203
$this->assertNotNull($entry->descendants()->get('fr')->model()->data['too'] ?? null);
204204
$this->assertNotNull($entry->descendants()->get('de')->model()->data['too'] ?? null);
@@ -243,7 +243,7 @@ public function it_propagates_origin_date_to_descendent_models()
243243
$blueprint->ensureField('too', ['type' => 'test', 'localizable' => true]);
244244
$entry->date('2024-01-01');
245245

246-
Facades\Entry::save($entry);
246+
$entry->save();
247247

248248
$this->assertEquals($entry->descendants()->get('fr')->model()->date, '2024-01-01 00:00:00');
249249
}

0 commit comments

Comments
 (0)