You are here

public function PhotosImageStorage::updatePhotosAlbum in Album Photos 6.0.x

Same name and namespace in other branches
  1. 8.5 src/PhotosImageStorage.php \Drupal\photos\PhotosImageStorage::updatePhotosAlbum()

Moves an image from one album to another.

Parameters

\Drupal\photos\PhotosImageInterface $image: The image entity.

int $new_album: The new image album.

Return value

bool If the image was successfully moved or not.

Overrides PhotosImageStorageInterface::updatePhotosAlbum

File

src/PhotosImageStorage.php, line 49

Class

PhotosImageStorage
Defines the storage handler class for photos images.

Namespace

Drupal\photos

Code

public function updatePhotosAlbum(PhotosImageInterface $image, $new_album) {
  return $this->database
    ->update($this
    ->getBaseTable())
    ->fields([
    'album_id' => $new_album,
  ])
    ->condition('fid', $image
    ->id())
    ->execute();
}