public function Account::getAccounts in GatherContent 8
Same name and namespace in other branches
- 8.3 src/DAO/Account.php \Drupal\gathercontent\DAO\Account::getAccounts()
Get list of accounts.
Return value
array Array with accounts.
File
- src/
DAO/ Account.php, line 66 - Contains GatherContent\Accont class.
Class
- Account
- Class Account.
Namespace
Drupal\gathercontent\DAOCode
public function getAccounts() {
$accounts = array();
try {
$response = $this->client
->get('/accounts');
if ($response
->getStatusCode() === 200) {
$data = json_decode($response
->getBody());
$accounts = $data->data;
}
else {
drupal_set_message(t("User with provided credentials wasn't found."), 'error');
$accounts = NULL;
}
} catch (\Exception $e) {
\Drupal::logger('gathercontent')
->error($e
->getMessage(), array());
drupal_set_message(t("User with provided credentials wasn't found. 1"), 'error');
$accounts = NULL;
}
return $accounts;
}