src/Towel/Model/BaseModel.php
public function discoverFields() {
    if (!empty($this->fields)) {
      return; // Already configured.
    }

    $sm = $this->db()->getSchemaManager();
    $columns = $sm->listTableColumns($this->table);
    foreach ($columns as $column) {
      $this->fields[$column->getName()] = array(
        'name' => $column->getName(),
        'type' => $column->getType(),
      );
    }

    try {
      $this->fks = $sm->listTableForeignKeys($this->table);
    } catch (\DBALException $e) {
      //Platform does not support foreign keys.
      $this->fks = array();
    }
  }
public function discoverFields() {
    if (!empty($this->fields)) {
      return; // Already configured.
    }

    $sm = $this->db()->getSchemaManager();
    $columns = $sm->listTableColumns($this->table);
    foreach ($columns as $column) {
      $this->fields[$column->getName()] = array(
        'name' => $column->getName(),
        'type' => $column->getType(),
      );
    }

    try {
      $this->fks = $sm->listTableForeignKeys($this->table);
    } catch (\DBALException $e) {
      //Platform does not support foreign keys.
      $this->fks = array();
    }
  }
public function discoverFields ( ) { if ( ! empty ( $ this -> fields ) ) { return ; // Already configured. } $ sm = $ this -> db ( ) -> getSchemaManager ( ) ; $ columns = $ sm -> listTableColumns ( $ this -> table ) ; foreach ( $ columns as $ column ) { $ this -> fields [ $ column -> getName ( ) ] = array ( 'name' => $ column -> getName ( ) , 'type' => $ column -> getType ( ) , ) ; } try { $ this -> fks = $ sm -> listTableForeignKeys ( $ this -> table ) ; } catch ( \ DBALException $ e ) { //Platform does not support foreign keys. $ this -> fks = array ( ) ; } }
Gets info of the fields from the table.
Gets info of the fields from the table .