ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ParticipantsManager.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
19 
23 
28 {
32 
33  public function __construct(
34  InternalDataService $data,
35  InternalRepoService $repo,
36  InternalDomainService $domain
37  ) {
38  $this->data = $data;
39  $this->repo = $repo;
40  $this->domain = $domain;
41  }
42 
43  public function createIfNotExisting(
44  int $user_id,
45  int $pool_id
46  ): void {
47  if (!\ilObjUser::_exists($user_id)) {
48  throw new \ilException("User $user_id does not exist.");
49  }
50  if (!\ilObjBookingPool::_exists($pool_id)) {
51  throw new \ilException("Booking Pool $pool_id does not exist.");
52  }
53 
54  $participant = new \ilBookingParticipant($user_id, $pool_id);
55  }
56 
57  public function removeFromAll(int $user_id): void
58  {
59  $this->repo->participants()->removeFromAll($user_id);
60  }
61 
62 }
__construct(InternalDataService $data, InternalRepoService $repo, InternalDomainService $domain)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...