Skip to content

Commit

Permalink
Merge pull request #3515 from the-events-calendar/feat/adding-get_col…
Browse files Browse the repository at this point in the history
…umns-method-to-all-custom-tables

Adding get_columns method to all custom tables
  • Loading branch information
dpanta94 authored Jan 30, 2025
2 parents c8ec658 + e002c1d commit a4b30a4
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 8 deletions.
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
"_glotPressUrl": "https://translate.wordpress.org",
"_glotPressSlug": "wp-plugins/event-tickets/stable",
"_glotPressFileFormat": "%textdomain%-%wp_locale%.%format%",
"_glotPressFormats": [
"po",
"mo"
],
"_glotPressFormats": ["po", "mo"],
"_glotPressFilter": {
"translation_sets": false,
"minimum_percentage": 30,
Expand Down Expand Up @@ -83,10 +80,7 @@
"glotpress": "gulp glotpress",
"changelog": "./vendor/bin/changelogger add"
},
"engines": {
"node": "18.13.0",
"npm": "8.19.3"
},
"engines": { "node": "18.13.0", "npm": "8.19.3" },
"devDependencies": {
"@playwright/test": "^1.44.0",
"@the-events-calendar/product-taskmaster": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@ class Order_Modifier_Relationships extends Table {
*/
protected static $uid_column = 'id';

/**
* An array of all the columns in the table.
*
* @since TBD
*
* @var string[]
*/
public static function get_columns(): array {
return [
'id',
'modifier_id',
'post_id',
'post_type',
];
}

/**
* Returns the table creation SQL in the format supported
* by the `dbDelta` function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,28 @@ class Order_Modifiers extends Table {
*/
protected static $uid_column = 'id';

/**
* An array of all the columns in the table.
*
* @since TBD
*
* @var string[]
*/
public static function get_columns(): array {
return [
'id',
'modifier_type',
'sub_type',
'raw_amount',
'display_name',
'status',
'created_at',
'start_time',
'end_time',
'updated_at',
];
}

/**
* Returns the table creation SQL in the format supported
* by the `dbDelta` function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ class Order_Modifiers_Meta extends Table {
*/
protected static $uid_column = 'id';

/**
* An array of all the columns in the table.
*
* @since TBD
*
* @var string[]
*/
public static function get_columns(): array {
return [
'id',
'order_modifier_id',
'meta_key',
'meta_value',
'priority',
'created_at',
'updated_at',
];
}

/**
* Returns the table creation SQL in the format supported
* by the `dbDelta` function.
Expand Down
18 changes: 18 additions & 0 deletions src/Tickets/Seating/Tables/Layouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ class Layouts extends Table {
*/
protected static $uid_column = 'id';

/**
* An array of all the columns in the table.
*
* @since TBD
*
* @var string[]
*/
public static function get_columns(): array {
return [
'id',
'name',
'created_date',
'map',
'seats',
'screenshot_url',
];
}

/**
* Returns the table creation SQL in the format supported
* by the `dbDelta` function.
Expand Down
16 changes: 16 additions & 0 deletions src/Tickets/Seating/Tables/Maps.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ class Maps extends Table {
*/
protected static $uid_column = 'id';

/**
* An array of all the columns in the table.
*
* @since TBD
*
* @var string[]
*/
public static function get_columns(): array {
return [
'id',
'name',
'seats',
'screenshot_url',
];
}

/**
* Returns the table creation SQL in the format supported
* by the `dbDelta` function.
Expand Down
17 changes: 17 additions & 0 deletions src/Tickets/Seating/Tables/Seat_Types.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,23 @@ class Seat_Types extends Table {
*/
protected static $uid_column = 'id';

/**
* An array of all the columns in the table.
*
* @since TBD
*
* @var string[]
*/
public static function get_columns(): array {
return [
'id',
'name',
'map',
'layout',
'seats',
];
}

/**
* Returns the number of seats for a given seat type.
*
Expand Down
17 changes: 17 additions & 0 deletions src/Tickets/Seating/Tables/Sessions.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,23 @@ public static function remove_expired_sessions(): int {
}
}

/**
* An array of all the columns in the table.
*
* @since TBD
*
* @var string[]
*/
public static function get_columns(): array {
return [
'token',
'object_id',
'expiration',
'reservations',
'expiration_lock',
];
}

/**
* Returns the table creation SQL in the format supported
* by the `dbDelta` function.
Expand Down

0 comments on commit a4b30a4

Please sign in to comment.