public function getForeignKey()
    {
        if ($this->foreignKey !== null) {
            return $this->foreignKey;
        }
        $this->init();
        switch ($this->type) {
            case self::HAS_MANY:
            case self::HAS_ONE:
                return $this->owner->getTableName() . '_' . $this->owner->getPrimaryKey();
            case self::BELONGS_TO:
                return $this->foreign->getPrimaryKey();
            default:
                throw new \Exception(sprintf("Relation type '%s' is not supported.", $this->type));
        }
    }
public function getForeignKey()
    {
        if ($this->foreignKey !== null) {
            return $this->foreignKey;
        }
        $this->init();
        switch ($this->type) {
            case self::HAS_MANY:
            case self::HAS_ONE:
                return $this->owner->getTableName() . '_' . $this->owner->getPrimaryKey();
            case self::BELONGS_TO:
                return $this->foreign->getPrimaryKey();
            default:
                throw new \Exception(sprintf("Relation type '%s' is not supported.", $this->type));
        }
    }
public function getForeignKey ( ) { if ( $ this -> foreignKey !== null ) { return $ this -> foreignKey ; } $ this -> init ( ) ; switch ( $ this -> type ) { case self :: HAS_MANY : case self :: HAS_ONE : return $ this -> owner -> getTableName ( ) . '_' . $ this -> owner -> getPrimaryKey ( ) ; case self :: BELONGS_TO : return $ this -> foreign -> getPrimaryKey ( ) ; default : throw new \ Exception ( sprintf ( "Relation type '%s' is not supported." , $ this -> type ) ) ; } }
Returns the name of the column that will be filtered on

@return string
@throws \Exception
Returns the name of the column that will be filtered on