code/libraries/joomlatools/library/database/table/abstract.php
public function insert(KDatabaseRowInterface $row)
    {
        // Create query object.
        $query = $this->getObject('lib:database.query.insert')
            ->table($this->getBase());

        //Create commandchain context
        $context = $this->getContext();
        $context->table     = $this->getBase();
        $context->data      = $row;
        $context->query     = $query;
        $context->affected = false;

        if ($this->invokeCommand('before.insert', $context) !== false)
        {
            // Filter the data and remove unwanted columns.
            $data = $this->filter($context->data->getProperties());
            $context->query->values($this->mapColumns($data));

            // Execute the insert query.
            $context->affected = $this->getAdapter()->insert($context->query);

            // Set the status and data before calling the command chain
            if ($context->affected !== false)
            {
                if ($context->affected)
                {
                    if(($column = $this->getIdentityColumn()) && $this->getColumn($this->mapColumns($column, true), true)->autoinc) {
                        $data[$this->getIdentityColumn()] = $this->getAdapter()->getInsertId();
                    }

                    $context->data->setProperties($this->mapColumns($data, true))->setStatus(KDatabase::STATUS_CREATED);
                }
                else $context->data->setStatus(KDatabase::STATUS_FAILED);
            }

            $this->invokeCommand('after.insert', $context);
        }

        return $context->affected;
    }
public function insert(KDatabaseRowInterface $row)
    {
        // Create query object.
        $query = $this->getObject('lib:database.query.insert')
            ->table($this->getBase());

        //Create commandchain context
        $context = $this->getContext();
        $context->table     = $this->getBase();
        $context->data      = $row;
        $context->query     = $query;
        $context->affected = false;

        if ($this->invokeCommand('before.insert', $context) !== false)
        {
            // Filter the data and remove unwanted columns.
            $data = $this->filter($context->data->getProperties());
            $context->query->values($this->mapColumns($data));

            // Execute the insert query.
            $context->affected = $this->getAdapter()->insert($context->query);

            // Set the status and data before calling the command chain
            if ($context->affected !== false)
            {
                if ($context->affected)
                {
                    if(($column = $this->getIdentityColumn()) && $this->getColumn($this->mapColumns($column, true), true)->autoinc) {
                        $data[$this->getIdentityColumn()] = $this->getAdapter()->getInsertId();
                    }

                    $context->data->setProperties($this->mapColumns($data, true))->setStatus(KDatabase::STATUS_CREATED);
                }
                else $context->data->setStatus(KDatabase::STATUS_FAILED);
            }

            $this->invokeCommand('after.insert', $context);
        }

        return $context->affected;
    }
public function insert ( KDatabaseRowInterface $ row ) { // Create query object. $ query = $ this -> getObject ( 'lib:database.query.insert' ) -> table ( $ this -> getBase ( ) ) ; //Create commandchain context $ context = $ this -> getContext ( ) ; $ context -> table = $ this -> getBase ( ) ; $ context -> data = $ row ; $ context -> query = $ query ; $ context -> affected = false ; if ( $ this -> invokeCommand ( 'before.insert' , $ context ) !== false ) { // Filter the data and remove unwanted columns. $ data = $ this -> filter ( $ context -> data -> getProperties ( ) ) ; $ context -> query -> values ( $ this -> mapColumns ( $ data ) ) ; // Execute the insert query. $ context -> affected = $ this -> getAdapter ( ) -> insert ( $ context -> query ) ; // Set the status and data before calling the command chain if ( $ context -> affected !== false ) { if ( $ context -> affected ) { if ( ( $ column = $ this -> getIdentityColumn ( ) ) && $ this -> getColumn ( $ this -> mapColumns ( $ column , true ) , true ) -> autoinc ) { $ data [ $ this -> getIdentityColumn ( ) ] = $ this -> getAdapter ( ) -> getInsertId ( ) ; } $ context -> data -> setProperties ( $ this -> mapColumns ( $ data , true ) ) -> setStatus ( KDatabase :: STATUS_CREATED ) ; } else $ context -> data -> setStatus ( KDatabase :: STATUS_FAILED ) ; } $ this -> invokeCommand ( 'after.insert' , $ context ) ; } return $ context -> affected ; }
Table insert method

@param KDatabaseRowInterface $row  A KDatabaseRow object
@return bool|integer Returns the number of rows inserted, or FALSE if insert query was not executed.
Table insert method