insert() public method

This changes the query type to be 'insert'. Note calling this method will reset any data previously set with Query::values() Can be combined with the where() method to create delete queries.
public insert ( array $columns, array $types = [] )
$columns array The columns to insert into.
$types array A map between columns & their datatypes.
Example #1
0
 /**
  * cache() should fail on non select queries.
  *
  * @expectedException \RuntimeException
  * @return void
  */
 public function testCacheErrorOnNonSelect()
 {
     $table = TableRegistry::get('articles', ['table' => 'articles']);
     $query = new Query($this->connection, $table);
     $query->insert(['test']);
     $query->cache('my_key');
 }