Ryan M Ryan M - 1 year ago 118
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

Answer Source

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')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download