lib/components/types/Relationship.php
public function getModel($parentObjectId, $childObjectId, $activeOnly = true)
    {
        if (is_object($parentObjectId)) {
            $parentObjectId = $parentObjectId->primaryKey;
        }
        if (is_object($childObjectId)) {
            $childObjectId = $childObjectId->primaryKey;
        }
        $key = json_encode([__FUNCTION__, $this->systemId, $parentObjectId, $activeOnly]);
        if (!isset(self::$_cache[$key])) {
            $relationClass = Yii::$app->classes['Relation'];
            $all = $relationClass::find();
            $all->where(
                ['or', 'parent_object_id=:parentObjectId', 'child_object_id=:childObjectId']
            );
            $all->params[':parentObjectId'] = $parentObjectId;
            $all->params[':childObjectId'] = $childObjectId;
            if ($activeOnly) {
                Relatable::doAddActiveConditions($all, false);
            }
            $all = $all->all();
            foreach ($all as $relation) {
                $subkey = json_encode([__FUNCTION__, $this->systemId, $relation->parent_object_id, $activeOnly]);
                if (!isset(self::$_cache[$subkey])) {
                    self::$_cache[$subkey] = [];
                }
                self::$_cache[$subkey][$relation->child_object_id] = $relation;
            }
        }
        if (isset(self::$_cache[$key]) && isset(self::$_cache[$key][$childObjectId])) {
            return self::$_cache[$key][$childObjectId];
        }

        return false;
    }
public function getModel($parentObjectId, $childObjectId, $activeOnly = true)
    {
        if (is_object($parentObjectId)) {
            $parentObjectId = $parentObjectId->primaryKey;
        }
        if (is_object($childObjectId)) {
            $childObjectId = $childObjectId->primaryKey;
        }
        $key = json_encode([__FUNCTION__, $this->systemId, $parentObjectId, $activeOnly]);
        if (!isset(self::$_cache[$key])) {
            $relationClass = Yii::$app->classes['Relation'];
            $all = $relationClass::find();
            $all->where(
                ['or', 'parent_object_id=:parentObjectId', 'child_object_id=:childObjectId']
            );
            $all->params[':parentObjectId'] = $parentObjectId;
            $all->params[':childObjectId'] = $childObjectId;
            if ($activeOnly) {
                Relatable::doAddActiveConditions($all, false);
            }
            $all = $all->all();
            foreach ($all as $relation) {
                $subkey = json_encode([__FUNCTION__, $this->systemId, $relation->parent_object_id, $activeOnly]);
                if (!isset(self::$_cache[$subkey])) {
                    self::$_cache[$subkey] = [];
                }
                self::$_cache[$subkey][$relation->child_object_id] = $relation;
            }
        }
        if (isset(self::$_cache[$key]) && isset(self::$_cache[$key][$childObjectId])) {
            return self::$_cache[$key][$childObjectId];
        }

        return false;
    }
Get model.

@param [[@doctodo param_type:parentObjectId]] $parentObjectId [[@doctodo param_description:parentObjectId]]
@param [[@doctodo param_type:childObjectId]]  $childObjectId  [[@doctodo param_description:childObjectId]]
@param boolean                                $activeOnly     [[@doctodo param_description:activeOnly]] [optional]

@return [[@doctodo return_type:getModel]] [[@doctodo return_description:getModel]]