src/Charcoal/Source/StorableTrait.php
final public function save()
    {
        $pre = $this->preSave();
        if ($pre === false) {
            $this->logger->error(sprintf(
                'Can not save object "%s:%s"; cancelled by %s::preSave()',
                $this->objType(),
                $this->id(),
                get_called_class()
            ));
            return false;
        }

        $ret = $this->source()->saveItem($this);
        if ($ret === false) {
            $this->logger->error(sprintf(
                'Can not save object "%s:%s"; repository failed for %s',
                $this->objType(),
                $this->id(),
                get_called_class()
            ));
            return false;
        } else {
            $this->setId($ret);
        }

        $post = $this->postSave();
        if ($post === false) {
            $this->logger->error(sprintf(
                'Saved object "%s:%s" but %s::postSave() failed',
                $this->objType(),
                $this->id(),
                get_called_class()
            ));
            return false;
        }

        return true;
    }
final public function save()
    {
        $pre = $this->preSave();
        if ($pre === false) {
            $this->logger->error(sprintf(
                'Can not save object "%s:%s"; cancelled by %s::preSave()',
                $this->objType(),
                $this->id(),
                get_called_class()
            ));
            return false;
        }

        $ret = $this->source()->saveItem($this);
        if ($ret === false) {
            $this->logger->error(sprintf(
                'Can not save object "%s:%s"; repository failed for %s',
                $this->objType(),
                $this->id(),
                get_called_class()
            ));
            return false;
        } else {
            $this->setId($ret);
        }

        $post = $this->postSave();
        if ($post === false) {
            $this->logger->error(sprintf(
                'Saved object "%s:%s" but %s::postSave() failed',
                $this->objType(),
                $this->id(),
                get_called_class()
            ));
            return false;
        }

        return true;
    }
final public function save ( ) { $ pre = $ this -> preSave ( ) ; if ( $ pre === false ) { $ this -> logger -> error ( sprintf ( 'Can not save object "%s:%s"; cancelled by %s::preSave()' , $ this -> objType ( ) , $ this -> id ( ) , get_called_class ( ) ) ) ; return false ; } $ ret = $ this -> source ( ) -> saveItem ( $ this ) ; if ( $ ret === false ) { $ this -> logger -> error ( sprintf ( 'Can not save object "%s:%s"; repository failed for %s' , $ this -> objType ( ) , $ this -> id ( ) , get_called_class ( ) ) ) ; return false ; } else { $ this -> setId ( $ ret ) ; } $ post = $ this -> postSave ( ) ; if ( $ post === false ) { $ this -> logger -> error ( sprintf ( 'Saved object "%s:%s" but %s::postSave() failed' , $ this -> objType ( ) , $ this -> id ( ) , get_called_class ( ) ) ) ; return false ; } return true ; }
Insert the object's current state in storage.

@return boolean TRUE on success.
Insert the object s current state in storage .