protected function doFlush($dataset, array $conditions)
    {
        !$this->useTransaction ?: $this->db->getTransaction(true)->start();

        try {
            if ($this->delete($conditions) === false) {
                throw new \RuntimeException(sprintf('Delete row fail when updating relations table: %s', $this->table));
            }

            if ($this->create($dataset) === false) {
                throw new \RuntimeException(sprintf('Insert row fail when updating relations table: %s', $this->table));
            }
        } catch (\Throwable $e) {
            !$this->useTransaction ?: $this->db->getTransaction(true)->rollback();

            throw $e;
        }

        !$this->useTransaction ?: $this->db->getTransaction(true)->commit();

        return $dataset;
    }
protected function doFlush($dataset, array $conditions)
    {
        !$this->useTransaction ?: $this->db->getTransaction(true)->start();

        try {
            if ($this->delete($conditions) === false) {
                throw new \RuntimeException(sprintf('Delete row fail when updating relations table: %s', $this->table));
            }

            if ($this->create($dataset) === false) {
                throw new \RuntimeException(sprintf('Insert row fail when updating relations table: %s', $this->table));
            }
        } catch (\Throwable $e) {
            !$this->useTransaction ?: $this->db->getTransaction(true)->rollback();

            throw $e;
        }

        !$this->useTransaction ?: $this->db->getTransaction(true)->commit();

        return $dataset;
    }
protected function doFlush ( $ dataset , array $ conditions ) { ! $ this -> useTransaction ? : $ this -> db -> getTransaction ( true ) -> start ( ) ; try { if ( $ this -> delete ( $ conditions ) === false ) { throw new \ RuntimeException ( sprintf ( 'Delete row fail when updating relations table: %s' , $ this -> table ) ) ; } if ( $ this -> create ( $ dataset ) === false ) { throw new \ RuntimeException ( sprintf ( 'Insert row fail when updating relations table: %s' , $ this -> table ) ) ; } } catch ( \ Throwable $ e ) { ! $ this -> useTransaction ? : $ this -> db -> getTransaction ( true ) -> rollback ( ) ; throw $ e ; } ! $ this -> useTransaction ? : $ this -> db -> getTransaction ( true ) -> commit ( ) ; return $ dataset ; }
Do flush action, this method should be override by sub class.

@param   mixed $dataset    Data set contain data we want to update.
@param   mixed $conditions Where conditions, you can use array or Compare object.

@return  mixed

@throws \Exception
@throws \Throwable
Do flush action this method should be override by sub class .