Beispiel #1
0
 /**
  * Setter for the rootNamespace. For example (MyApp)\Database[Model/Factory]
  * @param type $namespace
  */
 public function setRootNamespace($namespace)
 {
     $this->rootNamespace = $namespace . ($this->includeSchema ? '\\' . $this->relation->getSchemaName(true) : '');
 }
Beispiel #2
0
 /**
  * Loads columns for a given relation
  * @param Relation $relation
  */
 protected function loadColumnsForRelation(Relation $relation)
 {
     $sql = new SelectStatement();
     $sql->from('information_schema.columns')->where(sqlstr('table_schema')->equalsTo(':table_schema'))->andWhere(sqlstr('table_name')->equalsTo(':table_name'));
     $params = [':table_schema' => $relation->getSchemaName(), ':table_name' => $relation->getName()];
     foreach ($this->database->executeQuery($sql, $params) as $record) {
         $column = new Column($record);
         $relation->addColumn($column);
     }
 }