silverstripe-gridfield-betterbuttons icon indicating copy to clipboard operation
silverstripe-gridfield-betterbuttons copied to clipboard

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

Open ruiisidro opened this issue 10 years ago • 0 comments
trafficstars

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(); }

ruiisidro avatar Jul 24 '15 16:07 ruiisidro