ILIAS  release_8 Revision v8.24
class.ilBookingManager8HotfixDBUpdateSteps.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
25 protected \ilDBInterface $db;
26
27 public function prepare(\ilDBInterface $db): void
28 {
29 $this->db = $db;
30 }
31
32 public function step_1(): void
33 {
34 $db = $this->db;
35 $set1 = $db->queryF("SELECT * FROM booking_object " .
36 " WHERE schedule_id = %s ",
37 ["integer"],
38 [1]
39 );
40 while ($rec1 = $db->fetchAssoc($set1)) {
41 $set2 = $db->queryF("SELECT * FROM booking_schedule " .
42 " WHERE pool_id = %s ORDER BY booking_schedule_id ASC LIMIT 1",
43 ["integer"],
44 [$rec1["pool_id"]]
45 );
46 if ($rec2 = $db->fetchAssoc($set2)) {
47 if ((int) $rec2["booking_schedule_id"] !== 1) {
48 $db->update("booking_object", [
49 "schedule_id" => ["intger", $rec2["booking_schedule_id"]]
50 ], [ // where
51 "booking_object_id" => ["integer", $rec1["booking_object_id"]]
52 ]
53 );
54 }
55 }
56 }
57 }
58}
Interface ilDBInterface.
update(string $table_name, array $values, array $where)
@description $where MUST contain existing columns only.
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.Agent.php:21