image method

Future<void> image(
  1. Session session,
  2. UserProfile userProfile,
  3. UserProfileImage image, {
  4. Transaction? transaction,
})

Creates a relation between the given UserProfile and UserProfileImage by setting the UserProfile's foreign key imageId to refer to the UserProfileImage.

Implementation

Future<void> image(
  _i1.Session session,
  UserProfile userProfile,
  _i3.UserProfileImage image, {
  _i1.Transaction? transaction,
}) async {
  if (userProfile.id == null) {
    throw ArgumentError.notNull('userProfile.id');
  }
  if (image.id == null) {
    throw ArgumentError.notNull('image.id');
  }

  var $userProfile = userProfile.copyWith(imageId: image.id);
  await session.db.updateRow<UserProfile>(
    $userProfile,
    columns: [UserProfile.t.imageId],
    transaction: transaction,
  );
}