silverstripe DataExtensions Adding fields to a DataObject


Example

You can use the DataExtension mechanism to add extra database fields to an existing DataObject:

class MyMemberExtension extends DataExtension
{
    private static $db = [
        'HairColour' => 'Varchar'
    ];
}

And apply the extension:

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

This will add HairColour as a field to Member objects.