/** * @param string $viewName * @return \Dive\Table * @throws SchemaException */ private function createView($viewName) { $viewClass = $this->schema->getViewClass($viewName, true); $recordClass = $this->schema->getRecordClass($viewName); $fields = $this->schema->getViewFields($viewName); $relationsData = $this->schema->getTableRelations($viewName); $relations = $this->instantiateRelations($relationsData); return new $viewClass($this, $viewName, $recordClass, $fields, $relations); }