code: protected function fillRelationConfig(&$config, $otherObject)
      {
          if (isset($config['parent_object_id'])) {
              $config['child_object_id'] = $otherObject;
          } elseif (isset($config['child_object_id'])) {
              $config['parent_object_id'] = $otherObject;
          }
      }
docs: fill absent relation attributes.
  
  @param array      $config      relationship configuration
  @param Model $otherObject the other object to fill in the relation config data