Skip to content

Commit 1739fcf

Browse files
Revert "[5.x] Detect recursion when augmenting Entries (#11854)"
This reverts commit 6f2a5fb.
1 parent c2c5ccd commit 1739fcf

3 files changed

Lines changed: 0 additions & 49 deletions

File tree

src/Data/HasOrigin.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
namespace Statamic\Data;
44

5-
use Statamic\Exceptions\RecursiveAugmentationException;
65
use Statamic\Facades\Blink;
76

87
trait HasOrigin
98
{
10-
private $resolvingValues = false;
11-
129
/**
1310
* @var string
1411
*/
@@ -34,33 +31,14 @@ public function keys()
3431
->merge($computedKeys);
3532
}
3633

37-
private function guardRecursiveAugmentation()
38-
{
39-
if ($this->resolvingValues) {
40-
$className = get_class($this);
41-
throw new RecursiveAugmentationException("Recursion detected while augmenting [{$className}] with ID [{$this->id}].");
42-
}
43-
44-
$this->resolvingValues = true;
45-
}
46-
47-
private function ungardRecursiveAugmentation()
48-
{
49-
$this->resolvingValues = false;
50-
}
51-
5234
public function values()
5335
{
54-
$this->guardRecursiveAugmentation();
55-
5636
$originFallbackValues = method_exists($this, 'getOriginFallbackValues') ? $this->getOriginFallbackValues() : collect();
5737

5838
$originValues = $this->hasOrigin() ? $this->origin()->values() : collect();
5939

6040
$computedData = method_exists($this, 'computedData') ? $this->computedData() : [];
6141

62-
$this->ungardRecursiveAugmentation();
63-
6442
return collect()
6543
->merge($originFallbackValues)
6644
->merge($originValues)

src/Exceptions/RecursiveAugmentationException.php

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/Data/Entries/EntryTest.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
use Statamic\Events\EntryDeleting;
3030
use Statamic\Events\EntrySaved;
3131
use Statamic\Events\EntrySaving;
32-
use Statamic\Exceptions\RecursiveAugmentationException;
3332
use Statamic\Facades;
3433
use Statamic\Facades\Blink;
3534
use Statamic\Fields\Blueprint;
@@ -2679,23 +2678,4 @@ public function it_clones_internal_collections()
26792678
$this->assertEquals('A', $entry->getSupplement('bar'));
26802679
$this->assertEquals('B', $clone->getSupplement('bar'));
26812680
}
2682-
2683-
#[Test]
2684-
public function it_detects_recursive_augmentation()
2685-
{
2686-
$this->expectException(RecursiveAugmentationException::class);
2687-
$this->expectExceptionMessage('Recursion detected while augmenting [Statamic\Entries\Entry] with ID [entry-id]');
2688-
2689-
\Statamic\Facades\Collection::computed('test', 'the_value', function ($entry) {
2690-
// Trigger recursion that will bypass without computed values.
2691-
return $entry->routeData();
2692-
});
2693-
2694-
$entry = EntryFactory::id('entry-id')
2695-
->collection('test')
2696-
->slug('entry-slug')
2697-
->create();
2698-
2699-
$entry->values();
2700-
}
27012681
}

0 commit comments

Comments
 (0)