@@ -18,24 +18,24 @@ |
||
| 18 | 18 | class TicketVisibilityEnum extends EnumBase |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * TicketVisibilityEnum constructor. |
|
| 23 | - */ |
|
| 24 | - public function __construct() |
|
| 25 | - { |
|
| 26 | - $this->setName($this->namespace . 'TicketVisibilityEnum'); |
|
| 27 | - $this->setDescription(esc_html__('Where the ticket can be viewed throughout the UI', 'event_espresso')); |
|
| 28 | - parent::__construct(); |
|
| 29 | - } |
|
| 21 | + /** |
|
| 22 | + * TicketVisibilityEnum constructor. |
|
| 23 | + */ |
|
| 24 | + public function __construct() |
|
| 25 | + { |
|
| 26 | + $this->setName($this->namespace . 'TicketVisibilityEnum'); |
|
| 27 | + $this->setDescription(esc_html__('Where the ticket can be viewed throughout the UI', 'event_espresso')); |
|
| 28 | + parent::__construct(); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @return array |
|
| 34 | - * @throws EE_Error |
|
| 35 | - * @throws ReflectionException |
|
| 36 | - */ |
|
| 37 | - protected function getValues(): array |
|
| 38 | - { |
|
| 39 | - return EEM_Ticket::instance()->getTicketVisibilityValues(); |
|
| 40 | - } |
|
| 32 | + /** |
|
| 33 | + * @return array |
|
| 34 | + * @throws EE_Error |
|
| 35 | + * @throws ReflectionException |
|
| 36 | + */ |
|
| 37 | + protected function getValues(): array |
|
| 38 | + { |
|
| 39 | + return EEM_Ticket::instance()->getTicketVisibilityValues(); |
|
| 40 | + } |
|
| 41 | 41 | } |
@@ -20,34 +20,34 @@ |
||
| 20 | 20 | class ModelNameEnum extends EnumBase |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * ModelNameEnum constructor. |
|
| 25 | - */ |
|
| 26 | - public function __construct() |
|
| 27 | - { |
|
| 28 | - $this->setName($this->namespace . 'ModelNameEnum'); |
|
| 29 | - $this->setDescription(esc_html__('Entity model name', 'event_espresso')); |
|
| 30 | - parent::__construct(); |
|
| 31 | - } |
|
| 23 | + /** |
|
| 24 | + * ModelNameEnum constructor. |
|
| 25 | + */ |
|
| 26 | + public function __construct() |
|
| 27 | + { |
|
| 28 | + $this->setName($this->namespace . 'ModelNameEnum'); |
|
| 29 | + $this->setDescription(esc_html__('Entity model name', 'event_espresso')); |
|
| 30 | + parent::__construct(); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @return array |
|
| 36 | - * @throws EE_Error |
|
| 37 | - * @throws ReflectionException |
|
| 38 | - */ |
|
| 39 | - protected function getValues(): array |
|
| 40 | - { |
|
| 41 | - return [ |
|
| 42 | - 'DATETIME' => [ |
|
| 43 | - 'value' => EEM_Datetime::instance()->item_name(), |
|
| 44 | - ], |
|
| 45 | - 'TICKET' => [ |
|
| 46 | - 'value' => EEM_Ticket::instance()->item_name(), |
|
| 47 | - ], |
|
| 48 | - 'PRICE' => [ |
|
| 49 | - 'value' => EEM_Price::instance()->item_name(), |
|
| 50 | - ], |
|
| 51 | - ]; |
|
| 52 | - } |
|
| 34 | + /** |
|
| 35 | + * @return array |
|
| 36 | + * @throws EE_Error |
|
| 37 | + * @throws ReflectionException |
|
| 38 | + */ |
|
| 39 | + protected function getValues(): array |
|
| 40 | + { |
|
| 41 | + return [ |
|
| 42 | + 'DATETIME' => [ |
|
| 43 | + 'value' => EEM_Datetime::instance()->item_name(), |
|
| 44 | + ], |
|
| 45 | + 'TICKET' => [ |
|
| 46 | + 'value' => EEM_Ticket::instance()->item_name(), |
|
| 47 | + ], |
|
| 48 | + 'PRICE' => [ |
|
| 49 | + 'value' => EEM_Price::instance()->item_name(), |
|
| 50 | + ], |
|
| 51 | + ]; |
|
| 52 | + } |
|
| 53 | 53 | } |
@@ -16,38 +16,38 @@ |
||
| 16 | 16 | class FormSectionAppliesToEnum extends EnumBase |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * FormSectionAppliesToEnum constructor. |
|
| 21 | - */ |
|
| 22 | - public function __construct() |
|
| 23 | - { |
|
| 24 | - $this->setName($this->namespace . 'FormSectionAppliesToEnum'); |
|
| 25 | - $this->setDescription(esc_html__( |
|
| 26 | - 'Form user type that this form section should be presented to.', |
|
| 27 | - 'event_espresso' |
|
| 28 | - )); |
|
| 29 | - parent::__construct(); |
|
| 30 | - } |
|
| 19 | + /** |
|
| 20 | + * FormSectionAppliesToEnum constructor. |
|
| 21 | + */ |
|
| 22 | + public function __construct() |
|
| 23 | + { |
|
| 24 | + $this->setName($this->namespace . 'FormSectionAppliesToEnum'); |
|
| 25 | + $this->setDescription(esc_html__( |
|
| 26 | + 'Form user type that this form section should be presented to.', |
|
| 27 | + 'event_espresso' |
|
| 28 | + )); |
|
| 29 | + parent::__construct(); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @return array |
|
| 35 | - */ |
|
| 36 | - protected function getValues(): array |
|
| 37 | - { |
|
| 38 | - return [ |
|
| 39 | - 'ALL' => [ |
|
| 40 | - 'value' => EEM_Form_Section::APPLIES_TO_ALL, |
|
| 41 | - ], |
|
| 42 | - 'PRIMARY' => [ |
|
| 43 | - 'value' => EEM_Form_Section::APPLIES_TO_PRIMARY, |
|
| 44 | - ], |
|
| 45 | - 'PURCHASER' => [ |
|
| 46 | - 'value' => EEM_Form_Section::APPLIES_TO_PURCHASER, |
|
| 47 | - ], |
|
| 48 | - 'REGISTRANTS' => [ |
|
| 49 | - 'value' => EEM_Form_Section::APPLIES_TO_REGISTRANTS, |
|
| 50 | - ], |
|
| 51 | - ]; |
|
| 52 | - } |
|
| 33 | + /** |
|
| 34 | + * @return array |
|
| 35 | + */ |
|
| 36 | + protected function getValues(): array |
|
| 37 | + { |
|
| 38 | + return [ |
|
| 39 | + 'ALL' => [ |
|
| 40 | + 'value' => EEM_Form_Section::APPLIES_TO_ALL, |
|
| 41 | + ], |
|
| 42 | + 'PRIMARY' => [ |
|
| 43 | + 'value' => EEM_Form_Section::APPLIES_TO_PRIMARY, |
|
| 44 | + ], |
|
| 45 | + 'PURCHASER' => [ |
|
| 46 | + 'value' => EEM_Form_Section::APPLIES_TO_PURCHASER, |
|
| 47 | + ], |
|
| 48 | + 'REGISTRANTS' => [ |
|
| 49 | + 'value' => EEM_Form_Section::APPLIES_TO_REGISTRANTS, |
|
| 50 | + ], |
|
| 51 | + ]; |
|
| 52 | + } |
|
| 53 | 53 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct() |
| 23 | 23 | { |
| 24 | - $this->setName($this->namespace . 'FormSectionAppliesToEnum'); |
|
| 24 | + $this->setName($this->namespace.'FormSectionAppliesToEnum'); |
|
| 25 | 25 | $this->setDescription(esc_html__( |
| 26 | 26 | 'Form user type that this form section should be presented to.', |
| 27 | 27 | 'event_espresso' |
@@ -12,99 +12,99 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class Utilities |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
| 17 | - * friendly keys. |
|
| 18 | - * |
|
| 19 | - * @param array $where_args |
|
| 20 | - * @param array $arg_mapping array where keys are GQL field names and values are EE modal field names |
|
| 21 | - * @param array $id_fields The fields to convert from global IDs to DB IDs. |
|
| 22 | - * @param array $options Additional parameters for modifying args: [ |
|
| 23 | - * 'include_all_args' => bool, // will return ALL args in $where_args if true |
|
| 24 | - * 'use_IN_operator' => bool, // arrays of IDs will use SQL IN clause if true |
|
| 25 | - * ] |
|
| 26 | - * @return array |
|
| 27 | - */ |
|
| 28 | - public function sanitizeWhereArgs( |
|
| 29 | - array $where_args, |
|
| 30 | - array $arg_mapping, |
|
| 31 | - array $id_fields, |
|
| 32 | - array $options = [] |
|
| 33 | - ): array { |
|
| 34 | - // if "include_all_args" is true, then the incoming $where_args array |
|
| 35 | - // will be copied to the outgoing $where_params prior to sanitizing the fields. |
|
| 36 | - // so ALL elements in the $where_args array will be present in the $where_params array |
|
| 37 | - $include_all_args = isset($options['include_all_args']) |
|
| 38 | - ? filter_var($options['include_all_args'], FILTER_VALIDATE_BOOLEAN) |
|
| 39 | - : false; |
|
| 40 | - // if "use_IN_operator" is true, then any ID args found in the $id_fields array |
|
| 41 | - // will have their values converted to use an SQL "IN" clause format |
|
| 42 | - // if the value returned from Relay::fromGlobalId() is an array of IDs |
|
| 43 | - $use_IN_operator = isset($options['use_IN_operator']) |
|
| 44 | - && filter_var($options['use_IN_operator'], FILTER_VALIDATE_BOOLEAN); |
|
| 45 | - $where_params = $include_all_args ? $where_args : []; |
|
| 46 | - foreach ($where_args as $arg => $value) { |
|
| 47 | - if (! array_key_exists($arg, $arg_mapping)) { |
|
| 48 | - continue; |
|
| 49 | - } |
|
| 50 | - if (is_array($value) && ! empty($value)) { |
|
| 51 | - $value = array_map( |
|
| 52 | - static function ($value) { |
|
| 53 | - if (is_string($value)) { |
|
| 54 | - $value = sanitize_text_field($value); |
|
| 55 | - } |
|
| 56 | - return $value; |
|
| 57 | - }, |
|
| 58 | - $value |
|
| 59 | - ); |
|
| 60 | - } elseif (is_string($value)) { |
|
| 61 | - $value = sanitize_text_field($value); |
|
| 62 | - } |
|
| 63 | - if (in_array($arg, $id_fields, true)) { |
|
| 64 | - $ID = $this->convertFromGlobalId($value); |
|
| 65 | - // Use the proper operator. |
|
| 66 | - $value = $use_IN_operator && is_array($ID) ? ['IN', $ID] : $ID; |
|
| 67 | - } |
|
| 68 | - $where_params[ $arg_mapping[ $arg ] ] = $value; |
|
| 69 | - } |
|
| 70 | - return $where_params; |
|
| 71 | - } |
|
| 15 | + /** |
|
| 16 | + * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
| 17 | + * friendly keys. |
|
| 18 | + * |
|
| 19 | + * @param array $where_args |
|
| 20 | + * @param array $arg_mapping array where keys are GQL field names and values are EE modal field names |
|
| 21 | + * @param array $id_fields The fields to convert from global IDs to DB IDs. |
|
| 22 | + * @param array $options Additional parameters for modifying args: [ |
|
| 23 | + * 'include_all_args' => bool, // will return ALL args in $where_args if true |
|
| 24 | + * 'use_IN_operator' => bool, // arrays of IDs will use SQL IN clause if true |
|
| 25 | + * ] |
|
| 26 | + * @return array |
|
| 27 | + */ |
|
| 28 | + public function sanitizeWhereArgs( |
|
| 29 | + array $where_args, |
|
| 30 | + array $arg_mapping, |
|
| 31 | + array $id_fields, |
|
| 32 | + array $options = [] |
|
| 33 | + ): array { |
|
| 34 | + // if "include_all_args" is true, then the incoming $where_args array |
|
| 35 | + // will be copied to the outgoing $where_params prior to sanitizing the fields. |
|
| 36 | + // so ALL elements in the $where_args array will be present in the $where_params array |
|
| 37 | + $include_all_args = isset($options['include_all_args']) |
|
| 38 | + ? filter_var($options['include_all_args'], FILTER_VALIDATE_BOOLEAN) |
|
| 39 | + : false; |
|
| 40 | + // if "use_IN_operator" is true, then any ID args found in the $id_fields array |
|
| 41 | + // will have their values converted to use an SQL "IN" clause format |
|
| 42 | + // if the value returned from Relay::fromGlobalId() is an array of IDs |
|
| 43 | + $use_IN_operator = isset($options['use_IN_operator']) |
|
| 44 | + && filter_var($options['use_IN_operator'], FILTER_VALIDATE_BOOLEAN); |
|
| 45 | + $where_params = $include_all_args ? $where_args : []; |
|
| 46 | + foreach ($where_args as $arg => $value) { |
|
| 47 | + if (! array_key_exists($arg, $arg_mapping)) { |
|
| 48 | + continue; |
|
| 49 | + } |
|
| 50 | + if (is_array($value) && ! empty($value)) { |
|
| 51 | + $value = array_map( |
|
| 52 | + static function ($value) { |
|
| 53 | + if (is_string($value)) { |
|
| 54 | + $value = sanitize_text_field($value); |
|
| 55 | + } |
|
| 56 | + return $value; |
|
| 57 | + }, |
|
| 58 | + $value |
|
| 59 | + ); |
|
| 60 | + } elseif (is_string($value)) { |
|
| 61 | + $value = sanitize_text_field($value); |
|
| 62 | + } |
|
| 63 | + if (in_array($arg, $id_fields, true)) { |
|
| 64 | + $ID = $this->convertFromGlobalId($value); |
|
| 65 | + // Use the proper operator. |
|
| 66 | + $value = $use_IN_operator && is_array($ID) ? ['IN', $ID] : $ID; |
|
| 67 | + } |
|
| 68 | + $where_params[ $arg_mapping[ $arg ] ] = $value; |
|
| 69 | + } |
|
| 70 | + return $where_params; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Converts global ID to DB ID. |
|
| 76 | - * |
|
| 77 | - * @param string|string[] $ID |
|
| 78 | - * @return mixed |
|
| 79 | - */ |
|
| 80 | - public function convertFromGlobalId($ID) |
|
| 81 | - { |
|
| 82 | - if (is_array($ID)) { |
|
| 83 | - return array_map([$this, 'convertFromGlobalId'], $ID); |
|
| 84 | - } |
|
| 85 | - $parts = Relay::fromGlobalId($ID); |
|
| 86 | - return ! empty($parts['id']) ? $parts['id'] : null; |
|
| 87 | - } |
|
| 74 | + /** |
|
| 75 | + * Converts global ID to DB ID. |
|
| 76 | + * |
|
| 77 | + * @param string|string[] $ID |
|
| 78 | + * @return mixed |
|
| 79 | + */ |
|
| 80 | + public function convertFromGlobalId($ID) |
|
| 81 | + { |
|
| 82 | + if (is_array($ID)) { |
|
| 83 | + return array_map([$this, 'convertFromGlobalId'], $ID); |
|
| 84 | + } |
|
| 85 | + $parts = Relay::fromGlobalId($ID); |
|
| 86 | + return ! empty($parts['id']) ? $parts['id'] : null; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Convert the DB ID into GID |
|
| 92 | - * |
|
| 93 | - * @param string $type |
|
| 94 | - * @param int|int[] $ID |
|
| 95 | - * @return mixed |
|
| 96 | - */ |
|
| 97 | - public function convertToGlobalId(string $type, $ID) |
|
| 98 | - { |
|
| 99 | - $convertToGlobalId = [$this, 'convertToGlobalId']; |
|
| 100 | - if (is_array($ID)) { |
|
| 101 | - return array_map( |
|
| 102 | - static function ($id) use ($convertToGlobalId, $type) { |
|
| 103 | - return $convertToGlobalId($type, $id); |
|
| 104 | - }, |
|
| 105 | - $ID |
|
| 106 | - ); |
|
| 107 | - } |
|
| 108 | - return Relay::toGlobalId($type, $ID); |
|
| 109 | - } |
|
| 90 | + /** |
|
| 91 | + * Convert the DB ID into GID |
|
| 92 | + * |
|
| 93 | + * @param string $type |
|
| 94 | + * @param int|int[] $ID |
|
| 95 | + * @return mixed |
|
| 96 | + */ |
|
| 97 | + public function convertToGlobalId(string $type, $ID) |
|
| 98 | + { |
|
| 99 | + $convertToGlobalId = [$this, 'convertToGlobalId']; |
|
| 100 | + if (is_array($ID)) { |
|
| 101 | + return array_map( |
|
| 102 | + static function ($id) use ($convertToGlobalId, $type) { |
|
| 103 | + return $convertToGlobalId($type, $id); |
|
| 104 | + }, |
|
| 105 | + $ID |
|
| 106 | + ); |
|
| 107 | + } |
|
| 108 | + return Relay::toGlobalId($type, $ID); |
|
| 109 | + } |
|
| 110 | 110 | } |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | && filter_var($options['use_IN_operator'], FILTER_VALIDATE_BOOLEAN); |
| 45 | 45 | $where_params = $include_all_args ? $where_args : []; |
| 46 | 46 | foreach ($where_args as $arg => $value) { |
| 47 | - if (! array_key_exists($arg, $arg_mapping)) { |
|
| 47 | + if ( ! array_key_exists($arg, $arg_mapping)) { |
|
| 48 | 48 | continue; |
| 49 | 49 | } |
| 50 | 50 | if (is_array($value) && ! empty($value)) { |
| 51 | 51 | $value = array_map( |
| 52 | - static function ($value) { |
|
| 52 | + static function($value) { |
|
| 53 | 53 | if (is_string($value)) { |
| 54 | 54 | $value = sanitize_text_field($value); |
| 55 | 55 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | // Use the proper operator. |
| 66 | 66 | $value = $use_IN_operator && is_array($ID) ? ['IN', $ID] : $ID; |
| 67 | 67 | } |
| 68 | - $where_params[ $arg_mapping[ $arg ] ] = $value; |
|
| 68 | + $where_params[$arg_mapping[$arg]] = $value; |
|
| 69 | 69 | } |
| 70 | 70 | return $where_params; |
| 71 | 71 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $convertToGlobalId = [$this, 'convertToGlobalId']; |
| 100 | 100 | if (is_array($ID)) { |
| 101 | 101 | return array_map( |
| 102 | - static function ($id) use ($convertToGlobalId, $type) { |
|
| 102 | + static function($id) use ($convertToGlobalId, $type) { |
|
| 103 | 103 | return $convertToGlobalId($type, $id); |
| 104 | 104 | }, |
| 105 | 105 | $ID |
@@ -20,43 +20,43 @@ |
||
| 20 | 20 | { |
| 21 | 21 | |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * TicketConnection constructor. |
|
| 25 | - * |
|
| 26 | - * @param EEM_Ticket $model |
|
| 27 | - */ |
|
| 28 | - public function __construct(EEM_Ticket $model) |
|
| 29 | - { |
|
| 30 | - parent::__construct($model); |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * @return array |
|
| 36 | - */ |
|
| 37 | - public function config(): array |
|
| 38 | - { |
|
| 39 | - return [ |
|
| 40 | - 'fromType' => 'RootQuery', |
|
| 41 | - 'toType' => $this->namespace . 'Ticket', |
|
| 42 | - 'fromFieldName' => lcfirst($this->namespace) . 'Tickets', |
|
| 43 | - 'connectionTypeName' => "{$this->namespace}RootQueryTicketsConnection", |
|
| 44 | - 'connectionArgs' => DatetimeTicketsConnection::get_connection_args(), |
|
| 45 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 46 | - ]; |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @param $entity |
|
| 52 | - * @param $args |
|
| 53 | - * @param $context |
|
| 54 | - * @param $info |
|
| 55 | - * @return TicketConnectionResolver |
|
| 56 | - * @throws Exception |
|
| 57 | - */ |
|
| 58 | - public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
| 59 | - { |
|
| 60 | - return new TicketConnectionResolver($entity, $args, $context, $info); |
|
| 61 | - } |
|
| 23 | + /** |
|
| 24 | + * TicketConnection constructor. |
|
| 25 | + * |
|
| 26 | + * @param EEM_Ticket $model |
|
| 27 | + */ |
|
| 28 | + public function __construct(EEM_Ticket $model) |
|
| 29 | + { |
|
| 30 | + parent::__construct($model); |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * @return array |
|
| 36 | + */ |
|
| 37 | + public function config(): array |
|
| 38 | + { |
|
| 39 | + return [ |
|
| 40 | + 'fromType' => 'RootQuery', |
|
| 41 | + 'toType' => $this->namespace . 'Ticket', |
|
| 42 | + 'fromFieldName' => lcfirst($this->namespace) . 'Tickets', |
|
| 43 | + 'connectionTypeName' => "{$this->namespace}RootQueryTicketsConnection", |
|
| 44 | + 'connectionArgs' => DatetimeTicketsConnection::get_connection_args(), |
|
| 45 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 46 | + ]; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @param $entity |
|
| 52 | + * @param $args |
|
| 53 | + * @param $context |
|
| 54 | + * @param $info |
|
| 55 | + * @return TicketConnectionResolver |
|
| 56 | + * @throws Exception |
|
| 57 | + */ |
|
| 58 | + public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
| 59 | + { |
|
| 60 | + return new TicketConnectionResolver($entity, $args, $context, $info); |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -20,43 +20,43 @@ |
||
| 20 | 20 | { |
| 21 | 21 | |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * PriceConnection constructor. |
|
| 25 | - * |
|
| 26 | - * @param EEM_Price $model |
|
| 27 | - */ |
|
| 28 | - public function __construct(EEM_Price $model) |
|
| 29 | - { |
|
| 30 | - parent::__construct($model); |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * @return array |
|
| 36 | - */ |
|
| 37 | - public function config(): array |
|
| 38 | - { |
|
| 39 | - return [ |
|
| 40 | - 'fromType' => 'RootQuery', |
|
| 41 | - 'toType' => $this->namespace . 'Price', |
|
| 42 | - 'fromFieldName' => lcfirst($this->namespace) . 'Prices', |
|
| 43 | - 'connectionTypeName' => "{$this->namespace}RootQueryPricesConnection", |
|
| 44 | - 'connectionArgs' => TicketPricesConnection::get_connection_args(), |
|
| 45 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 46 | - ]; |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @param $entity |
|
| 52 | - * @param $args |
|
| 53 | - * @param $context |
|
| 54 | - * @param $info |
|
| 55 | - * @return PriceConnectionResolver |
|
| 56 | - * @throws Exception |
|
| 57 | - */ |
|
| 58 | - public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
| 59 | - { |
|
| 60 | - return new PriceConnectionResolver($entity, $args, $context, $info); |
|
| 61 | - } |
|
| 23 | + /** |
|
| 24 | + * PriceConnection constructor. |
|
| 25 | + * |
|
| 26 | + * @param EEM_Price $model |
|
| 27 | + */ |
|
| 28 | + public function __construct(EEM_Price $model) |
|
| 29 | + { |
|
| 30 | + parent::__construct($model); |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * @return array |
|
| 36 | + */ |
|
| 37 | + public function config(): array |
|
| 38 | + { |
|
| 39 | + return [ |
|
| 40 | + 'fromType' => 'RootQuery', |
|
| 41 | + 'toType' => $this->namespace . 'Price', |
|
| 42 | + 'fromFieldName' => lcfirst($this->namespace) . 'Prices', |
|
| 43 | + 'connectionTypeName' => "{$this->namespace}RootQueryPricesConnection", |
|
| 44 | + 'connectionArgs' => TicketPricesConnection::get_connection_args(), |
|
| 45 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 46 | + ]; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @param $entity |
|
| 52 | + * @param $args |
|
| 53 | + * @param $context |
|
| 54 | + * @param $info |
|
| 55 | + * @return PriceConnectionResolver |
|
| 56 | + * @throws Exception |
|
| 57 | + */ |
|
| 58 | + public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
| 59 | + { |
|
| 60 | + return new PriceConnectionResolver($entity, $args, $context, $info); |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -20,127 +20,127 @@ |
||
| 20 | 20 | { |
| 21 | 21 | |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * DatetimeConnection constructor. |
|
| 25 | - * |
|
| 26 | - * @param EEM_Ticket $model |
|
| 27 | - */ |
|
| 28 | - public function __construct(EEM_Ticket $model) |
|
| 29 | - { |
|
| 30 | - parent::__construct($model); |
|
| 31 | - } |
|
| 23 | + /** |
|
| 24 | + * DatetimeConnection constructor. |
|
| 25 | + * |
|
| 26 | + * @param EEM_Ticket $model |
|
| 27 | + */ |
|
| 28 | + public function __construct(EEM_Ticket $model) |
|
| 29 | + { |
|
| 30 | + parent::__construct($model); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @return array |
|
| 36 | - */ |
|
| 37 | - public function config(): array |
|
| 38 | - { |
|
| 39 | - return [ |
|
| 40 | - 'fromType' => $this->namespace . 'Datetime', |
|
| 41 | - 'toType' => $this->namespace . 'Ticket', |
|
| 42 | - 'fromFieldName' => 'tickets', |
|
| 43 | - 'connectionTypeName' => "{$this->namespace}DatetimeTicketsConnection", |
|
| 44 | - 'connectionArgs' => self::get_connection_args(), |
|
| 45 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 46 | - ]; |
|
| 47 | - } |
|
| 34 | + /** |
|
| 35 | + * @return array |
|
| 36 | + */ |
|
| 37 | + public function config(): array |
|
| 38 | + { |
|
| 39 | + return [ |
|
| 40 | + 'fromType' => $this->namespace . 'Datetime', |
|
| 41 | + 'toType' => $this->namespace . 'Ticket', |
|
| 42 | + 'fromFieldName' => 'tickets', |
|
| 43 | + 'connectionTypeName' => "{$this->namespace}DatetimeTicketsConnection", |
|
| 44 | + 'connectionArgs' => self::get_connection_args(), |
|
| 45 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 46 | + ]; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @param $entity |
|
| 52 | - * @param $args |
|
| 53 | - * @param $context |
|
| 54 | - * @param $info |
|
| 55 | - * @return array|Deferred|mixed |
|
| 56 | - * @throws Exception |
|
| 57 | - */ |
|
| 58 | - public function resolveConnection($entity, $args, $context, $info) |
|
| 59 | - { |
|
| 60 | - $resolver = new TicketConnectionResolver($entity, $args, $context, $info); |
|
| 61 | - return $resolver->get_connection(); |
|
| 62 | - } |
|
| 50 | + /** |
|
| 51 | + * @param $entity |
|
| 52 | + * @param $args |
|
| 53 | + * @param $context |
|
| 54 | + * @param $info |
|
| 55 | + * @return array|Deferred|mixed |
|
| 56 | + * @throws Exception |
|
| 57 | + */ |
|
| 58 | + public function resolveConnection($entity, $args, $context, $info) |
|
| 59 | + { |
|
| 60 | + $resolver = new TicketConnectionResolver($entity, $args, $context, $info); |
|
| 61 | + return $resolver->get_connection(); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Given an optional array of args, this returns the args to be used in the connection |
|
| 66 | - * |
|
| 67 | - * @param array $args The args to modify the defaults |
|
| 68 | - * @return array |
|
| 69 | - */ |
|
| 70 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 71 | - public static function get_connection_args(array $args = []): array |
|
| 72 | - { |
|
| 73 | - $newArgs = [ |
|
| 74 | - 'orderby' => [ |
|
| 75 | - 'type' => ['list_of' => 'EspressoTicketsConnectionOrderbyInput'], |
|
| 76 | - 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 77 | - ], |
|
| 78 | - 'datetime' => [ |
|
| 79 | - 'type' => 'ID', |
|
| 80 | - 'description' => esc_html__('Globally unique datetime ID to get the tickets for.', 'event_espresso'), |
|
| 81 | - ], |
|
| 82 | - 'datetimeIn' => [ |
|
| 83 | - 'type' => ['list_of' => 'ID'], |
|
| 84 | - 'description' => esc_html__('Globally unique datetime IDs to get the tickets for.', 'event_espresso'), |
|
| 85 | - ], |
|
| 86 | - 'datetimeId' => [ |
|
| 87 | - 'type' => 'Int', |
|
| 88 | - 'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'), |
|
| 89 | - ], |
|
| 90 | - 'datetimeIdIn' => [ |
|
| 91 | - 'type' => ['list_of' => 'Int'], |
|
| 92 | - 'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'), |
|
| 93 | - ], |
|
| 94 | - 'event' => [ |
|
| 95 | - 'type' => 'ID', |
|
| 96 | - 'description' => esc_html__('Globally unique event ID to get the tickets for.', 'event_espresso'), |
|
| 97 | - ], |
|
| 98 | - 'eventIn' => [ |
|
| 99 | - 'type' => ['list_of' => 'ID'], |
|
| 100 | - 'description' => esc_html__('Globally unique event IDs to get the tickets for.', 'event_espresso'), |
|
| 101 | - ], |
|
| 102 | - 'eventId' => [ |
|
| 103 | - 'type' => 'Int', |
|
| 104 | - 'description' => esc_html__('Event ID to get the tickets for.', 'event_espresso'), |
|
| 105 | - ], |
|
| 106 | - 'eventIdIn' => [ |
|
| 107 | - 'type' => ['list_of' => 'Int'], |
|
| 108 | - 'description' => esc_html__('Event IDs to get the tickets for.', 'event_espresso'), |
|
| 109 | - ], |
|
| 110 | - 'includeDefaultTickets' => [ |
|
| 111 | - 'type' => 'Boolean', |
|
| 112 | - 'description' => esc_html__('Whether to add default tickets to the list.', 'event_espresso'), |
|
| 113 | - ], |
|
| 114 | - 'search' => [ |
|
| 115 | - 'type' => 'String', |
|
| 116 | - 'description' => esc_html__('The search keywords', 'event_espresso'), |
|
| 117 | - ], |
|
| 118 | - 'isDefault' => [ |
|
| 119 | - 'type' => 'Boolean', |
|
| 120 | - 'description' => esc_html__('Filter the default tickets', 'event_espresso'), |
|
| 121 | - ], |
|
| 122 | - 'isRequired' => [ |
|
| 123 | - 'type' => 'Boolean', |
|
| 124 | - 'description' => esc_html__('Filter the required tickets', 'event_espresso'), |
|
| 125 | - ], |
|
| 126 | - 'isTaxable' => [ |
|
| 127 | - 'type' => 'Boolean', |
|
| 128 | - 'description' => esc_html__('Filter the taxable tickets', 'event_espresso'), |
|
| 129 | - ], |
|
| 130 | - 'isTrashed' => [ |
|
| 131 | - 'type' => 'Boolean', |
|
| 132 | - 'description' => esc_html__('Filter the trashed tickets', 'event_espresso'), |
|
| 133 | - ], |
|
| 134 | - ]; |
|
| 64 | + /** |
|
| 65 | + * Given an optional array of args, this returns the args to be used in the connection |
|
| 66 | + * |
|
| 67 | + * @param array $args The args to modify the defaults |
|
| 68 | + * @return array |
|
| 69 | + */ |
|
| 70 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 71 | + public static function get_connection_args(array $args = []): array |
|
| 72 | + { |
|
| 73 | + $newArgs = [ |
|
| 74 | + 'orderby' => [ |
|
| 75 | + 'type' => ['list_of' => 'EspressoTicketsConnectionOrderbyInput'], |
|
| 76 | + 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 77 | + ], |
|
| 78 | + 'datetime' => [ |
|
| 79 | + 'type' => 'ID', |
|
| 80 | + 'description' => esc_html__('Globally unique datetime ID to get the tickets for.', 'event_espresso'), |
|
| 81 | + ], |
|
| 82 | + 'datetimeIn' => [ |
|
| 83 | + 'type' => ['list_of' => 'ID'], |
|
| 84 | + 'description' => esc_html__('Globally unique datetime IDs to get the tickets for.', 'event_espresso'), |
|
| 85 | + ], |
|
| 86 | + 'datetimeId' => [ |
|
| 87 | + 'type' => 'Int', |
|
| 88 | + 'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'), |
|
| 89 | + ], |
|
| 90 | + 'datetimeIdIn' => [ |
|
| 91 | + 'type' => ['list_of' => 'Int'], |
|
| 92 | + 'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'), |
|
| 93 | + ], |
|
| 94 | + 'event' => [ |
|
| 95 | + 'type' => 'ID', |
|
| 96 | + 'description' => esc_html__('Globally unique event ID to get the tickets for.', 'event_espresso'), |
|
| 97 | + ], |
|
| 98 | + 'eventIn' => [ |
|
| 99 | + 'type' => ['list_of' => 'ID'], |
|
| 100 | + 'description' => esc_html__('Globally unique event IDs to get the tickets for.', 'event_espresso'), |
|
| 101 | + ], |
|
| 102 | + 'eventId' => [ |
|
| 103 | + 'type' => 'Int', |
|
| 104 | + 'description' => esc_html__('Event ID to get the tickets for.', 'event_espresso'), |
|
| 105 | + ], |
|
| 106 | + 'eventIdIn' => [ |
|
| 107 | + 'type' => ['list_of' => 'Int'], |
|
| 108 | + 'description' => esc_html__('Event IDs to get the tickets for.', 'event_espresso'), |
|
| 109 | + ], |
|
| 110 | + 'includeDefaultTickets' => [ |
|
| 111 | + 'type' => 'Boolean', |
|
| 112 | + 'description' => esc_html__('Whether to add default tickets to the list.', 'event_espresso'), |
|
| 113 | + ], |
|
| 114 | + 'search' => [ |
|
| 115 | + 'type' => 'String', |
|
| 116 | + 'description' => esc_html__('The search keywords', 'event_espresso'), |
|
| 117 | + ], |
|
| 118 | + 'isDefault' => [ |
|
| 119 | + 'type' => 'Boolean', |
|
| 120 | + 'description' => esc_html__('Filter the default tickets', 'event_espresso'), |
|
| 121 | + ], |
|
| 122 | + 'isRequired' => [ |
|
| 123 | + 'type' => 'Boolean', |
|
| 124 | + 'description' => esc_html__('Filter the required tickets', 'event_espresso'), |
|
| 125 | + ], |
|
| 126 | + 'isTaxable' => [ |
|
| 127 | + 'type' => 'Boolean', |
|
| 128 | + 'description' => esc_html__('Filter the taxable tickets', 'event_espresso'), |
|
| 129 | + ], |
|
| 130 | + 'isTrashed' => [ |
|
| 131 | + 'type' => 'Boolean', |
|
| 132 | + 'description' => esc_html__('Filter the trashed tickets', 'event_espresso'), |
|
| 133 | + ], |
|
| 134 | + ]; |
|
| 135 | 135 | |
| 136 | - $newArgs = apply_filters( |
|
| 137 | - 'FHEE__EventEspresso_core_domain_services_graphql_connections__ticket_args', |
|
| 138 | - $newArgs, |
|
| 139 | - $args |
|
| 140 | - ); |
|
| 141 | - return array_merge( |
|
| 142 | - $newArgs, |
|
| 143 | - $args |
|
| 144 | - ); |
|
| 145 | - } |
|
| 136 | + $newArgs = apply_filters( |
|
| 137 | + 'FHEE__EventEspresso_core_domain_services_graphql_connections__ticket_args', |
|
| 138 | + $newArgs, |
|
| 139 | + $args |
|
| 140 | + ); |
|
| 141 | + return array_merge( |
|
| 142 | + $newArgs, |
|
| 143 | + $args |
|
| 144 | + ); |
|
| 145 | + } |
|
| 146 | 146 | } |
@@ -37,8 +37,8 @@ |
||
| 37 | 37 | public function config(): array |
| 38 | 38 | { |
| 39 | 39 | return [ |
| 40 | - 'fromType' => $this->namespace . 'Datetime', |
|
| 41 | - 'toType' => $this->namespace . 'Ticket', |
|
| 40 | + 'fromType' => $this->namespace.'Datetime', |
|
| 41 | + 'toType' => $this->namespace.'Ticket', |
|
| 42 | 42 | 'fromFieldName' => 'tickets', |
| 43 | 43 | 'connectionTypeName' => "{$this->namespace}DatetimeTicketsConnection", |
| 44 | 44 | 'connectionArgs' => self::get_connection_args(), |
@@ -18,136 +18,136 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class TicketPricesConnection extends ConnectionBase |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * TicketConnection constructor. |
|
| 23 | - * |
|
| 24 | - * @param EEM_Price $model |
|
| 25 | - */ |
|
| 26 | - public function __construct(EEM_Price $model) |
|
| 27 | - { |
|
| 28 | - parent::__construct($model); |
|
| 29 | - } |
|
| 21 | + /** |
|
| 22 | + * TicketConnection constructor. |
|
| 23 | + * |
|
| 24 | + * @param EEM_Price $model |
|
| 25 | + */ |
|
| 26 | + public function __construct(EEM_Price $model) |
|
| 27 | + { |
|
| 28 | + parent::__construct($model); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @return array |
|
| 34 | - */ |
|
| 35 | - public function config(): array |
|
| 36 | - { |
|
| 37 | - return [ |
|
| 38 | - 'fromType' => $this->namespace . 'Ticket', |
|
| 39 | - 'toType' => $this->namespace . 'Price', |
|
| 40 | - 'fromFieldName' => 'prices', |
|
| 41 | - 'connectionTypeName' => "{$this->namespace}TicketPricesConnection", |
|
| 42 | - 'connectionArgs' => TicketPricesConnection::get_connection_args(), |
|
| 43 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 44 | - ]; |
|
| 45 | - } |
|
| 32 | + /** |
|
| 33 | + * @return array |
|
| 34 | + */ |
|
| 35 | + public function config(): array |
|
| 36 | + { |
|
| 37 | + return [ |
|
| 38 | + 'fromType' => $this->namespace . 'Ticket', |
|
| 39 | + 'toType' => $this->namespace . 'Price', |
|
| 40 | + 'fromFieldName' => 'prices', |
|
| 41 | + 'connectionTypeName' => "{$this->namespace}TicketPricesConnection", |
|
| 42 | + 'connectionArgs' => TicketPricesConnection::get_connection_args(), |
|
| 43 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 44 | + ]; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @param $entity |
|
| 50 | - * @param $args |
|
| 51 | - * @param $context |
|
| 52 | - * @param $info |
|
| 53 | - * @return array|Deferred|mixed |
|
| 54 | - * @throws Exception |
|
| 55 | - */ |
|
| 56 | - public function resolveConnection($entity, $args, $context, $info) |
|
| 57 | - { |
|
| 58 | - $resolver = new PriceConnectionResolver($entity, $args, $context, $info); |
|
| 59 | - return $resolver->get_connection(); |
|
| 60 | - } |
|
| 48 | + /** |
|
| 49 | + * @param $entity |
|
| 50 | + * @param $args |
|
| 51 | + * @param $context |
|
| 52 | + * @param $info |
|
| 53 | + * @return array|Deferred|mixed |
|
| 54 | + * @throws Exception |
|
| 55 | + */ |
|
| 56 | + public function resolveConnection($entity, $args, $context, $info) |
|
| 57 | + { |
|
| 58 | + $resolver = new PriceConnectionResolver($entity, $args, $context, $info); |
|
| 59 | + return $resolver->get_connection(); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Given an optional array of args, this returns the args to be used in the connection |
|
| 65 | - * |
|
| 66 | - * @param array $args The args to modify the defaults |
|
| 67 | - * @return array |
|
| 68 | - */ |
|
| 69 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 70 | - public static function get_connection_args(array $args = []): array |
|
| 71 | - { |
|
| 72 | - $newArgs = [ |
|
| 73 | - 'in' => [ |
|
| 74 | - 'type' => ['list_of' => 'ID'], |
|
| 75 | - 'description' => esc_html__('Limit prices to the given globally unique IDs', 'event_espresso'), |
|
| 76 | - ], |
|
| 77 | - 'idIn' => [ |
|
| 78 | - 'type' => ['list_of' => 'ID'], |
|
| 79 | - 'description' => esc_html__('Limit prices to the given IDs', 'event_espresso'), |
|
| 80 | - ], |
|
| 81 | - 'event' => [ |
|
| 82 | - 'type' => 'ID', |
|
| 83 | - 'description' => esc_html__('Globally unique event ID to get the prices for.', 'event_espresso'), |
|
| 84 | - ], |
|
| 85 | - 'eventId' => [ |
|
| 86 | - 'type' => 'Int', |
|
| 87 | - 'description' => esc_html__('Event ID to get the prices for.', 'event_espresso'), |
|
| 88 | - ], |
|
| 89 | - 'includeDefaultPrices' => [ |
|
| 90 | - 'type' => 'Boolean', |
|
| 91 | - 'description' => esc_html__('Whether to add default prices to the list.', 'event_espresso'), |
|
| 92 | - ], |
|
| 93 | - 'includeDefaultTicketsPrices' => [ |
|
| 94 | - 'type' => 'Boolean', |
|
| 95 | - 'description' => esc_html__('Whether to add default tickets prices to the list.', 'event_espresso'), |
|
| 96 | - ], |
|
| 97 | - 'isDefault' => [ |
|
| 98 | - 'type' => 'Boolean', |
|
| 99 | - 'description' => esc_html__('Filter the default prices', 'event_espresso'), |
|
| 100 | - ], |
|
| 101 | - 'ticket' => [ |
|
| 102 | - 'type' => 'ID', |
|
| 103 | - 'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'), |
|
| 104 | - ], |
|
| 105 | - 'ticketIn' => [ |
|
| 106 | - 'type' => ['list_of' => 'ID'], |
|
| 107 | - 'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'), |
|
| 108 | - ], |
|
| 109 | - 'ticketId' => [ |
|
| 110 | - 'type' => 'Int', |
|
| 111 | - 'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'), |
|
| 112 | - ], |
|
| 113 | - 'ticketIdIn' => [ |
|
| 114 | - 'type' => ['list_of' => 'Int'], |
|
| 115 | - 'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'), |
|
| 116 | - ], |
|
| 117 | - 'priceType' => [ |
|
| 118 | - 'type' => 'ID', |
|
| 119 | - 'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'), |
|
| 120 | - ], |
|
| 121 | - 'priceTypeIn' => [ |
|
| 122 | - 'type' => ['list_of' => 'ID'], |
|
| 123 | - 'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'), |
|
| 124 | - ], |
|
| 125 | - 'priceTypeId' => [ |
|
| 126 | - 'type' => 'Int', |
|
| 127 | - 'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'), |
|
| 128 | - ], |
|
| 129 | - 'priceTypeIdIn' => [ |
|
| 130 | - 'type' => ['list_of' => 'Int'], |
|
| 131 | - 'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'), |
|
| 132 | - ], |
|
| 133 | - 'priceBaseType' => [ |
|
| 134 | - 'type' => 'PriceBaseTypeEnum', |
|
| 135 | - 'description' => esc_html__('Price Base type.', 'event_espresso'), |
|
| 136 | - ], |
|
| 137 | - 'priceBaseTypeIn' => [ |
|
| 138 | - 'type' => ['list_of' => 'PriceBaseTypeEnum'], |
|
| 139 | - 'description' => esc_html__('Price Base types.', 'event_espresso'), |
|
| 140 | - ], |
|
| 141 | - ]; |
|
| 63 | + /** |
|
| 64 | + * Given an optional array of args, this returns the args to be used in the connection |
|
| 65 | + * |
|
| 66 | + * @param array $args The args to modify the defaults |
|
| 67 | + * @return array |
|
| 68 | + */ |
|
| 69 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 70 | + public static function get_connection_args(array $args = []): array |
|
| 71 | + { |
|
| 72 | + $newArgs = [ |
|
| 73 | + 'in' => [ |
|
| 74 | + 'type' => ['list_of' => 'ID'], |
|
| 75 | + 'description' => esc_html__('Limit prices to the given globally unique IDs', 'event_espresso'), |
|
| 76 | + ], |
|
| 77 | + 'idIn' => [ |
|
| 78 | + 'type' => ['list_of' => 'ID'], |
|
| 79 | + 'description' => esc_html__('Limit prices to the given IDs', 'event_espresso'), |
|
| 80 | + ], |
|
| 81 | + 'event' => [ |
|
| 82 | + 'type' => 'ID', |
|
| 83 | + 'description' => esc_html__('Globally unique event ID to get the prices for.', 'event_espresso'), |
|
| 84 | + ], |
|
| 85 | + 'eventId' => [ |
|
| 86 | + 'type' => 'Int', |
|
| 87 | + 'description' => esc_html__('Event ID to get the prices for.', 'event_espresso'), |
|
| 88 | + ], |
|
| 89 | + 'includeDefaultPrices' => [ |
|
| 90 | + 'type' => 'Boolean', |
|
| 91 | + 'description' => esc_html__('Whether to add default prices to the list.', 'event_espresso'), |
|
| 92 | + ], |
|
| 93 | + 'includeDefaultTicketsPrices' => [ |
|
| 94 | + 'type' => 'Boolean', |
|
| 95 | + 'description' => esc_html__('Whether to add default tickets prices to the list.', 'event_espresso'), |
|
| 96 | + ], |
|
| 97 | + 'isDefault' => [ |
|
| 98 | + 'type' => 'Boolean', |
|
| 99 | + 'description' => esc_html__('Filter the default prices', 'event_espresso'), |
|
| 100 | + ], |
|
| 101 | + 'ticket' => [ |
|
| 102 | + 'type' => 'ID', |
|
| 103 | + 'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'), |
|
| 104 | + ], |
|
| 105 | + 'ticketIn' => [ |
|
| 106 | + 'type' => ['list_of' => 'ID'], |
|
| 107 | + 'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'), |
|
| 108 | + ], |
|
| 109 | + 'ticketId' => [ |
|
| 110 | + 'type' => 'Int', |
|
| 111 | + 'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'), |
|
| 112 | + ], |
|
| 113 | + 'ticketIdIn' => [ |
|
| 114 | + 'type' => ['list_of' => 'Int'], |
|
| 115 | + 'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'), |
|
| 116 | + ], |
|
| 117 | + 'priceType' => [ |
|
| 118 | + 'type' => 'ID', |
|
| 119 | + 'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'), |
|
| 120 | + ], |
|
| 121 | + 'priceTypeIn' => [ |
|
| 122 | + 'type' => ['list_of' => 'ID'], |
|
| 123 | + 'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'), |
|
| 124 | + ], |
|
| 125 | + 'priceTypeId' => [ |
|
| 126 | + 'type' => 'Int', |
|
| 127 | + 'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'), |
|
| 128 | + ], |
|
| 129 | + 'priceTypeIdIn' => [ |
|
| 130 | + 'type' => ['list_of' => 'Int'], |
|
| 131 | + 'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'), |
|
| 132 | + ], |
|
| 133 | + 'priceBaseType' => [ |
|
| 134 | + 'type' => 'PriceBaseTypeEnum', |
|
| 135 | + 'description' => esc_html__('Price Base type.', 'event_espresso'), |
|
| 136 | + ], |
|
| 137 | + 'priceBaseTypeIn' => [ |
|
| 138 | + 'type' => ['list_of' => 'PriceBaseTypeEnum'], |
|
| 139 | + 'description' => esc_html__('Price Base types.', 'event_espresso'), |
|
| 140 | + ], |
|
| 141 | + ]; |
|
| 142 | 142 | |
| 143 | - $newArgs = apply_filters( |
|
| 144 | - 'FHEE__EventEspresso_core_domain_services_graphql_connections__price_args', |
|
| 145 | - $newArgs, |
|
| 146 | - $args |
|
| 147 | - ); |
|
| 148 | - return array_merge( |
|
| 149 | - $newArgs, |
|
| 150 | - $args |
|
| 151 | - ); |
|
| 152 | - } |
|
| 143 | + $newArgs = apply_filters( |
|
| 144 | + 'FHEE__EventEspresso_core_domain_services_graphql_connections__price_args', |
|
| 145 | + $newArgs, |
|
| 146 | + $args |
|
| 147 | + ); |
|
| 148 | + return array_merge( |
|
| 149 | + $newArgs, |
|
| 150 | + $args |
|
| 151 | + ); |
|
| 152 | + } |
|
| 153 | 153 | } |
@@ -35,8 +35,8 @@ |
||
| 35 | 35 | public function config(): array |
| 36 | 36 | { |
| 37 | 37 | return [ |
| 38 | - 'fromType' => $this->namespace . 'Ticket', |
|
| 39 | - 'toType' => $this->namespace . 'Price', |
|
| 38 | + 'fromType' => $this->namespace.'Ticket', |
|
| 39 | + 'toType' => $this->namespace.'Price', |
|
| 40 | 40 | 'fromFieldName' => 'prices', |
| 41 | 41 | 'connectionTypeName' => "{$this->namespace}TicketPricesConnection", |
| 42 | 42 | 'connectionArgs' => TicketPricesConnection::get_connection_args(), |
@@ -20,119 +20,119 @@ |
||
| 20 | 20 | { |
| 21 | 21 | |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * DatetimeConnection constructor. |
|
| 25 | - * |
|
| 26 | - * @param EEM_Datetime $model |
|
| 27 | - */ |
|
| 28 | - public function __construct(EEM_Datetime $model) |
|
| 29 | - { |
|
| 30 | - parent::__construct($model); |
|
| 31 | - } |
|
| 23 | + /** |
|
| 24 | + * DatetimeConnection constructor. |
|
| 25 | + * |
|
| 26 | + * @param EEM_Datetime $model |
|
| 27 | + */ |
|
| 28 | + public function __construct(EEM_Datetime $model) |
|
| 29 | + { |
|
| 30 | + parent::__construct($model); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @return array |
|
| 36 | - */ |
|
| 37 | - public function config(): array |
|
| 38 | - { |
|
| 39 | - return [ |
|
| 40 | - 'fromType' => $this->namespace . 'Event', |
|
| 41 | - 'toType' => $this->namespace . 'Datetime', |
|
| 42 | - 'fromFieldName' => 'datetimes', |
|
| 43 | - 'connectionTypeName' => "{$this->namespace}EventDatetimesConnection", |
|
| 44 | - 'connectionArgs' => self::get_connection_args(), |
|
| 45 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 46 | - ]; |
|
| 47 | - } |
|
| 34 | + /** |
|
| 35 | + * @return array |
|
| 36 | + */ |
|
| 37 | + public function config(): array |
|
| 38 | + { |
|
| 39 | + return [ |
|
| 40 | + 'fromType' => $this->namespace . 'Event', |
|
| 41 | + 'toType' => $this->namespace . 'Datetime', |
|
| 42 | + 'fromFieldName' => 'datetimes', |
|
| 43 | + 'connectionTypeName' => "{$this->namespace}EventDatetimesConnection", |
|
| 44 | + 'connectionArgs' => self::get_connection_args(), |
|
| 45 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 46 | + ]; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @param $entity |
|
| 52 | - * @param $args |
|
| 53 | - * @param $context |
|
| 54 | - * @param $info |
|
| 55 | - * @return array|Deferred|mixed |
|
| 56 | - * @throws Exception |
|
| 57 | - */ |
|
| 58 | - public function resolveConnection($entity, $args, $context, $info) |
|
| 59 | - { |
|
| 60 | - $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
| 61 | - return $resolver->get_connection(); |
|
| 62 | - } |
|
| 50 | + /** |
|
| 51 | + * @param $entity |
|
| 52 | + * @param $args |
|
| 53 | + * @param $context |
|
| 54 | + * @param $info |
|
| 55 | + * @return array|Deferred|mixed |
|
| 56 | + * @throws Exception |
|
| 57 | + */ |
|
| 58 | + public function resolveConnection($entity, $args, $context, $info) |
|
| 59 | + { |
|
| 60 | + $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
| 61 | + return $resolver->get_connection(); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Given an optional array of args, this returns the args to be used in the connection |
|
| 66 | - * |
|
| 67 | - * @param array $args The args to modify the defaults |
|
| 68 | - * @return array |
|
| 69 | - */ |
|
| 70 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 71 | - public static function get_connection_args(array $args = []): array |
|
| 72 | - { |
|
| 73 | - $newArgs = [ |
|
| 74 | - 'orderby' => [ |
|
| 75 | - 'type' => ['list_of' => 'EspressoDatetimesConnectionOrderbyInput'], |
|
| 76 | - 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 77 | - ], |
|
| 78 | - 'event' => [ |
|
| 79 | - 'type' => 'ID', |
|
| 80 | - 'description' => esc_html__('Globally unique event ID to get the datetimes for.', 'event_espresso'), |
|
| 81 | - ], |
|
| 82 | - 'eventIn' => [ |
|
| 83 | - 'type' => ['list_of' => 'ID'], |
|
| 84 | - 'description' => esc_html__('Globally unique event IDs to get the datetimes for.', 'event_espresso'), |
|
| 85 | - ], |
|
| 86 | - 'eventId' => [ |
|
| 87 | - 'type' => 'Int', |
|
| 88 | - 'description' => esc_html__('Event ID to get the datetimes for.', 'event_espresso'), |
|
| 89 | - ], |
|
| 90 | - 'eventIdIn' => [ |
|
| 91 | - 'type' => ['list_of' => 'Int'], |
|
| 92 | - 'description' => esc_html__('Event IDs to get the datetimes for.', 'event_espresso'), |
|
| 93 | - ], |
|
| 94 | - 'ticket' => [ |
|
| 95 | - 'type' => 'ID', |
|
| 96 | - 'description' => esc_html__('Globally unique ticket ID to get the datetimes for.', 'event_espresso'), |
|
| 97 | - ], |
|
| 98 | - 'ticketIn' => [ |
|
| 99 | - 'type' => ['list_of' => 'ID'], |
|
| 100 | - 'description' => esc_html__('Globally unique ticket IDs to get the datetimes for.', 'event_espresso'), |
|
| 101 | - ], |
|
| 102 | - 'ticketId' => [ |
|
| 103 | - 'type' => 'Int', |
|
| 104 | - 'description' => esc_html__('Ticket ID to get the datetimes for.', 'event_espresso'), |
|
| 105 | - ], |
|
| 106 | - 'ticketIdIn' => [ |
|
| 107 | - 'type' => ['list_of' => 'Int'], |
|
| 108 | - 'description' => esc_html__('Ticket IDs to get the datetimes for.', 'event_espresso'), |
|
| 109 | - ], |
|
| 110 | - 'upcoming' => [ |
|
| 111 | - 'type' => 'Boolean', |
|
| 112 | - 'description' => esc_html__('Datetimes which are upcoming.', 'event_espresso'), |
|
| 113 | - ], |
|
| 114 | - 'active' => [ |
|
| 115 | - 'type' => 'Boolean', |
|
| 116 | - 'description' => esc_html__('Datetimes which are active.', 'event_espresso'), |
|
| 117 | - ], |
|
| 118 | - 'expired' => [ |
|
| 119 | - 'type' => 'Boolean', |
|
| 120 | - 'description' => esc_html__('Datetimes which are expired.', 'event_espresso'), |
|
| 121 | - ], |
|
| 122 | - 'search' => [ |
|
| 123 | - 'type' => 'String', |
|
| 124 | - 'description' => esc_html__('The search keywords', 'event_espresso'), |
|
| 125 | - ], |
|
| 126 | - ]; |
|
| 64 | + /** |
|
| 65 | + * Given an optional array of args, this returns the args to be used in the connection |
|
| 66 | + * |
|
| 67 | + * @param array $args The args to modify the defaults |
|
| 68 | + * @return array |
|
| 69 | + */ |
|
| 70 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 71 | + public static function get_connection_args(array $args = []): array |
|
| 72 | + { |
|
| 73 | + $newArgs = [ |
|
| 74 | + 'orderby' => [ |
|
| 75 | + 'type' => ['list_of' => 'EspressoDatetimesConnectionOrderbyInput'], |
|
| 76 | + 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 77 | + ], |
|
| 78 | + 'event' => [ |
|
| 79 | + 'type' => 'ID', |
|
| 80 | + 'description' => esc_html__('Globally unique event ID to get the datetimes for.', 'event_espresso'), |
|
| 81 | + ], |
|
| 82 | + 'eventIn' => [ |
|
| 83 | + 'type' => ['list_of' => 'ID'], |
|
| 84 | + 'description' => esc_html__('Globally unique event IDs to get the datetimes for.', 'event_espresso'), |
|
| 85 | + ], |
|
| 86 | + 'eventId' => [ |
|
| 87 | + 'type' => 'Int', |
|
| 88 | + 'description' => esc_html__('Event ID to get the datetimes for.', 'event_espresso'), |
|
| 89 | + ], |
|
| 90 | + 'eventIdIn' => [ |
|
| 91 | + 'type' => ['list_of' => 'Int'], |
|
| 92 | + 'description' => esc_html__('Event IDs to get the datetimes for.', 'event_espresso'), |
|
| 93 | + ], |
|
| 94 | + 'ticket' => [ |
|
| 95 | + 'type' => 'ID', |
|
| 96 | + 'description' => esc_html__('Globally unique ticket ID to get the datetimes for.', 'event_espresso'), |
|
| 97 | + ], |
|
| 98 | + 'ticketIn' => [ |
|
| 99 | + 'type' => ['list_of' => 'ID'], |
|
| 100 | + 'description' => esc_html__('Globally unique ticket IDs to get the datetimes for.', 'event_espresso'), |
|
| 101 | + ], |
|
| 102 | + 'ticketId' => [ |
|
| 103 | + 'type' => 'Int', |
|
| 104 | + 'description' => esc_html__('Ticket ID to get the datetimes for.', 'event_espresso'), |
|
| 105 | + ], |
|
| 106 | + 'ticketIdIn' => [ |
|
| 107 | + 'type' => ['list_of' => 'Int'], |
|
| 108 | + 'description' => esc_html__('Ticket IDs to get the datetimes for.', 'event_espresso'), |
|
| 109 | + ], |
|
| 110 | + 'upcoming' => [ |
|
| 111 | + 'type' => 'Boolean', |
|
| 112 | + 'description' => esc_html__('Datetimes which are upcoming.', 'event_espresso'), |
|
| 113 | + ], |
|
| 114 | + 'active' => [ |
|
| 115 | + 'type' => 'Boolean', |
|
| 116 | + 'description' => esc_html__('Datetimes which are active.', 'event_espresso'), |
|
| 117 | + ], |
|
| 118 | + 'expired' => [ |
|
| 119 | + 'type' => 'Boolean', |
|
| 120 | + 'description' => esc_html__('Datetimes which are expired.', 'event_espresso'), |
|
| 121 | + ], |
|
| 122 | + 'search' => [ |
|
| 123 | + 'type' => 'String', |
|
| 124 | + 'description' => esc_html__('The search keywords', 'event_espresso'), |
|
| 125 | + ], |
|
| 126 | + ]; |
|
| 127 | 127 | |
| 128 | - $newArgs = apply_filters( |
|
| 129 | - 'FHEE__EventEspresso_core_domain_services_graphql_connections__datetime_args', |
|
| 130 | - $newArgs, |
|
| 131 | - $args |
|
| 132 | - ); |
|
| 133 | - return array_merge( |
|
| 134 | - $newArgs, |
|
| 135 | - $args |
|
| 136 | - ); |
|
| 137 | - } |
|
| 128 | + $newArgs = apply_filters( |
|
| 129 | + 'FHEE__EventEspresso_core_domain_services_graphql_connections__datetime_args', |
|
| 130 | + $newArgs, |
|
| 131 | + $args |
|
| 132 | + ); |
|
| 133 | + return array_merge( |
|
| 134 | + $newArgs, |
|
| 135 | + $args |
|
| 136 | + ); |
|
| 137 | + } |
|
| 138 | 138 | } |
@@ -37,8 +37,8 @@ |
||
| 37 | 37 | public function config(): array |
| 38 | 38 | { |
| 39 | 39 | return [ |
| 40 | - 'fromType' => $this->namespace . 'Event', |
|
| 41 | - 'toType' => $this->namespace . 'Datetime', |
|
| 40 | + 'fromType' => $this->namespace.'Event', |
|
| 41 | + 'toType' => $this->namespace.'Datetime', |
|
| 42 | 42 | 'fromFieldName' => 'datetimes', |
| 43 | 43 | 'connectionTypeName' => "{$this->namespace}EventDatetimesConnection", |
| 44 | 44 | 'connectionArgs' => self::get_connection_args(), |