-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coupons & Fees - Relationship Table #3257
base: bucket/order_modifiers_coupon_fees
Are you sure you want to change the base?
Coupons & Fees - Relationship Table #3257
Conversation
…9_order_modifiers_relationship_table
if ( ! $this->has_index( $index_name ) ) { | ||
// Prepare the SQL for adding an index. | ||
$sql = $wpdb->prepare( | ||
"ALTER TABLE `$table_name` ADD INDEX `%s` ( $columns )", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[phpcs] reported by reviewdog 🐶WordPress.DB.PreparedSQL.InterpolatedNotPrepared
Use placeholders and $wpdb->prepare(); found interpolated variable $table_name at "ALTER TABLE $table_name
ADD INDEX %s
( $columns )"
if ( ! $this->has_index( $index_name ) ) { | ||
// Prepare the SQL for adding an index. | ||
$sql = $wpdb->prepare( | ||
"ALTER TABLE `$table_name` ADD INDEX `%s` ( $columns )", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[phpcs] reported by reviewdog 🐶WordPress.DB.PreparedSQL.InterpolatedNotPrepared
Use placeholders and $wpdb->prepare(); found interpolated variable $columns at "ALTER TABLE $table_name
ADD INDEX %s
( $columns )"
* | ||
* @return Order_Modifier_Relationships_DTO The DTO instance. | ||
*/ | ||
public static function fromObject( $object ): self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[phpcs] reported by reviewdog 🐶Universal.NamingConventions.NoReservedKeywordParameterNames.objectFound
It is recommended not to use reserved keyword "object" as function parameter name. Found: $object
</select> | ||
<p>Select a group to apply this fee to tickets automatically. This can be overridden on a per ticket | ||
basis during ticket creation.</p> | ||
</div> | ||
|
||
<?php | ||
// @todo redscar - This needs to be refactored. | ||
$posts = get_posts( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[phpcs] reported by reviewdog 🐶WordPress.WP.GlobalVariablesOverride.Prohibited
Overriding WordPress globals is prohibited. Found assignment to $posts
|
||
<select name="organizer_list"> | ||
<option value=""><?php esc_html_e( 'Select an organizer', 'event-tickets' ); ?></option> | ||
<?php foreach ( $posts as $post ) : ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[phpcs] reported by reviewdog 🐶WordPress.WP.GlobalVariablesOverride.Prohibited
Overriding WordPress globals is prohibited. Found assignment to $post
…relationship_table' into feature/et_2189_order_modifiers_relationship_table
* | ||
* @return static | ||
*/ | ||
public static function fromQueryBuilderObject( $object ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[phpcs] reported by reviewdog 🐶Universal.NamingConventions.NoReservedKeywordParameterNames.objectFound
It is recommended not to use reserved keyword "object" as function parameter name. Found: $object
I had to disable foreign key checks for the |
$builder = new ModelQueryBuilder( Order_Modifier::class ); | ||
|
||
return $builder->from( Table::table_name( false ), 'orders' ) | ||
->select( 'orders.*' ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[phpcs] reported by reviewdog 🐶Universal.WhiteSpace.PrecisionAlignment.Found
Found precision alignment of 3 spaces.
|
||
return $builder->from( Table::table_name( false ), 'orders' ) | ||
->select( 'orders.*' ) | ||
->innerJoin( "$meta_table as meta", 'meta.order_modifier_id', 'orders.id' ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[phpcs] reported by reviewdog 🐶Universal.WhiteSpace.PrecisionAlignment.Found
Found precision alignment of 3 spaces.
return $builder->from( Table::table_name( false ), 'orders' ) | ||
->select( 'orders.*' ) | ||
->innerJoin( "$meta_table as meta", 'meta.order_modifier_id', 'orders.id' ) | ||
->where( 'modifier_type', $modifier_type ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[phpcs] reported by reviewdog 🐶Universal.WhiteSpace.PrecisionAlignment.Found
Found precision alignment of 3 spaces.
->select( 'orders.*' ) | ||
->innerJoin( "$meta_table as meta", 'meta.order_modifier_id', 'orders.id' ) | ||
->where( 'modifier_type', $modifier_type ) | ||
->where( 'meta.meta_key', $meta_key ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[phpcs] reported by reviewdog 🐶Universal.WhiteSpace.PrecisionAlignment.Found
Found precision alignment of 3 spaces.
->innerJoin( "$meta_table as meta", 'meta.order_modifier_id', 'orders.id' ) | ||
->where( 'modifier_type', $modifier_type ) | ||
->where( 'meta.meta_key', $meta_key ) | ||
->where( 'meta.meta_value', $meta_value ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[phpcs] reported by reviewdog 🐶Universal.WhiteSpace.PrecisionAlignment.Found
Found precision alignment of 3 spaces.
->where( 'modifier_type', $modifier_type ) | ||
->where( 'meta.meta_key', $meta_key ) | ||
->where( 'meta.meta_value', $meta_value ) | ||
->getAll(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[phpcs] reported by reviewdog 🐶Universal.WhiteSpace.PrecisionAlignment.Found
Found precision alignment of 3 spaces.
…9_order_modifiers_relationship_table
@@ -14,12 +14,13 @@ | |||
use TEC\Common\StellarWP\Schema\Register as Schema_Register; | |||
use TEC\Common\StellarWP\Schema\Config as Schema_Config; | |||
use TEC\Common\StellarWP\DB\DB; | |||
use TEC\Common\StellarWP\Schema\Tables\Contracts\Table; | |||
use TEC\Tickets\Order_Modifiers\Custom_Tables\Order_Modifier_Relationships; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[phpcs] reported by reviewdog 🐶SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse
Type TEC\Tickets\Order_Modifiers\Custom_Tables\Order_Modifier_Relationships is not used in this file.
use TEC\Tickets\Order_Modifiers\Custom_Tables\Order_Modifiers; | ||
use TEC\Tickets\Order_Modifiers\Custom_Tables\Order_Modifiers_Meta; | ||
use TEC\Tickets\Order_Modifiers\Modifiers\Coupon; | ||
use TEC\Tickets\Order_Modifiers\Modifiers\Fee; | ||
use TEC\Tickets\Order_Modifiers\Modifiers\Modifier_Strategy_Interface; | ||
use TEC\Tickets\Order_Modifiers\Admin\Classic_Modifier; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[phpcs] reported by reviewdog 🐶SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse
Type TEC\Tickets\Order_Modifiers\Admin\Classic_Modifier is not used in this file.
Summary of Changes:
This PR introduces the integration of the relationship table into the order modifiers system. The work primarily focuses on ensuring that fee modifiers and their relationships (such as venues and organizers) are properly handled and updated in the database, while also improving overall flexibility and structure.
Key Changes:
Controller Updates:
Controller.php
to handle the new relationship logic, integrating with the newly createdOrder_Modifier_Relationships
class and ensuring proper flow when relationships are added or deleted.Order Modifier Relationships:
Order_Modifier_Relationships
class, which is responsible for managing the relationships between order modifiers (such as fees) and entities like venues or organizers.Order Modifier DTO (Data Transfer Object):
Order_Modifier_DTO
class to include relationship data, allowing for smooth data transfer between various layers of the application, and simplifying the handling of related entities.Name Changes & Refactoring:
Modifier_Settings
class toModifier_Admin_Handler
to better reflect its role in handling admin-related actions, such as managing order modifier settings and actions in the admin UI.Modifier_Abstract & Fee Class Updates:
Modifier_Abstract
class, which serves as the base for handling different types of modifiers.Fee
class, implemented logic to manage specific fee-related operations, including how the relationships with venues, organizers, and tickets are handled when a fee is created or updated.Additional Updates: