public function insert($table, array $data, $ignore = false)
    {
        if (empty($data)) {
            throw new LogicException('You have not provided a data to be inserted');
        }

        $keys = array();
        $values = array_values($data);

        foreach (array_keys($data) as $key) {
            $keys[] = $this->quote($key);
        }

        // Handle ignore case
        if ($ignore === true) {
            $ignore = 'IGNORE';
        } else {
            $ignore = '';
        }

        // Build and append query we made
        $this->append(sprintf('INSERT %s INTO %s (%s) VALUES (%s)', $ignore, $this->quote($table), implode(', ', $keys), implode(', ', $values)));
        return $this;
    }
public function insert($table, array $data, $ignore = false)
    {
        if (empty($data)) {
            throw new LogicException('You have not provided a data to be inserted');
        }

        $keys = array();
        $values = array_values($data);

        foreach (array_keys($data) as $key) {
            $keys[] = $this->quote($key);
        }

        // Handle ignore case
        if ($ignore === true) {
            $ignore = 'IGNORE';
        } else {
            $ignore = '';
        }

        // Build and append query we made
        $this->append(sprintf('INSERT %s INTO %s (%s) VALUES (%s)', $ignore, $this->quote($table), implode(', ', $keys), implode(', ', $values)));
        return $this;
    }
public function insert ( $ table , array $ data , $ ignore = false ) { if ( empty ( $ data ) ) { throw new LogicException ( 'You have not provided a data to be inserted' ) ; } $ keys = array ( ) ; $ values = array_values ( $ data ) ; foreach ( array_keys ( $ data ) as $ key ) { $ keys [ ] = $ this -> quote ( $ key ) ; } // Handle ignore case if ( $ ignore === true ) { $ ignore = 'IGNORE' ; } else { $ ignore = '' ; } // Build and append query we made $ this -> append ( sprintf ( 'INSERT %s INTO %s (%s) VALUES (%s)' , $ ignore , $ this -> quote ( $ table ) , implode ( ', ' , $ keys ) , implode ( ', ' , $ values ) ) ) ; return $ this ; }
Builds INSERT query
This regular insert query for most cases. It's not aware of ON DUPLICATE KEY

@param string $table
@param array $data Simply key value pair (without placeholders)
@param boolean $ignore Whether to ignore when PK collisions occur
@throws \LogicException if $data array is empty
@return \Krystal\Db\Sql\QueryBuilder
Builds INSERT query This regular insert query for most cases . It s not aware of ON DUPLICATE KEY