public function addForeignKey($fkdata)
    {
        if ($fkdata instanceof ForeignKey) {
            $fk = $fkdata;
            $fk->setTable($this);
            $this->foreignKeys[] = $fk;

            if ($this->foreignTableNames === null) {
                $this->foreignTableNames = array();
            }
            if (!in_array($fk->getForeignTableName(), $this->foreignTableNames)) {
                $this->foreignTableNames[] = $fk->getForeignTableName();
            }

            return $fk;
        } else {
            $fk = new ForeignKey();
            $fk->setTable($this);
            $fk->loadFromXML($fkdata);

            return $this->addForeignKey($fk);
        }
    }
public function addForeignKey($fkdata)
    {
        if ($fkdata instanceof ForeignKey) {
            $fk = $fkdata;
            $fk->setTable($this);
            $this->foreignKeys[] = $fk;

            if ($this->foreignTableNames === null) {
                $this->foreignTableNames = array();
            }
            if (!in_array($fk->getForeignTableName(), $this->foreignTableNames)) {
                $this->foreignTableNames[] = $fk->getForeignTableName();
            }

            return $fk;
        } else {
            $fk = new ForeignKey();
            $fk->setTable($this);
            $fk->loadFromXML($fkdata);

            return $this->addForeignKey($fk);
        }
    }
public function addForeignKey ( $ fkdata ) { if ( $ fkdata instanceof ForeignKey ) { $ fk = $ fkdata ; $ fk -> setTable ( $ this ) ; $ this -> foreignKeys [ ] = $ fk ; if ( $ this -> foreignTableNames === null ) { $ this -> foreignTableNames = array ( ) ; } if ( ! in_array ( $ fk -> getForeignTableName ( ) , $ this -> foreignTableNames ) ) { $ this -> foreignTableNames [ ] = $ fk -> getForeignTableName ( ) ; } return $ fk ; } else { $ fk = new ForeignKey ( ) ; $ fk -> setTable ( $ this ) ; $ fk -> loadFromXML ( $ fkdata ) ; return $ this -> addForeignKey ( $ fk ) ; } }
A utility function to create a new foreign key
from attrib and add it to this table.
A utility function to create a new foreign key from attrib and add it to this table .