silverstripe Applying a DataExtension to a Class


Example

The most common way is to apply the extension via Config. Example:

# File: mysite/_config/config.yml
Member:
  extensions:
    - MyMemberExtension

The extensions config variable is of type "array", so you can add multiple extensions like this:

# File: mysite/_config/config.yml
Member:
  extensions:
    - MyMemberExtension
    - MyOtherMemberExtension

If you wrote the class that is to be extended, you can define the extension(s) as static variable:

<?php
class MyClass extends DataObject
{
    private static $extensions = ['MyCustomExtension'];
}