Last active
October 2, 2015 10:37
-
-
Save d3y4n/2228406 to your computer and use it in GitHub Desktop.
Kohana Database Query Builder except() Method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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