public function onSave(callable $callback)
    {
        if ($this->isDependent) {
            throw InvalidOperationException::format(
                'Invalid call to %s: cannot add form callbacks in dependent form sections', __METHOD__
            );
        }

        $this->onSaveCallbacks[] = $callback;
    }
public function onSave(callable $callback)
    {
        if ($this->isDependent) {
            throw InvalidOperationException::format(
                'Invalid call to %s: cannot add form callbacks in dependent form sections', __METHOD__
            );
        }

        $this->onSaveCallbacks[] = $callback;
    }
public function onSave ( callable $ callback ) { if ( $ this -> isDependent ) { throw InvalidOperationException :: format ( 'Invalid call to %s: cannot add form callbacks in dependent form sections' , __METHOD__ ) ; } $ this -> onSaveCallbacks [ ] = $ callback ; }
Defines an object save callback.

This will be executed when the form is submitted
after the object has been saved to the underlying data source.

This will NOT be called on a details form.

Example:
<code>
$form->onSave(function (Person $object, array $input) {
$this->sendEmailToAdmin($object);
});
</code>

@param callable $callback

@return void
@throws InvalidOperationException
Defines an object save callback .