protected final function belongsTo($tableCls, $value_key = '', $foreign_key = '') {
        if (!$tableCls instanceof View) {
            $tableCls = new SimpleTable($tableCls, $this->dbconnection);
        }

        if (!$foreign_key) {
            $foreign_key = $tableCls->primaryKey;
        }

        if (!$value_key) {
            $value_key = $tableCls->foreignKey;
        }

        $sql = $tableCls->select();

        return [$sql, $foreign_key, $value_key, true, 'belongsTo'];
    }
protected final function belongsTo($tableCls, $value_key = '', $foreign_key = '') {
        if (!$tableCls instanceof View) {
            $tableCls = new SimpleTable($tableCls, $this->dbconnection);
        }

        if (!$foreign_key) {
            $foreign_key = $tableCls->primaryKey;
        }

        if (!$value_key) {
            $value_key = $tableCls->foreignKey;
        }

        $sql = $tableCls->select();

        return [$sql, $foreign_key, $value_key, true, 'belongsTo'];
    }
protected final function belongsTo ( $ tableCls , $ value_key = '' , $ foreign_key = '' ) { if ( ! $ tableCls instanceof View ) { $ tableCls = new SimpleTable ( $ tableCls , $ this -> dbconnection ) ; } if ( ! $ foreign_key ) { $ foreign_key = $ tableCls -> primaryKey ; } if ( ! $ value_key ) { $ value_key = $ tableCls -> foreignKey ; } $ sql = $ tableCls -> select ( ) ; return [ $ sql , $ foreign_key , $ value_key , true , 'belongsTo' ] ; }
one-to-one and one-to-many inverse


@param View|string $tableCls
@param string      $value_key   值字段(本表通过此字段属于$tableCls),默认为$tableCls_id.
@param string      $foreign_key $tableCls的主键或唯一键.

@return array
one - to - one and one - to - many inverse