public function save()
    {
        $event = $this->isSaved() ? 'Update' : 'Create';
        $mapper = Pheasant::instance()->mapperFor($this);

        $this->events()->wrap(array($event, 'Save'), $this, function($obj) use ($mapper) {
            $mapper->save($obj);

            // ensure we clear the changes before after events fire
            $obj->markSaved(true)->clearChanges();
        });

        return $this;
    }
public function save()
    {
        $event = $this->isSaved() ? 'Update' : 'Create';
        $mapper = Pheasant::instance()->mapperFor($this);

        $this->events()->wrap(array($event, 'Save'), $this, function($obj) use ($mapper) {
            $mapper->save($obj);

            // ensure we clear the changes before after events fire
            $obj->markSaved(true)->clearChanges();
        });

        return $this;
    }
public function save ( ) { $ event = $ this -> isSaved ( ) ? 'Update' : 'Create' ; $ mapper = Pheasant :: instance ( ) -> mapperFor ( $ this ) ; $ this -> events ( ) -> wrap ( array ( $ event , 'Save' ) , $ this , function ( $ obj ) use ( $ mapper ) { $ mapper -> save ( $ obj ) ; // ensure we clear the changes before after events fire $ obj -> markSaved ( true ) -> clearChanges ( ) ; } ) ; return $ this ; }
Saves the domain object via the associated mapper
@chainable
Saves the domain object via the associated mapper