src/ORM/DataObject.php
protected function preWrite()
    {
        // Validate this object
        if ($writeException = $this->validateWrite()) {
            // Used by DODs to clean up after themselves, eg, Versioned
            $this->invokeWithExtensions('onAfterSkippedWrite');
            throw $writeException;
        }

        // Check onBeforeWrite
        $this->brokenOnWrite = true;
        $this->onBeforeWrite();
        if ($this->brokenOnWrite) {
            user_error(static::class . " has a broken onBeforeWrite() function."
                . " Make sure that you call parent::onBeforeWrite().", E_USER_ERROR);
        }
    }
protected function preWrite()
    {
        // Validate this object
        if ($writeException = $this->validateWrite()) {
            // Used by DODs to clean up after themselves, eg, Versioned
            $this->invokeWithExtensions('onAfterSkippedWrite');
            throw $writeException;
        }

        // Check onBeforeWrite
        $this->brokenOnWrite = true;
        $this->onBeforeWrite();
        if ($this->brokenOnWrite) {
            user_error(static::class . " has a broken onBeforeWrite() function."
                . " Make sure that you call parent::onBeforeWrite().", E_USER_ERROR);
        }
    }
protected function preWrite ( ) { // Validate this object if ( $ writeException = $ this -> validateWrite ( ) ) { // Used by DODs to clean up after themselves, eg, Versioned $ this -> invokeWithExtensions ( 'onAfterSkippedWrite' ) ; throw $ writeException ; } // Check onBeforeWrite $ this -> brokenOnWrite = true ; $ this -> onBeforeWrite ( ) ; if ( $ this -> brokenOnWrite ) { user_error ( static :: class . " has a broken onBeforeWrite() function." . " Make sure that you call parent::onBeforeWrite()." , E_USER_ERROR ) ; } }
Prepare an object prior to write

@throws ValidationException
Prepare an object prior to write