src/Norm/Model.php
public function sync($attributes)
    {
        if (isset($attributes['$id'])) {
            $this->state = static::STATE_ATTACHED;
            $this->id = $attributes['$id'];
        } else {
            foreach ($this->schema() as $key => $field) {
                if ($field->has('default')) {
                    $attributes[$key] = $field['default'];
                }
            }

            $this->state = static::STATE_DETACHED;
        }

        $this->set($attributes);
        $this->populateOld();
    }
public function sync($attributes)
    {
        if (isset($attributes['$id'])) {
            $this->state = static::STATE_ATTACHED;
            $this->id = $attributes['$id'];
        } else {
            foreach ($this->schema() as $key => $field) {
                if ($field->has('default')) {
                    $attributes[$key] = $field['default'];
                }
            }

            $this->state = static::STATE_DETACHED;
        }

        $this->set($attributes);
        $this->populateOld();
    }
public function sync ( $ attributes ) { if ( isset ( $ attributes [ '$id' ] ) ) { $ this -> state = static :: STATE_ATTACHED ; $ this -> id = $ attributes [ '$id' ] ; } else { foreach ( $ this -> schema ( ) as $ key => $ field ) { if ( $ field -> has ( 'default' ) ) { $ attributes [ $ key ] = $ field [ 'default' ] ; } } $ this -> state = static :: STATE_DETACHED ; } $ this -> set ( $ attributes ) ; $ this -> populateOld ( ) ; }
Sync the existing attributes with new values. After update or insert, this method used to modify the existing attributes.

@param array $attributes

@return void
Sync the existing attributes with new values . After update or insert this method used to modify the existing attributes .