/** * Return an array of Table objects representing all of the tables (and views) * in the selected database */ public function getTables() { if (!$this->tablesCache) { $tables = array(); $params = array(':schema' => $this->name); $stmt = $this->reflector->execute($this->reflector->adapter->getTablesQuery(), $params); while ($row = $stmt->fetch()) { $table = new Table($this->reflector, $this->name, $row); $tables[] = $table; } $stmt->closeCursor(); $this->tablesCache = $tables; } return $this->tablesCache; }
/** * Return an array of Relationship objects for this table * @return array */ public function getRelationships() { if (!$this->relationshipsCache) { $relationships = array(); $params = array(':schema' => $this->databaseName, ':table' => $this->name); $stmt = $this->reflector->execute($this->reflector->adapter->getRelationshipsQuery(), $params); while ($row = $stmt->fetch()) { $relationship = new Relationship($row); $relationships[] = $relationship; } $stmt->closeCursor(); $this->relationshipsCache = $relationships; } return $this->relationshipsCache; }