ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
class.ParticipantsManager.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
26 
31 {
35 
36  public function __construct(
37  InternalDataService $data,
38  InternalRepoService $repo,
39  InternalDomainService $domain
40  ) {
41  $this->data = $data;
42  $this->repo = $repo;
43  $this->domain = $domain;
44  }
45 
46  public function createIfNotExisting(
47  int $user_id,
48  int $pool_id
49  ): void {
50  if (!\ilObjUser::_exists($user_id)) {
51  throw new \ilException("User $user_id does not exist.");
52  }
53  if (!\ilObjBookingPool::_exists($pool_id)) {
54  throw new \ilException("Booking Pool $pool_id does not exist.");
55  }
56 
57  $participant = new \ilBookingParticipant($user_id, $pool_id);
58  }
59 
60  public function removeFromAll(int $user_id): void
61  {
62  $this->repo->participants()->removeFromAll($user_id);
63  }
64 
65 }
__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