private function __construct() { $this->config = Config::instance(); }
/** * Table constructor. Returns instance of Pipe\Table to query against. If the table does not * exist a PDOException is thrown. * * @param string $name Name of table * @throws PDOException * @throws PipeException * @return Pipe\Table */ public function __construct($name) { if (!is_string($name) || strlen($name) === 0) { throw new PipeException("Invalid table name specified"); } $this->table = $name; $this->config = Config::instance(); $this->connection = Connection::instance()->pdo; $this->sql = new SQL($name); //Check table exists //Do this trying to get column details $this->columns = $this->columns(); //Make sure table has an `ID` field, Pipe needs this to work if (!in_array('id', $this->columns)) { throw new PipeException("Table `{$name}` must contain an `id` column"); } }