Tutorial by Examples

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: exten...
You can add public methods to a DataObject using the extension mechanism, for example: class MyMemberExtension extends DataExtension { public function getHashId() { return sha1($this->owner->ID); } } When applied to the Member class, the example above would return...
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 Mem...

Page 1 of 1