ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjUseBookDBRepository.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
13{
14 const TABLE_NAME = 'book_obj_use_book';
15
20 public function __construct(\ilDBInterface $db)
21 {
22 $this->db = $db;
23 }
24
29 public function updateUsedBookingPools(int $obj_id, array $book_obj_ids)
30 {
31 $db = $this->db;
32
33 $db->manipulateF(
34 "DELETE FROM " . self::TABLE_NAME . " WHERE " .
35 " obj_id = %s",
36 array("integer"),
37 array($obj_id)
38 );
39
40 foreach ($book_obj_ids as $id) {
41 $db->insert(self::TABLE_NAME, array(
42 "obj_id" => array("integer", (int) $obj_id),
43 "book_ref_id" => array("integer", (int) $id)
44 ));
45 }
46 }
47
53 public function getUsedBookingPools(int $obj_id) : array
54 {
55 $db = $this->db;
56
57 $set = $db->queryF(
58 "SELECT * FROM " . self::TABLE_NAME . " " .
59 " WHERE obj_id = %s ",
60 array("integer"),
61 array($obj_id)
62 );
63 $book_ids = [];
64 while ($rec = $db->fetchAssoc($set)) {
65 $book_ids[] = $rec["book_ref_id"];
66 }
67 return $book_ids;
68 }
69}
An exception for terminatinating execution or to throw for unit testing.
This repo stores infos on repository objects that are using booking managers as a service (resource m...
getUsedBookingPools(int $obj_id)
Get used booking pools.
__construct(\ilDBInterface $db)
ilObjUseBookDBRepository constructor.
updateUsedBookingPools(int $obj_id, array $book_obj_ids)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...