src/Norm/Collection.php
public function save(Model $model, $options = array())
    {
        $options = array_merge(array(
            'filter' => true,
            'observer' => true,
        ), $options);

        if ($options['filter']) {
            $this->filter($model);
        }

        if ($options['observer']) {
            $this->applyHook('saving', $model, $options);
        }

        $modified = $this->connection->persist($this, $model->dump());
        $model->setId($modified['$id']);

        if ($options['observer']) {
            $this->applyHook('saved', $model, $options);
        }

        $model->sync($modified);
        $this->resetCache();
    }
public function save(Model $model, $options = array())
    {
        $options = array_merge(array(
            'filter' => true,
            'observer' => true,
        ), $options);

        if ($options['filter']) {
            $this->filter($model);
        }

        if ($options['observer']) {
            $this->applyHook('saving', $model, $options);
        }

        $modified = $this->connection->persist($this, $model->dump());
        $model->setId($modified['$id']);

        if ($options['observer']) {
            $this->applyHook('saved', $model, $options);
        }

        $model->sync($modified);
        $this->resetCache();
    }
public function save ( Model $ model , $ options = array ( ) ) { $ options = array_merge ( array ( 'filter' => true , 'observer' => true , ) , $ options ) ; if ( $ options [ 'filter' ] ) { $ this -> filter ( $ model ) ; } if ( $ options [ 'observer' ] ) { $ this -> applyHook ( 'saving' , $ model , $ options ) ; } $ modified = $ this -> connection -> persist ( $ this , $ model -> dump ( ) ) ; $ model -> setId ( $ modified [ '$id' ] ) ; if ( $ options [ 'observer' ] ) { $ this -> applyHook ( 'saved' , $ model , $ options ) ; } $ model -> sync ( $ modified ) ; $ this -> resetCache ( ) ; }
Save model to persistent state

@param \Norm\Model $model
@param array       $options

@return void
Save model to persistent state