lib/components/db/behaviors/Familiarity.php
public function getFamiliarity($user = null)
    {
        if (is_null($user)) {
            $user = $this->getUser(false);
        }
        if (is_object($user)) {
            $user = $user->primaryKey;
        }
        $familarityKey = md5($user);
        if (!isset($this->_familiarity[$familarityKey])) {
            $this->_familiarity[$familarityKey] = false;
            $familiarityClass = Yii::$app->classes['ObjectFamiliarity'];
            if (!empty($user)) {
                $attributes = [];
                $attributes[$this->objectField] = $this->owner->primaryKey;
                $attributes[$this->userField] = $user;
                $this->_familiarity[$familarityKey] = $familiarityClass::find()->where($attributes)->one();
                if (empty($this->_familiarity[$familarityKey])) {
                    $this->_familiarity[$familarityKey] = new $familiarityClass();
                    $this->_familiarity[$familarityKey]->attributes = $attributes;
                }
            }
        }

        return $this->_familiarity[$familarityKey];
    }
public function getFamiliarity($user = null)
    {
        if (is_null($user)) {
            $user = $this->getUser(false);
        }
        if (is_object($user)) {
            $user = $user->primaryKey;
        }
        $familarityKey = md5($user);
        if (!isset($this->_familiarity[$familarityKey])) {
            $this->_familiarity[$familarityKey] = false;
            $familiarityClass = Yii::$app->classes['ObjectFamiliarity'];
            if (!empty($user)) {
                $attributes = [];
                $attributes[$this->objectField] = $this->owner->primaryKey;
                $attributes[$this->userField] = $user;
                $this->_familiarity[$familarityKey] = $familiarityClass::find()->where($attributes)->one();
                if (empty($this->_familiarity[$familarityKey])) {
                    $this->_familiarity[$familarityKey] = new $familiarityClass();
                    $this->_familiarity[$familarityKey]->attributes = $attributes;
                }
            }
        }

        return $this->_familiarity[$familarityKey];
    }
public function getFamiliarity ( $ user = null ) { if ( is_null ( $ user ) ) { $ user = $ this -> getUser ( false ) ; } if ( is_object ( $ user ) ) { $ user = $ user -> primaryKey ; } $ familarityKey = md5 ( $ user ) ; if ( ! isset ( $ this -> _familiarity [ $ familarityKey ] ) ) { $ this -> _familiarity [ $ familarityKey ] = false ; $ familiarityClass = Yii :: $ app -> classes [ 'ObjectFamiliarity' ] ; if ( ! empty ( $ user ) ) { $ attributes = [ ] ; $ attributes [ $ this -> objectField ] = $ this -> owner -> primaryKey ; $ attributes [ $ this -> userField ] = $ user ; $ this -> _familiarity [ $ familarityKey ] = $ familiarityClass :: find ( ) -> where ( $ attributes ) -> one ( ) ; if ( empty ( $ this -> _familiarity [ $ familarityKey ] ) ) { $ this -> _familiarity [ $ familarityKey ] = new $ familiarityClass ( ) ; $ this -> _familiarity [ $ familarityKey ] -> attributes = $ attributes ; } } } return $ this -> _familiarity [ $ familarityKey ] ; }
Get familiarity.

@param [[@doctodo param_type:user]] $user [[@doctodo param_description:user]] [optional]

@return [[@doctodo return_type:getFamiliarity]] [[@doctodo return_description:getFamiliarity]]
Get familiarity .