public function saveOne($data, $condFields = null, $updateNulls = false)
    {
        // Event
        $this->triggerEvent(
            'onBefore' . ucfirst(__FUNCTION__),
            [
                'data' => &$data,
                'condFields' => &$condFields,
                'updateNulls' => &$updateNulls,
            ]
        );

        $dataset = $this->save($this->bindDataset([$data]), $condFields, $updateNulls);

        $result = $dataset[0];

        // Event
        $this->triggerEvent(
            'onAfter' . ucfirst(__FUNCTION__),
            [
                'result' => &$result,
            ]
        );

        return $result;
    }
public function saveOne($data, $condFields = null, $updateNulls = false)
    {
        // Event
        $this->triggerEvent(
            'onBefore' . ucfirst(__FUNCTION__),
            [
                'data' => &$data,
                'condFields' => &$condFields,
                'updateNulls' => &$updateNulls,
            ]
        );

        $dataset = $this->save($this->bindDataset([$data]), $condFields, $updateNulls);

        $result = $dataset[0];

        // Event
        $this->triggerEvent(
            'onAfter' . ucfirst(__FUNCTION__),
            [
                'result' => &$result,
            ]
        );

        return $result;
    }
public function saveOne ( $ data , $ condFields = null , $ updateNulls = false ) { // Event $ this -> triggerEvent ( 'onBefore' . ucfirst ( __FUNCTION__ ) , [ 'data' => & $ data , 'condFields' => & $ condFields , 'updateNulls' => & $ updateNulls , ] ) ; $ dataset = $ this -> save ( $ this -> bindDataset ( [ $ data ] ) , $ condFields , $ updateNulls ) ; $ result = $ dataset [ 0 ] ; // Event $ this -> triggerEvent ( 'onAfter' . ucfirst ( __FUNCTION__ ) , [ 'result' => & $ result , ] ) ; return $ result ; }
Save only one row.

@param mixed $data         The data we want to save.
@param array $condFields   The where condition tell us record exists or not, if not set,
will use primary key instead.
@param bool  $updateNulls  Update empty fields or not.

@return  mixed|Data Saved data.
Save only one row .