protected function belongsTo($class, $foreignKey): ?LightModel
    {
        $identifier = implode('_', [$class, $foreignKey]);

        if (! isset($this->_belongsTo[$identifier]))
        {
            if (! $this->getTable()->hasColumn($foreignKey))
            {
                throw new ColumnMissingException($this->getTableName() . ' does not have column: ' . $foreignKey);
            }

            $this->_belongsTo[$identifier] = $class::getOneByKey($this->$foreignKey);
        }

        return $this->_belongsTo[$identifier];
    }
protected function belongsTo($class, $foreignKey): ?LightModel
    {
        $identifier = implode('_', [$class, $foreignKey]);

        if (! isset($this->_belongsTo[$identifier]))
        {
            if (! $this->getTable()->hasColumn($foreignKey))
            {
                throw new ColumnMissingException($this->getTableName() . ' does not have column: ' . $foreignKey);
            }

            $this->_belongsTo[$identifier] = $class::getOneByKey($this->$foreignKey);
        }

        return $this->_belongsTo[$identifier];
    }
protected function belongsTo ( $ class , $ foreignKey ) : ? LightModel { $ identifier = implode ( '_' , [ $ class , $ foreignKey ] ) ; if ( ! isset ( $ this -> _belongsTo [ $ identifier ] ) ) { if ( ! $ this -> getTable ( ) -> hasColumn ( $ foreignKey ) ) { throw new ColumnMissingException ( $ this -> getTableName ( ) . ' does not have column: ' . $ foreignKey ) ; } $ this -> _belongsTo [ $ identifier ] = $ class :: getOneByKey ( $ this -> $ foreignKey ) ; } return $ this -> _belongsTo [ $ identifier ] ; }
Load the specified belongsTo relation model.

@param $class
@param $foreignKey
@return LightModel
@throws Exception
Load the specified belongsTo relation model .