public function onBeforeWrite()
    {
        if (!$this->Sort) {
            $this->Sort = DB::query('SELECT MAX("Sort") + 1 FROM "WorkflowTransition"')->value();
        }

        parent::onBeforeWrite();
    }
public function onBeforeWrite()
    {
        if (!$this->Sort) {
            $this->Sort = DB::query('SELECT MAX("Sort") + 1 FROM "WorkflowTransition"')->value();
        }

        parent::onBeforeWrite();
    }
public function onBeforeWrite ( ) { if ( ! $ this -> Sort ) { $ this -> Sort = DB :: query ( 'SELECT MAX("Sort") + 1 FROM "WorkflowTransition"' ) -> value ( ) ; } parent :: onBeforeWrite ( ) ; }
Before saving, make sure we're not in an infinite loop
Before saving make sure we re not in an infinite loop