File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33namespace Statamic \Data ;
44
5- use Statamic \Exceptions \RecursiveAugmentationException ;
65use Statamic \Facades \Blink ;
76
87trait 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 )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2929use Statamic \Events \EntryDeleting ;
3030use Statamic \Events \EntrySaved ;
3131use Statamic \Events \EntrySaving ;
32- use Statamic \Exceptions \RecursiveAugmentationException ;
3332use Statamic \Facades ;
3433use Statamic \Facades \Blink ;
3534use 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}
You can’t perform that action at this time.
0 commit comments