public function hasOne($link, $defaults = [])
    {
        if (!is_array($defaults)) {
            $defaults = ['model' => $defaults ?: 'Model_'.$link];
        }

        $defaults['join'] = $this;

        return $this->owner->hasOne($link, $defaults);
    }
public function hasOne($link, $defaults = [])
    {
        if (!is_array($defaults)) {
            $defaults = ['model' => $defaults ?: 'Model_'.$link];
        }

        $defaults['join'] = $this;

        return $this->owner->hasOne($link, $defaults);
    }
public function hasOne ( $ link , $ defaults = [ ] ) { if ( ! is_array ( $ defaults ) ) { $ defaults = [ 'model' => $ defaults ? : 'Model_' . $ link ] ; } $ defaults [ 'join' ] = $ this ; return $ this -> owner -> hasOne ( $ link , $ defaults ) ; }
Creates reference based on a field from the join.

@param string $link
@param array  $defaults

@return Reference_One
Creates reference based on a field from the join .