public function save()
    {
        //  Process all the items and save to the DB, then clean up
        if ($this->aChanges) {

            $this->aChanges = array_values($this->aChanges);
            $oDate          = Factory::factory('DateTime');

            for ($i = 0; $i < count($this->aChanges); $i++) {
                $this->aChanges[$i]['changes']     = array_values($this->aChanges[$i]['changes']);
                $this->aChanges[$i]['changes']     = json_encode($this->aChanges[$i]['changes']);
                $this->aChanges[$i]['created']     = $oDate->format('Y-m-d H:i:s');
                $this->aChanges[$i]['created_by']  = activeUser('id');
                $this->aChanges[$i]['modified']    = $oDate->format('Y-m-d H:i:s');
                $this->aChanges[$i]['modified_by'] = activeUser('id');
            }

            $oDb = Factory::service('Database');
            $oDb->insert_batch($this->getTableName(), $this->aChanges);
        }

        $this->clear();
    }
public function save()
    {
        //  Process all the items and save to the DB, then clean up
        if ($this->aChanges) {

            $this->aChanges = array_values($this->aChanges);
            $oDate          = Factory::factory('DateTime');

            for ($i = 0; $i < count($this->aChanges); $i++) {
                $this->aChanges[$i]['changes']     = array_values($this->aChanges[$i]['changes']);
                $this->aChanges[$i]['changes']     = json_encode($this->aChanges[$i]['changes']);
                $this->aChanges[$i]['created']     = $oDate->format('Y-m-d H:i:s');
                $this->aChanges[$i]['created_by']  = activeUser('id');
                $this->aChanges[$i]['modified']    = $oDate->format('Y-m-d H:i:s');
                $this->aChanges[$i]['modified_by'] = activeUser('id');
            }

            $oDb = Factory::service('Database');
            $oDb->insert_batch($this->getTableName(), $this->aChanges);
        }

        $this->clear();
    }
public function save ( ) { //  Process all the items and save to the DB, then clean up if ( $ this -> aChanges ) { $ this -> aChanges = array_values ( $ this -> aChanges ) ; $ oDate = Factory :: factory ( 'DateTime' ) ; for ( $ i = 0 ; $ i < count ( $ this -> aChanges ) ; $ i ++ ) { $ this -> aChanges [ $ i ] [ 'changes' ] = array_values ( $ this -> aChanges [ $ i ] [ 'changes' ] ) ; $ this -> aChanges [ $ i ] [ 'changes' ] = json_encode ( $ this -> aChanges [ $ i ] [ 'changes' ] ) ; $ this -> aChanges [ $ i ] [ 'created' ] = $ oDate -> format ( 'Y-m-d H:i:s' ) ; $ this -> aChanges [ $ i ] [ 'created_by' ] = activeUser ( 'id' ) ; $ this -> aChanges [ $ i ] [ 'modified' ] = $ oDate -> format ( 'Y-m-d H:i:s' ) ; $ this -> aChanges [ $ i ] [ 'modified_by' ] = activeUser ( 'id' ) ; } $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> insert_batch ( $ this -> getTableName ( ) , $ this -> aChanges ) ; } $ this -> clear ( ) ; }
Save the changelog items

@throws \Nails\Common\Exception\FactoryException
@throws \Nails\Common\Exception\ModelException
Save the changelog items