unclecheese / silverstripe-gridfield-betterbuttons

Adds new form actions and buttons to the GridField detail form

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

$this doesn't contains the proper content in custom actions when saving a new record

ruiisidro opened this issue · comments

In documentation there's a function approve() that when called and we are in a new record (not in an update), the db properties in the $this variable are empty.

When approve is called over an existing record, $this contains all the properties filled, but when in a new record, the properties are empty.

I'm guessing that there should be another way to get access to the content of the object pre-save but I don't see how!

public function approve() {
$aux = $this->Title; //is empty in new record but filled in an existing one
$this->IsApproved = true;
$this->write();
}