public function __construct() { if (is_null($this->table) || empty($this->table)) { throw new MapperNoTableException(get_class($this)); } Database::loadDriver($this->driver); // Remove the word "Mapper" from classname $this->object_name = substr(get_class($this), 0, -6); $querybuilder = $this->driver . 'QueryBuilder'; $this->builder = new $querybuilder($this->table, $this->primary_key); }