Skip to content

Instantly share code, notes, and snippets.

@d3y4n
Last active October 2, 2015 10:37
Show Gist options
  • Save d3y4n/2228406 to your computer and use it in GitHub Desktop.
Save d3y4n/2228406 to your computer and use it in GitHub Desktop.
Kohana Database Query Builder except() Method
<?php
class Database_Query_Builder_Select extends Kohana_Database_Query_Builder_Select {
public function except($ignore)
{
$ignore = func_get_args();
if(count($this->_from) > 1)
return;
$result = DB::query(Database::SELECT, 'SHOW COLUMNS FROM ' . $this->_from[0])->execute()->as_array();
foreach($result as $key => $value)
{
if( ! in_array($value['Field'], $ignore))
$select[] = $value['Field'];
}
$this->_select = $select;
return $this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment