public function addTable($table)
    {
        if (!$table instanceof Table) {
            $tbl = new Table();
            $tbl->setDatabase($this);
            $tbl->loadMapping($table);

            return $this->addTable($tbl);
        }

        $table->setDatabase($this);

        if (isset($this->tablesByName[$table->getName()])) {
            throw new EngineException(sprintf('Table "%s" declared twice', $table->getName()));
        }

        $this->tables[] = $table;
        $this->tablesByName[$table->getName()] = $table;
        $this->tablesByLowercaseName[strtolower($table->getName())] = $table;
        $this->tablesByPhpName[$table->getPhpName()] = $table;

        $this->computeTableNamespace($table);

        if (null === $table->getPackage()) {
            $table->setPackage($this->getPackage());
        }

        return $table;
    }
public function addTable($table)
    {
        if (!$table instanceof Table) {
            $tbl = new Table();
            $tbl->setDatabase($this);
            $tbl->loadMapping($table);

            return $this->addTable($tbl);
        }

        $table->setDatabase($this);

        if (isset($this->tablesByName[$table->getName()])) {
            throw new EngineException(sprintf('Table "%s" declared twice', $table->getName()));
        }

        $this->tables[] = $table;
        $this->tablesByName[$table->getName()] = $table;
        $this->tablesByLowercaseName[strtolower($table->getName())] = $table;
        $this->tablesByPhpName[$table->getPhpName()] = $table;

        $this->computeTableNamespace($table);

        if (null === $table->getPackage()) {
            $table->setPackage($this->getPackage());
        }

        return $table;
    }
public function addTable ( $ table ) { if ( ! $ table instanceof Table ) { $ tbl = new Table ( ) ; $ tbl -> setDatabase ( $ this ) ; $ tbl -> loadMapping ( $ table ) ; return $ this -> addTable ( $ tbl ) ; } $ table -> setDatabase ( $ this ) ; if ( isset ( $ this -> tablesByName [ $ table -> getName ( ) ] ) ) { throw new EngineException ( sprintf ( 'Table "%s" declared twice' , $ table -> getName ( ) ) ) ; } $ this -> tables [ ] = $ table ; $ this -> tablesByName [ $ table -> getName ( ) ] = $ table ; $ this -> tablesByLowercaseName [ strtolower ( $ table -> getName ( ) ) ] = $ table ; $ this -> tablesByPhpName [ $ table -> getPhpName ( ) ] = $ table ; $ this -> computeTableNamespace ( $ table ) ; if ( null === $ table -> getPackage ( ) ) { $ table -> setPackage ( $ this -> getPackage ( ) ) ; } return $ table ; }
Adds a new table to this database.

@param  Table|array $table
@return Table
Adds a new table to this database .