public function renameRelation(string $name, string $new) : array
    {
        if (!isset($this->relations[$name])) {
            throw new DBException("Relation not found");
        }
        if (isset($this->relations[$new])) {
            throw new DBException("A relation with that name already exists");
        }
        $temp = $this->relations[$name];
        $temp->name = $new;
        $this->relations[$new] = $temp;
        unset($this->relations[$name]);
        return $this->relations[$new] ?? null;
    }
public function renameRelation(string $name, string $new) : array
    {
        if (!isset($this->relations[$name])) {
            throw new DBException("Relation not found");
        }
        if (isset($this->relations[$new])) {
            throw new DBException("A relation with that name already exists");
        }
        $temp = $this->relations[$name];
        $temp->name = $new;
        $this->relations[$new] = $temp;
        unset($this->relations[$name]);
        return $this->relations[$new] ?? null;
    }
public function renameRelation ( string $ name , string $ new ) : array { if ( ! isset ( $ this -> relations [ $ name ] ) ) { throw new DBException ( "Relation not found" ) ; } if ( isset ( $ this -> relations [ $ new ] ) ) { throw new DBException ( "A relation with that name already exists" ) ; } $ temp = $ this -> relations [ $ name ] ; $ temp -> name = $ new ; $ this -> relations [ $ new ] = $ temp ; unset ( $ this -> relations [ $ name ] ) ; return $ this -> relations [ $ new ] ?? null ; }
Rename a relation
@param  string      $name the name to search for
@param  string      $new  the new name for the relation
@return TableRelation     the relation definition
Rename a relation