Ryan M Ryan M - 10 months ago 80
PHP Question

Overload Enum in SilverStripe DataExtension

Is it possible to overload an Enum field using a DataExtension?

class Order extends DataObject {
private static $db=array('Status'=>"Enum('Unpaid, Paid','Unpaid')";

class OrderExtension extends DataExtension {
private static $db=array('Status'=>"Enum('Unpaid, Paid, Cancelled','Unpaid')"; //doesn't work


I couldn't figure out how to get the augmentDatabase() method to work, but after speaking with a colleague he suggested using config.yml and this did the trick.

        Status: Enum('Unpaid, Paid, Cancelled','Unpaid')