Ferreteria/v0.3/class/tHasTableSource
< Ferreteria | v0.3 | class
Jump to navigation
Jump to search
trait tTableSource {
use tQueryableSource;
private $db;
public function SetDatabase(cDatabaseConnection $db) {
$this->db = $db;
}
protected function GetDatabase() : cDatabaseConnection {
if (is_null($this->db)) {
$sClass = get_class($this);
throw new \exception("Tried to retrieve db object before it has been set in class '$sClass'.");
}
return $this->db;
}
abstract protected function GetTableName();
// ALIAS
protected function SourceString_forSelect() {
$sName = $this->GetTableName();
return "`$sName`";
}
}
- file: Template:L/ferreteria/file
- replaces: