PluginProbe
Booking for Appointments and Events Calendar – Amelia / 2.4.9
Booking for Appointments and Events Calendar – Amelia v2.4.9
2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 All 59 releases
ameliabooking / src / Infrastructure / WP / InstallActions / DB / Booking / EventsTable.php
EventsTable.php
97 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AmeliaBooking\Infrastructure\WP\InstallActions\DB\Booking;
4
5 use AmeliaBooking\Domain\Common\Exceptions\InvalidArgumentException;
6 use AmeliaBooking\Domain\ValueObjects\Picture;
7 use AmeliaBooking\Domain\ValueObjects\String\Color;
8 use AmeliaBooking\Domain\ValueObjects\String\Name;
9 use AmeliaBooking\Infrastructure\WP\InstallActions\DB\AbstractDatabaseTable;
10 use AmeliaBooking\Domain\ValueObjects\String\Description;
11
12 /**
13 * Class EventsTable
14 *
15 * @package AmeliaBooking\Infrastructure\WP\InstallActions\DB\Booking
16 */
17 class EventsTable extends AbstractDatabaseTable
18 {
19 public const TABLE = 'events';
20
21 /**
22 * @return string
23 * @throws InvalidArgumentException
24 */
25 public static function buildTable()
26 {
27 $table = self::getTableName();
28
29 $charsetCollate = self::getCharsetCollate();
30
31 $name = Name::MAX_LENGTH;
32 $description = Description::MAX_LENGTH;
33 $color = Color::MAX_LENGTH;
34 $picture = Picture::MAX_LENGTH;
35
36 return "CREATE TABLE {$table} (
37 `id` INT(11) NOT NULL AUTO_INCREMENT,
38 `parentId` bigint(20),
39 `name` varchar({$name}) NOT NULL default '',
40 `status` ENUM('approved','pending','canceled','rejected') NOT NULL,
41 `bookingOpens` DATETIME NULL,
42 `bookingCloses` DATETIME NULL,
43 `bookingOpensRec` ENUM('same', 'calculate') DEFAULT 'same',
44 `bookingClosesRec` ENUM('same', 'calculate') DEFAULT 'same',
45 `ticketRangeRec` ENUM('same', 'calculate') DEFAULT 'calculate',
46 `recurringCycle` ENUM('daily', 'weekly', 'monthly', 'yearly') NULL,
47 `recurringOrder` int(11) NULL,
48 `recurringInterval` int(11) DEFAULT 1,
49 `recurringMonthly` ENUM('each' , 'on') DEFAULT 'each',
50 `monthlyDate` DATETIME NULL,
51 `monthlyOnRepeat` ENUM('first', 'second', 'third', 'fourth', 'fifth', 'last') DEFAULT NULL,
52 `monthlyOnDay` ENUM('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday') DEFAULT NULL,
53 `recurringUntil` DATETIME NULL,
54 `maxCapacity` int(11) NOT NULL,
55 `maxCustomCapacity` int(11) NULL DEFAULT NULL,
56 `maxExtraPeople` int(11) NULL DEFAULT NULL,
57 `price` double NOT NULL,
58 `locationId` bigint(20) NULL,
59 `customLocation` VARCHAR({$name}) NULL,
60 `description` TEXT({$description}) NULL,
61 `color` varchar({$color}) NULL NULL,
62 `show` TINYINT(1) NOT NULL DEFAULT 1,
63 `notifyParticipants` TINYINT(1) NOT NULL,
64 `created` DATETIME NOT NULL,
65 `settings` text({$description}) NULL DEFAULT NULL,
66 `zoomUserId` varchar({$name}) DEFAULT NULL,
67 `bringingAnyone` TINYINT(1) NULL DEFAULT 1,
68 `bookMultipleTimes` TINYINT(1) NULL DEFAULT 1,
69 `translations` TEXT NULL DEFAULT NULL,
70 `depositPayment` ENUM('disabled' , 'fixed', 'percentage') DEFAULT 'disabled',
71 `depositPerPerson` TINYINT(1) DEFAULT 1,
72 `fullPayment` TINYINT(1) DEFAULT 0,
73 `deposit` double DEFAULT 0,
74 `customPricing` TINYINT(1) DEFAULT 0,
75 `organizerId` bigint(20) NULL,
76 `closeAfterMin` INT(11) NULL DEFAULT NULL,
77 `closeAfterMinBookings` TINYINT(1) DEFAULT 0,
78 `aggregatedPrice` TINYINT(1) DEFAULT 1,
79 `error` TEXT({$description}) DEFAULT NULL,
80 `pictureFullPath` varchar ({$picture}) NULL,
81 `pictureThumbPath` varchar ({$picture}) NULL,
82 PRIMARY KEY (`id`)
83 ) {$charsetCollate};";
84 }
85
86 /**
87 * @return array
88 * @throws InvalidArgumentException
89 */
90 public static function alterTable()
91 {
92 $table = self::getTableName();
93
94 return ["ALTER TABLE {$table} MODIFY recurringInterval int(11) DEFAULT 1"];
95 }
96 }
97