code: protected function createRelationQuery($class, $link, $multiple)
      {
          /* @var $class ActiveRecordInterface */
          /* @var $query ActiveQuery */
          $query = $class::find();
          $query->primaryModel = $this;
          $query->link = $link;
          $query->multiple = $multiple;
          return $query;
      }
docs: Creates a query instance for `has-one` or `has-many` relation.
  @param string $class the class name of the related record.
  @param array $link the primary-foreign key constraint.
  @param bool $multiple whether this query represents a relation to more than one record.
  @return ActiveQueryInterface the relational query object.
  @since 2.0.12
  @see hasOne()
  @see hasMany()