public function store($updateNulls = false)
    {
        $new = !$this->{$this->getKeyName()};

        $action = $new ? 'Create' : 'Update';

        // @Event: Create / Update
        $this->triggerEvent(
            'onBefore' . $action,
            [
                'updateNulls' => &$updateNulls,
            ]
        );

        // @Event: Store
        $this->triggerEvent(
            'onBefore' . ucfirst(__FUNCTION__),
            [
                'updateNulls' => &$updateNulls,
            ]
        );

        // Do Action
        // If a primary key exists update the object, otherwise insert it.
        $this->getDataMapper()->saveOne($this, $this->getKeyName(true), $updateNulls);

        // @Event: Store
        $this->triggerEvent('onAfter' . ucfirst(__FUNCTION__));

        // @Event: Create / Update
        $this->triggerEvent(
            'onAfter' . $action,
            [
                'updateNulls' => &$updateNulls,
            ]
        );

        return $this;
    }
public function store($updateNulls = false)
    {
        $new = !$this->{$this->getKeyName()};

        $action = $new ? 'Create' : 'Update';

        // @Event: Create / Update
        $this->triggerEvent(
            'onBefore' . $action,
            [
                'updateNulls' => &$updateNulls,
            ]
        );

        // @Event: Store
        $this->triggerEvent(
            'onBefore' . ucfirst(__FUNCTION__),
            [
                'updateNulls' => &$updateNulls,
            ]
        );

        // Do Action
        // If a primary key exists update the object, otherwise insert it.
        $this->getDataMapper()->saveOne($this, $this->getKeyName(true), $updateNulls);

        // @Event: Store
        $this->triggerEvent('onAfter' . ucfirst(__FUNCTION__));

        // @Event: Create / Update
        $this->triggerEvent(
            'onAfter' . $action,
            [
                'updateNulls' => &$updateNulls,
            ]
        );

        return $this;
    }
public function store ( $ updateNulls = false ) { $ new = ! $ this -> { $ this -> getKeyName ( ) } ; $ action = $ new ? 'Create' : 'Update' ; // @Event: Create / Update $ this -> triggerEvent ( 'onBefore' . $ action , [ 'updateNulls' => & $ updateNulls , ] ) ; // @Event: Store $ this -> triggerEvent ( 'onBefore' . ucfirst ( __FUNCTION__ ) , [ 'updateNulls' => & $ updateNulls , ] ) ; // Do Action // If a primary key exists update the object, otherwise insert it. $ this -> getDataMapper ( ) -> saveOne ( $ this , $ this -> getKeyName ( true ) , $ updateNulls ) ; // @Event: Store $ this -> triggerEvent ( 'onAfter' . ucfirst ( __FUNCTION__ ) ) ; // @Event: Create / Update $ this -> triggerEvent ( 'onAfter' . $ action , [ 'updateNulls' => & $ updateNulls , ] ) ; return $ this ; }
Method to store a row in the database from the AbstractTable instance properties.
If a primary key value is set the row with that primary key value will be
updated with the instance property values.  If no primary key value is set
a new row will be inserted into the database with the properties from the
AbstractTable instance.

@param   boolean $updateNulls True to update fields even if they are null.

@return  static  Method allows chaining

@throws \Exception
@since   2.0
Method to store a row in the database from the AbstractTable instance properties . If a primary key value is set the row with that primary key value will be updated with the instance property values . If no primary key value is set a new row will be inserted into the database with the properties from the AbstractTable instance .