RecursiveStagesService
class RecursiveStagesService implements RecursiveStagesInterface, Resettable (View source)
Functionality for detecting the need of publishing nested objects owned by common parent / ancestor object
Traits
A class that can be instantiated or replaced via DI
Methods
An implementation of the factory method, allows you to create an instance of a class
Creates a class instance by the "singleton" design pattern.
Determine if content differs on stages including nested objects This method also supports non-versioned models to allow traversal of hierarchy which includes both versioned and non-versioned models In-memory cache is included and optimised for the most likely lookup profile: Non-shared models can have deep ownership hierarchy (i.e. content blocks) Shared models are unlikely to have deep ownership hierarchy (i.e Assets) This means that we provide in-memory cache only for top level models as we do not expect to query the nested models multiple times
Execution ownership hierarchy traversal and inspect individual models This method use "stack based" recursive traversal as opposed to "true" recursive traversal for performance reasons (avoid memory spikes and long execution times due to deeper stack)
Get unique identifiers for all owned objects, so we can easily compare them
This lookup will attempt to find "owned" objects This method uses the 'owns' relation, same as RecursivePublishable::publishRecursive()
Details
static Injectable
create(mixed ...$args)
An implementation of the factory method, allows you to create an instance of a class
This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.
This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create(SiteTree::class); $list = SiteTree::get();
static Injectable
singleton(string $class = null)
Creates a class instance by the "singleton" design pattern.
It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).
void
flushCachedData()
No description
static
reset()
Reset the local cache of this object
bool
stagesDifferRecursive(DataObject $object)
Determine if content differs on stages including nested objects This method also supports non-versioned models to allow traversal of hierarchy which includes both versioned and non-versioned models In-memory cache is included and optimised for the most likely lookup profile: Non-shared models can have deep ownership hierarchy (i.e. content blocks) Shared models are unlikely to have deep ownership hierarchy (i.e Assets) This means that we provide in-memory cache only for top level models as we do not expect to query the nested models multiple times
protected bool
determineStagesDifferRecursive(DataObject $object)
Execution ownership hierarchy traversal and inspect individual models This method use "stack based" recursive traversal as opposed to "true" recursive traversal for performance reasons (avoid memory spikes and long execution times due to deeper stack)
protected array
getOwnedIdentifiers(DataObject $object, string $stage)
Get unique identifiers for all owned objects, so we can easily compare them
protected array
getOwnedObjects(DataObject $object)
This lookup will attempt to find "owned" objects This method uses the 'owns' relation, same as RecursivePublishable::publishRecursive()