public function ProfileStorage::loadMultipleByUser in Profile 8
Loads the given user's profiles.
Parameters
\Drupal\Core\Session\AccountInterface $account: The user.
string $profile_type_id: The profile type ID.
bool $published: Whether to load published or unpublished profiles. Defaults to published.
Return value
\Drupal\profile\Entity\ProfileInterface[] The profiles, ordered by publishing status and ID, descending.
Overrides ProfileStorageInterface::loadMultipleByUser
File
- src/
ProfileStorage.php, line 16
Class
- ProfileStorage
- Defines the entity storage for profile.
Namespace
Drupal\profileCode
public function loadMultipleByUser(AccountInterface $account, $profile_type_id, $published = TRUE) {
$query = $this
->getQuery();
$query
->condition('uid', $account
->id())
->condition('type', $profile_type_id)
->condition('status', $published)
->sort('is_default', 'DESC')
->sort('profile_id', 'DESC')
->accessCheck(FALSE);
$result = $query
->execute();
return $result ? $this
->loadMultiple($result) : [];
}