Code cleanup to use new findCountWhere function

This commit is contained in:
Dane Everitt 2017-08-05 17:23:02 -05:00
parent c1a078bdcf
commit 4da7922de6
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
4 changed files with 9 additions and 10 deletions

View file

@ -141,13 +141,11 @@ class DeletionService
}
$this->database->beginTransaction();
$this->databaseRepository->withColumns('id')->findWhere([['server_id', '=', $server->id]])->each(function ($item) {
$this->databaseManagementService->delete($item->id);
});
$this->repository->delete($server->id);
$this->database->commit();
}
}

View file

@ -78,8 +78,8 @@ class DeletionService
$user = $user->id;
}
$servers = $this->serverRepository->findWhere([['owner_id', '=', $user]]);
if (count($servers) > 0) {
$servers = $this->serverRepository->withColumns('id')->findCountWhere([['owner_id', '=', $user]]);
if ($servers > 0) {
throw new DisplayException($this->translator->trans('admin/user.exceptions.user_has_servers'));
}

View file

@ -68,8 +68,6 @@ class UpdateService
$data['password'] = $this->hasher->make($data['password']);
}
$user = $this->repository->update($id, $data);
return $user;
return $this->repository->update($id, $data);
}
}