示例#1
0
 /**
  * @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);
 }
示例#2
0
 public function testAddViewField()
 {
     $this->schema->addViewField('author_user_view', 'description', array('type' => 'string', 'length' => '2000'));
     $fields = $this->schema->getViewFields('author_user_view');
     $this->assertArrayHasKey('description', $fields);
 }