UpgradePolymorphicExtension
class UpgradePolymorphicExtension extends Extension (View source)
This extension provides a hook that runs when building the db which will check for existing data in various polymorphic relationship fields for userforms models, and ensure that the data is correct.
Various Parent
relationships in silverstripe/userforms for SilverStripe 3 were mapped directly to UserDefinedForm
instances, and were made polymorphic in SilverStripe 4 (which also requires a class name). This means that a
certain amount of manual checking is required to ensure that upgrades are performed smoothly.
Properties
protected | T | $owner | The object this extension is applied to. |
from Extension |
protected | array | $targets | A list of userforms classes that have had polymorphic relationships added in SilverStripe 4, and the fields on them that are polymorphic |
|
protected | string | $defaultReplacement | The default class name that will be used to replace values with |
Methods
Called when this extension is added to a particular class
Temporarily modify the owner. The original owner is ensured to be restored
Clear the current owner, and restore extension to the state prior to the last setOwner()
Helper method to strip eval'ed arguments from a string that's passed to DataObject::$extensions or Object::add_extension().
Invoke extension point. This will prefer explicit extend
prefixed
methods.
Details
__construct()
No description
static
add_to_class(string $class, string $extensionClass, mixed $args = null)
Called when this extension is added to a particular class
setOwner(object $owner)
Set the owner of this extension.
mixed
withOwner(mixed $owner, callable $callback, array $args = [])
Temporarily modify the owner. The original owner is ensured to be restored
clearOwner()
Clear the current owner, and restore extension to the state prior to the last setOwner()
T
getOwner()
Returns the owner of this extension.
static string
get_classname_without_arguments(string $extensionStr)
Helper method to strip eval'ed arguments from a string that's passed to DataObject::$extensions or Object::add_extension().
mixed
invokeExtension(object $owner, string $method, array ...$arguments)
Invoke extension point. This will prefer explicit extend
prefixed
methods.
protected
onRequireDefaultRecords()
No description