You are here

public function WishlistStorage::loadMultipleByUser in Commerce Wishlist 8.3

Loads the given user's wishlists.

Parameters

\Drupal\Core\Session\AccountInterface $account: The user.

string $wishlist_type_id: The wishlist type ID.

Return value

\Drupal\profile\Entity\ProfileInterface[] The wishlists, ordered by ID, descending.

Overrides WishlistStorageInterface::loadMultipleByUser

File

src/WishlistStorage.php, line 44

Class

WishlistStorage
Defines the wishlist storage.

Namespace

Drupal\commerce_wishlist

Code

public function loadMultipleByUser(AccountInterface $account, $wishlist_type_id) {
  $query = $this
    ->getQuery();
  $query
    ->condition('uid', $account
    ->id())
    ->condition('type', $wishlist_type_id)
    ->sort('is_default', 'DESC')
    ->sort('wishlist_id', 'DESC')
    ->accessCheck(FALSE);
  $result = $query
    ->execute();
  return $result ? $this
    ->loadMultiple($result) : [];
}