Hi
I'm trying to populate the invoiceID by adding +1 to the previous number but it won't work. No error message, just a blank page.
Here's my code:
class Invoice extends DataObject {
static $db = array(
'InvoiceID' => 'Int'
);
public function populateDefaults() {
parent::populateDefaults();
$obj = Invoice::get()->sort('Created', 'ASC')->First();
$this->InvoiceID = $obj->InvoiceID+1;
}
}
Why isn't working?