@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * @param $args |
| 38 | 38 | * @param $context |
| 39 | 39 | * @param $info |
| 40 | - * @return array |
|
| 40 | + * @return \GraphQL\Deferred |
|
| 41 | 41 | * @throws Exception |
| 42 | 42 | * @since $VID:$ |
| 43 | 43 | */ |
@@ -2,8 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace EventEspresso\core\domain\services\graphql\abstracts; |
| 4 | 4 | |
| 5 | -use EE_Base_Class; |
|
| 6 | -use EEM_Base; |
|
| 7 | 5 | use EventEspresso\core\domain\services\graphql\connection_resolvers\AbstractConnectionResolver; |
| 8 | 6 | use EventEspresso\core\services\graphql\connections\ConnectionBase; |
| 9 | 7 | use Exception; |
@@ -20,30 +20,30 @@ |
||
| 20 | 20 | { |
| 21 | 21 | |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @param $entity |
|
| 25 | - * @param $args |
|
| 26 | - * @param $context |
|
| 27 | - * @param $info |
|
| 28 | - * @return AbstractConnectionResolver |
|
| 29 | - * @throws Exception |
|
| 30 | - * @since $VID:$ |
|
| 31 | - */ |
|
| 32 | - abstract public function getConnectionResolver($entity, $args, $context, $info); |
|
| 23 | + /** |
|
| 24 | + * @param $entity |
|
| 25 | + * @param $args |
|
| 26 | + * @param $context |
|
| 27 | + * @param $info |
|
| 28 | + * @return AbstractConnectionResolver |
|
| 29 | + * @throws Exception |
|
| 30 | + * @since $VID:$ |
|
| 31 | + */ |
|
| 32 | + abstract public function getConnectionResolver($entity, $args, $context, $info); |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @param $entity |
|
| 37 | - * @param $args |
|
| 38 | - * @param $context |
|
| 39 | - * @param $info |
|
| 40 | - * @return array |
|
| 41 | - * @throws Exception |
|
| 42 | - * @since $VID:$ |
|
| 43 | - */ |
|
| 44 | - public function resolveConnection($entity, $args, $context, $info) |
|
| 45 | - { |
|
| 46 | - $resolver = $this->getConnectionResolver($entity, $args, $context, $info); |
|
| 47 | - return $resolver->get_connection(); |
|
| 48 | - } |
|
| 35 | + /** |
|
| 36 | + * @param $entity |
|
| 37 | + * @param $args |
|
| 38 | + * @param $context |
|
| 39 | + * @param $info |
|
| 40 | + * @return array |
|
| 41 | + * @throws Exception |
|
| 42 | + * @since $VID:$ |
|
| 43 | + */ |
|
| 44 | + public function resolveConnection($entity, $args, $context, $info) |
|
| 45 | + { |
|
| 46 | + $resolver = $this->getConnectionResolver($entity, $args, $context, $info); |
|
| 47 | + return $resolver->get_connection(); |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | * |
| 91 | 91 | * @param array $where_args |
| 92 | 92 | * @param array $arg_mapping |
| 93 | - * @param array $id_fields The fields to convert from global IDs to DB IDs. |
|
| 93 | + * @param string[] $id_fields The fields to convert from global IDs to DB IDs. |
|
| 94 | 94 | * @return array |
| 95 | 95 | */ |
| 96 | 96 | protected function sanitizeWhereArgsForInputFields( |
@@ -17,144 +17,144 @@ |
||
| 17 | 17 | abstract class AbstractConnectionResolver extends WPGraphQLConnectionResolver |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Set limit the highest value of first and last, with a (filterable) max of 100 |
|
| 22 | - * |
|
| 23 | - * @return array |
|
| 24 | - */ |
|
| 25 | - protected function getLimit() |
|
| 26 | - { |
|
| 27 | - $first = ! empty($this->args['first']) ? absint($this->args['first']) : null; |
|
| 28 | - $last = ! empty($this->args['last']) ? absint($this->args['last']) : null; |
|
| 29 | - |
|
| 30 | - $limit = min( |
|
| 31 | - max($first, $last, 100), |
|
| 32 | - $this->query_amount |
|
| 33 | - ); |
|
| 34 | - $limit++; |
|
| 35 | - return $limit; |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * Determine whether or not the the offset is valid, i.e the entity corresponding to the |
|
| 40 | - * offset exists. Offset is equivalent to entity ID. So this function is equivalent to |
|
| 41 | - * checking if the entity with the given ID exists. |
|
| 42 | - * |
|
| 43 | - * @access public |
|
| 44 | - * |
|
| 45 | - * @param int $offset The ID of the node used for the cursor offset |
|
| 46 | - * |
|
| 47 | - * @return bool |
|
| 48 | - */ |
|
| 49 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 50 | - public function is_valid_offset($offset) |
|
| 51 | - { |
|
| 52 | - $entity = $this->get_query()->get_one_by_ID($offset); |
|
| 20 | + /** |
|
| 21 | + * Set limit the highest value of first and last, with a (filterable) max of 100 |
|
| 22 | + * |
|
| 23 | + * @return array |
|
| 24 | + */ |
|
| 25 | + protected function getLimit() |
|
| 26 | + { |
|
| 27 | + $first = ! empty($this->args['first']) ? absint($this->args['first']) : null; |
|
| 28 | + $last = ! empty($this->args['last']) ? absint($this->args['last']) : null; |
|
| 29 | + |
|
| 30 | + $limit = min( |
|
| 31 | + max($first, $last, 100), |
|
| 32 | + $this->query_amount |
|
| 33 | + ); |
|
| 34 | + $limit++; |
|
| 35 | + return $limit; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * Determine whether or not the the offset is valid, i.e the entity corresponding to the |
|
| 40 | + * offset exists. Offset is equivalent to entity ID. So this function is equivalent to |
|
| 41 | + * checking if the entity with the given ID exists. |
|
| 42 | + * |
|
| 43 | + * @access public |
|
| 44 | + * |
|
| 45 | + * @param int $offset The ID of the node used for the cursor offset |
|
| 46 | + * |
|
| 47 | + * @return bool |
|
| 48 | + */ |
|
| 49 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 50 | + public function is_valid_offset($offset) |
|
| 51 | + { |
|
| 52 | + $entity = $this->get_query()->get_one_by_ID($offset); |
|
| 53 | 53 | |
| 54 | - return $entity instanceof EE_Base_Class; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * Validates Model. |
|
| 59 | - * |
|
| 60 | - * @param array $entity Entity node. |
|
| 61 | - * |
|
| 62 | - * @return bool |
|
| 63 | - */ |
|
| 64 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 65 | - protected function is_valid_model($entity) |
|
| 66 | - { |
|
| 67 | - return $entity instanceof EE_Base_Class; |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
| 73 | - * friendly keys. |
|
| 74 | - * |
|
| 75 | - * @param array $query_args |
|
| 76 | - * @param array $where_params |
|
| 77 | - * @param string $primary_key |
|
| 78 | - * @return array |
|
| 79 | - */ |
|
| 80 | - protected function mapOrderbyInputArgs(array $query_args, array $where_params, $primary_key) |
|
| 81 | - { |
|
| 82 | - // ID of the current offset |
|
| 83 | - $offset = $this->get_offset(); |
|
| 84 | - /** |
|
| 85 | - * Map the orderby inputArgs to the WP_Query |
|
| 86 | - */ |
|
| 87 | - if (! empty($this->args['where']['orderby']) && is_array($this->args['where']['orderby'])) { |
|
| 88 | - $query_args['order_by'] = []; |
|
| 89 | - foreach ($this->args['where']['orderby'] as $orderby_input) { |
|
| 90 | - $query_args['order_by'][ $orderby_input['field'] ] = $orderby_input['order']; |
|
| 91 | - } |
|
| 92 | - } elseif ($offset) { |
|
| 93 | - $compare = $this->args['last'] ? '<' : '>'; |
|
| 94 | - $where_params[ $primary_key ] = [ $compare, $offset ]; |
|
| 95 | - } |
|
| 96 | - return [ $query_args, $where_params ]; |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
| 102 | - * friendly keys. |
|
| 103 | - * |
|
| 104 | - * @param array $where_args |
|
| 105 | - * @param array $arg_mapping |
|
| 106 | - * @param array $id_fields The fields to convert from global IDs to DB IDs. |
|
| 107 | - * @return array |
|
| 108 | - */ |
|
| 109 | - protected function sanitizeWhereArgsForInputFields( |
|
| 110 | - array $where_args, |
|
| 111 | - array $arg_mapping, |
|
| 112 | - array $id_fields |
|
| 113 | - ) { |
|
| 114 | - $query_args = []; |
|
| 115 | - |
|
| 116 | - foreach ($where_args as $arg => $value) { |
|
| 117 | - if (! array_key_exists($arg, $arg_mapping)) { |
|
| 118 | - continue; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - if (is_array($value) && ! empty($value)) { |
|
| 122 | - $value = array_map( |
|
| 123 | - static function ($value) { |
|
| 124 | - if (is_string($value)) { |
|
| 125 | - $value = sanitize_text_field($value); |
|
| 126 | - } |
|
| 127 | - return $value; |
|
| 128 | - }, |
|
| 129 | - $value |
|
| 130 | - ); |
|
| 131 | - } elseif (is_string($value)) { |
|
| 132 | - $value = sanitize_text_field($value); |
|
| 133 | - } |
|
| 134 | - $query_args[ $arg_mapping[ $arg ] ] = in_array($arg, $id_fields, true) |
|
| 135 | - ? $this->convertGlobalId($value) |
|
| 136 | - : $value; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * Return the Query Args |
|
| 141 | - */ |
|
| 142 | - return ! empty($query_args) && is_array($query_args) ? $query_args : []; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * Converts global ID to DB ID. |
|
| 148 | - * |
|
| 149 | - * @param string|string[] $ID |
|
| 150 | - * @return mixed |
|
| 151 | - */ |
|
| 152 | - protected function convertGlobalId($ID) |
|
| 153 | - { |
|
| 154 | - if (is_array($ID)) { |
|
| 155 | - return array_map([ $this, 'convertGlobalId' ], $ID); |
|
| 156 | - } |
|
| 157 | - $parts = Relay::fromGlobalId($ID); |
|
| 158 | - return ! empty($parts['id']) ? $parts['id'] : null; |
|
| 159 | - } |
|
| 54 | + return $entity instanceof EE_Base_Class; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * Validates Model. |
|
| 59 | + * |
|
| 60 | + * @param array $entity Entity node. |
|
| 61 | + * |
|
| 62 | + * @return bool |
|
| 63 | + */ |
|
| 64 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 65 | + protected function is_valid_model($entity) |
|
| 66 | + { |
|
| 67 | + return $entity instanceof EE_Base_Class; |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
| 73 | + * friendly keys. |
|
| 74 | + * |
|
| 75 | + * @param array $query_args |
|
| 76 | + * @param array $where_params |
|
| 77 | + * @param string $primary_key |
|
| 78 | + * @return array |
|
| 79 | + */ |
|
| 80 | + protected function mapOrderbyInputArgs(array $query_args, array $where_params, $primary_key) |
|
| 81 | + { |
|
| 82 | + // ID of the current offset |
|
| 83 | + $offset = $this->get_offset(); |
|
| 84 | + /** |
|
| 85 | + * Map the orderby inputArgs to the WP_Query |
|
| 86 | + */ |
|
| 87 | + if (! empty($this->args['where']['orderby']) && is_array($this->args['where']['orderby'])) { |
|
| 88 | + $query_args['order_by'] = []; |
|
| 89 | + foreach ($this->args['where']['orderby'] as $orderby_input) { |
|
| 90 | + $query_args['order_by'][ $orderby_input['field'] ] = $orderby_input['order']; |
|
| 91 | + } |
|
| 92 | + } elseif ($offset) { |
|
| 93 | + $compare = $this->args['last'] ? '<' : '>'; |
|
| 94 | + $where_params[ $primary_key ] = [ $compare, $offset ]; |
|
| 95 | + } |
|
| 96 | + return [ $query_args, $where_params ]; |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
| 102 | + * friendly keys. |
|
| 103 | + * |
|
| 104 | + * @param array $where_args |
|
| 105 | + * @param array $arg_mapping |
|
| 106 | + * @param array $id_fields The fields to convert from global IDs to DB IDs. |
|
| 107 | + * @return array |
|
| 108 | + */ |
|
| 109 | + protected function sanitizeWhereArgsForInputFields( |
|
| 110 | + array $where_args, |
|
| 111 | + array $arg_mapping, |
|
| 112 | + array $id_fields |
|
| 113 | + ) { |
|
| 114 | + $query_args = []; |
|
| 115 | + |
|
| 116 | + foreach ($where_args as $arg => $value) { |
|
| 117 | + if (! array_key_exists($arg, $arg_mapping)) { |
|
| 118 | + continue; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + if (is_array($value) && ! empty($value)) { |
|
| 122 | + $value = array_map( |
|
| 123 | + static function ($value) { |
|
| 124 | + if (is_string($value)) { |
|
| 125 | + $value = sanitize_text_field($value); |
|
| 126 | + } |
|
| 127 | + return $value; |
|
| 128 | + }, |
|
| 129 | + $value |
|
| 130 | + ); |
|
| 131 | + } elseif (is_string($value)) { |
|
| 132 | + $value = sanitize_text_field($value); |
|
| 133 | + } |
|
| 134 | + $query_args[ $arg_mapping[ $arg ] ] = in_array($arg, $id_fields, true) |
|
| 135 | + ? $this->convertGlobalId($value) |
|
| 136 | + : $value; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * Return the Query Args |
|
| 141 | + */ |
|
| 142 | + return ! empty($query_args) && is_array($query_args) ? $query_args : []; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * Converts global ID to DB ID. |
|
| 148 | + * |
|
| 149 | + * @param string|string[] $ID |
|
| 150 | + * @return mixed |
|
| 151 | + */ |
|
| 152 | + protected function convertGlobalId($ID) |
|
| 153 | + { |
|
| 154 | + if (is_array($ID)) { |
|
| 155 | + return array_map([ $this, 'convertGlobalId' ], $ID); |
|
| 156 | + } |
|
| 157 | + $parts = Relay::fromGlobalId($ID); |
|
| 158 | + return ! empty($parts['id']) ? $parts['id'] : null; |
|
| 159 | + } |
|
| 160 | 160 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * @param $args |
| 38 | 38 | * @param $context |
| 39 | 39 | * @param $info |
| 40 | - * @return array |
|
| 40 | + * @return \GraphQL\Deferred |
|
| 41 | 41 | * @throws Exception |
| 42 | 42 | * @since $VID:$ |
| 43 | 43 | */ |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace EventEspresso\core\domain\services\graphql\connections; |
| 4 | 4 | |
| 5 | -use EE_Base_Class; |
|
| 6 | 5 | use EEM_Ticket; |
| 7 | 6 | use EventEspresso\core\domain\services\graphql\connection_resolvers\TicketConnectionResolver; |
| 8 | 7 | use EventEspresso\core\services\graphql\connections\ConnectionBase; |
@@ -20,84 +20,84 @@ |
||
| 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 | - $this->model = $model; |
|
| 31 | - } |
|
| 23 | + /** |
|
| 24 | + * DatetimeConnection constructor. |
|
| 25 | + * |
|
| 26 | + * @param EEM_Ticket $model |
|
| 27 | + */ |
|
| 28 | + public function __construct(EEM_Ticket $model) |
|
| 29 | + { |
|
| 30 | + $this->model = $model; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @return array |
|
| 36 | - * @since $VID:$ |
|
| 37 | - */ |
|
| 38 | - public function config() |
|
| 39 | - { |
|
| 40 | - return [ |
|
| 41 | - 'fromType' => $this->namespace . 'Datetime', |
|
| 42 | - 'toType' => $this->namespace . 'Ticket', |
|
| 43 | - 'fromFieldName' => 'tickets', |
|
| 44 | - 'connectionTypeName' => "{$this->namespace}DatetimeTicketsConnection", |
|
| 45 | - 'connectionArgs' => self::get_connection_args(), |
|
| 46 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 47 | - ]; |
|
| 48 | - } |
|
| 34 | + /** |
|
| 35 | + * @return array |
|
| 36 | + * @since $VID:$ |
|
| 37 | + */ |
|
| 38 | + public function config() |
|
| 39 | + { |
|
| 40 | + return [ |
|
| 41 | + 'fromType' => $this->namespace . 'Datetime', |
|
| 42 | + 'toType' => $this->namespace . 'Ticket', |
|
| 43 | + 'fromFieldName' => 'tickets', |
|
| 44 | + 'connectionTypeName' => "{$this->namespace}DatetimeTicketsConnection", |
|
| 45 | + 'connectionArgs' => self::get_connection_args(), |
|
| 46 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 47 | + ]; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @param $entity |
|
| 53 | - * @param $args |
|
| 54 | - * @param $context |
|
| 55 | - * @param $info |
|
| 56 | - * @return array |
|
| 57 | - * @throws Exception |
|
| 58 | - * @since $VID:$ |
|
| 59 | - */ |
|
| 60 | - public function resolveConnection($entity, $args, $context, $info) |
|
| 61 | - { |
|
| 62 | - $resolver = new TicketConnectionResolver($entity, $args, $context, $info); |
|
| 63 | - return $resolver->get_connection(); |
|
| 64 | - } |
|
| 51 | + /** |
|
| 52 | + * @param $entity |
|
| 53 | + * @param $args |
|
| 54 | + * @param $context |
|
| 55 | + * @param $info |
|
| 56 | + * @return array |
|
| 57 | + * @throws Exception |
|
| 58 | + * @since $VID:$ |
|
| 59 | + */ |
|
| 60 | + public function resolveConnection($entity, $args, $context, $info) |
|
| 61 | + { |
|
| 62 | + $resolver = new TicketConnectionResolver($entity, $args, $context, $info); |
|
| 63 | + return $resolver->get_connection(); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Given an optional array of args, this returns the args to be used in the connection |
|
| 68 | - * |
|
| 69 | - * @access public |
|
| 70 | - * @param array $args The args to modify the defaults |
|
| 71 | - * |
|
| 72 | - * @return array |
|
| 73 | - */ |
|
| 74 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 75 | - public static function get_connection_args($args = []) |
|
| 76 | - { |
|
| 77 | - return array_merge( |
|
| 78 | - [ |
|
| 79 | - 'orderby' => [ |
|
| 80 | - 'type' => ['list_of' => 'TicketsConnectionOrderbyInput'], |
|
| 81 | - 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 82 | - ], |
|
| 83 | - 'datetime' => [ |
|
| 84 | - 'type' => 'ID', |
|
| 85 | - 'description' => esc_html__('Globally unique datetime ID to get the tickets for.', 'event_espresso'), |
|
| 86 | - ], |
|
| 87 | - 'datetimeIn' => [ |
|
| 88 | - 'type' => ['list_of' => 'ID'], |
|
| 89 | - 'description' => esc_html__('Globally unique datetime IDs to get the tickets for.', 'event_espresso'), |
|
| 90 | - ], |
|
| 91 | - 'datetimeId' => [ |
|
| 92 | - 'type' => 'Int', |
|
| 93 | - 'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'), |
|
| 94 | - ], |
|
| 95 | - 'datetimeIdIn' => [ |
|
| 96 | - 'type' => ['list_of' => 'Int'], |
|
| 97 | - 'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'), |
|
| 98 | - ], |
|
| 99 | - ], |
|
| 100 | - $args |
|
| 101 | - ); |
|
| 102 | - } |
|
| 66 | + /** |
|
| 67 | + * Given an optional array of args, this returns the args to be used in the connection |
|
| 68 | + * |
|
| 69 | + * @access public |
|
| 70 | + * @param array $args The args to modify the defaults |
|
| 71 | + * |
|
| 72 | + * @return array |
|
| 73 | + */ |
|
| 74 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 75 | + public static function get_connection_args($args = []) |
|
| 76 | + { |
|
| 77 | + return array_merge( |
|
| 78 | + [ |
|
| 79 | + 'orderby' => [ |
|
| 80 | + 'type' => ['list_of' => 'TicketsConnectionOrderbyInput'], |
|
| 81 | + 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 82 | + ], |
|
| 83 | + 'datetime' => [ |
|
| 84 | + 'type' => 'ID', |
|
| 85 | + 'description' => esc_html__('Globally unique datetime ID to get the tickets for.', 'event_espresso'), |
|
| 86 | + ], |
|
| 87 | + 'datetimeIn' => [ |
|
| 88 | + 'type' => ['list_of' => 'ID'], |
|
| 89 | + 'description' => esc_html__('Globally unique datetime IDs to get the tickets for.', 'event_espresso'), |
|
| 90 | + ], |
|
| 91 | + 'datetimeId' => [ |
|
| 92 | + 'type' => 'Int', |
|
| 93 | + 'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'), |
|
| 94 | + ], |
|
| 95 | + 'datetimeIdIn' => [ |
|
| 96 | + 'type' => ['list_of' => 'Int'], |
|
| 97 | + 'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'), |
|
| 98 | + ], |
|
| 99 | + ], |
|
| 100 | + $args |
|
| 101 | + ); |
|
| 102 | + } |
|
| 103 | 103 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * @param $args |
| 38 | 38 | * @param $context |
| 39 | 39 | * @param $info |
| 40 | - * @return array |
|
| 40 | + * @return \GraphQL\Deferred |
|
| 41 | 41 | * @throws Exception |
| 42 | 42 | * @since $VID:$ |
| 43 | 43 | */ |
@@ -2,12 +2,10 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace EventEspresso\core\domain\services\graphql\connections; |
| 4 | 4 | |
| 5 | -use EE_Base_Class; |
|
| 6 | 5 | use EEM_Datetime; |
| 7 | 6 | use EventEspresso\core\domain\services\graphql\connection_resolvers\DatetimeConnectionResolver; |
| 8 | 7 | use EventEspresso\core\services\graphql\connections\ConnectionBase; |
| 9 | 8 | use Exception; |
| 10 | -use WPGraphQL\Type\WPObjectType; |
|
| 11 | 9 | |
| 12 | 10 | /** |
| 13 | 11 | * Class EventDatetimesConnection |
@@ -21,112 +21,112 @@ |
||
| 21 | 21 | { |
| 22 | 22 | |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * DatetimeConnection constructor. |
|
| 26 | - * |
|
| 27 | - * @param EEM_Datetime $model |
|
| 28 | - */ |
|
| 29 | - public function __construct(EEM_Datetime $model) |
|
| 30 | - { |
|
| 31 | - $this->model = $model; |
|
| 32 | - } |
|
| 24 | + /** |
|
| 25 | + * DatetimeConnection constructor. |
|
| 26 | + * |
|
| 27 | + * @param EEM_Datetime $model |
|
| 28 | + */ |
|
| 29 | + public function __construct(EEM_Datetime $model) |
|
| 30 | + { |
|
| 31 | + $this->model = $model; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @return array |
|
| 37 | - * @since $VID:$ |
|
| 38 | - */ |
|
| 39 | - public function config() |
|
| 40 | - { |
|
| 41 | - return [ |
|
| 42 | - 'fromType' => $this->namespace . 'Event', |
|
| 43 | - 'toType' => $this->namespace . 'Datetime', |
|
| 44 | - 'fromFieldName' => 'datetimes', |
|
| 45 | - 'connectionTypeName' => "{$this->namespace}EventDatetimesConnection", |
|
| 46 | - 'connectionArgs' => self::get_connection_args(), |
|
| 47 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 48 | - ]; |
|
| 49 | - } |
|
| 35 | + /** |
|
| 36 | + * @return array |
|
| 37 | + * @since $VID:$ |
|
| 38 | + */ |
|
| 39 | + public function config() |
|
| 40 | + { |
|
| 41 | + return [ |
|
| 42 | + 'fromType' => $this->namespace . 'Event', |
|
| 43 | + 'toType' => $this->namespace . 'Datetime', |
|
| 44 | + 'fromFieldName' => 'datetimes', |
|
| 45 | + 'connectionTypeName' => "{$this->namespace}EventDatetimesConnection", |
|
| 46 | + 'connectionArgs' => self::get_connection_args(), |
|
| 47 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 48 | + ]; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @param $entity |
|
| 54 | - * @param $args |
|
| 55 | - * @param $context |
|
| 56 | - * @param $info |
|
| 57 | - * @return array |
|
| 58 | - * @throws Exception |
|
| 59 | - * @since $VID:$ |
|
| 60 | - */ |
|
| 61 | - public function resolveConnection($entity, $args, $context, $info) |
|
| 62 | - { |
|
| 63 | - $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
| 64 | - return $resolver->get_connection(); |
|
| 65 | - } |
|
| 52 | + /** |
|
| 53 | + * @param $entity |
|
| 54 | + * @param $args |
|
| 55 | + * @param $context |
|
| 56 | + * @param $info |
|
| 57 | + * @return array |
|
| 58 | + * @throws Exception |
|
| 59 | + * @since $VID:$ |
|
| 60 | + */ |
|
| 61 | + public function resolveConnection($entity, $args, $context, $info) |
|
| 62 | + { |
|
| 63 | + $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
| 64 | + return $resolver->get_connection(); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Given an optional array of args, this returns the args to be used in the connection |
|
| 69 | - * |
|
| 70 | - * @access public |
|
| 71 | - * @param array $args The args to modify the defaults |
|
| 72 | - * |
|
| 73 | - * @return array |
|
| 74 | - */ |
|
| 75 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 76 | - public static function get_connection_args($args = []) |
|
| 77 | - { |
|
| 78 | - return array_merge( |
|
| 79 | - [ |
|
| 80 | - 'orderby' => [ |
|
| 81 | - 'type' => ['list_of' => 'DatetimesConnectionOrderbyInput'], |
|
| 82 | - 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 83 | - ], |
|
| 84 | - 'event' => [ |
|
| 85 | - 'type' => 'ID', |
|
| 86 | - 'description' => esc_html__('Globally unique event ID to get the datetimes for.', 'event_espresso'), |
|
| 87 | - ], |
|
| 88 | - 'eventIn' => [ |
|
| 89 | - 'type' => ['list_of' => 'ID'], |
|
| 90 | - 'description' => esc_html__('Globally unique event IDs to get the datetimes for.', 'event_espresso'), |
|
| 91 | - ], |
|
| 92 | - 'eventId' => [ |
|
| 93 | - 'type' => 'Int', |
|
| 94 | - 'description' => esc_html__('Event ID to get the datetimes for.', 'event_espresso'), |
|
| 95 | - ], |
|
| 96 | - 'eventIdIn' => [ |
|
| 97 | - 'type' => ['list_of' => 'Int'], |
|
| 98 | - 'description' => esc_html__('Event IDs to get the datetimes for.', 'event_espresso'), |
|
| 99 | - ], |
|
| 100 | - 'ticket' => [ |
|
| 101 | - 'type' => 'ID', |
|
| 102 | - 'description' => esc_html__('Globally unique ticket ID to get the datetimes for.', 'event_espresso'), |
|
| 103 | - ], |
|
| 104 | - 'ticketIn' => [ |
|
| 105 | - 'type' => ['list_of' => 'ID'], |
|
| 106 | - 'description' => esc_html__('Globally unique ticket IDs to get the datetimes for.', 'event_espresso'), |
|
| 107 | - ], |
|
| 108 | - 'ticketId' => [ |
|
| 109 | - 'type' => 'Int', |
|
| 110 | - 'description' => esc_html__('Ticket ID to get the datetimes for.', 'event_espresso'), |
|
| 111 | - ], |
|
| 112 | - 'ticketIdIn' => [ |
|
| 113 | - 'type' => ['list_of' => 'Int'], |
|
| 114 | - 'description' => esc_html__('Ticket IDs to get the datetimes for.', 'event_espresso'), |
|
| 115 | - ], |
|
| 116 | - 'upcoming' => [ |
|
| 117 | - 'type' => 'Boolean', |
|
| 118 | - 'description' => esc_html__('Datetimes which are upcoming.', 'event_espresso'), |
|
| 119 | - ], |
|
| 120 | - 'active' => [ |
|
| 121 | - 'type' => 'Boolean', |
|
| 122 | - 'description' => esc_html__('Datetimes which are active.', 'event_espresso'), |
|
| 123 | - ], |
|
| 124 | - 'expired' => [ |
|
| 125 | - 'type' => 'Boolean', |
|
| 126 | - 'description' => esc_html__('Datetimes which are expired.', 'event_espresso'), |
|
| 127 | - ], |
|
| 128 | - ], |
|
| 129 | - $args |
|
| 130 | - ); |
|
| 131 | - } |
|
| 67 | + /** |
|
| 68 | + * Given an optional array of args, this returns the args to be used in the connection |
|
| 69 | + * |
|
| 70 | + * @access public |
|
| 71 | + * @param array $args The args to modify the defaults |
|
| 72 | + * |
|
| 73 | + * @return array |
|
| 74 | + */ |
|
| 75 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 76 | + public static function get_connection_args($args = []) |
|
| 77 | + { |
|
| 78 | + return array_merge( |
|
| 79 | + [ |
|
| 80 | + 'orderby' => [ |
|
| 81 | + 'type' => ['list_of' => 'DatetimesConnectionOrderbyInput'], |
|
| 82 | + 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 83 | + ], |
|
| 84 | + 'event' => [ |
|
| 85 | + 'type' => 'ID', |
|
| 86 | + 'description' => esc_html__('Globally unique event ID to get the datetimes for.', 'event_espresso'), |
|
| 87 | + ], |
|
| 88 | + 'eventIn' => [ |
|
| 89 | + 'type' => ['list_of' => 'ID'], |
|
| 90 | + 'description' => esc_html__('Globally unique event IDs to get the datetimes for.', 'event_espresso'), |
|
| 91 | + ], |
|
| 92 | + 'eventId' => [ |
|
| 93 | + 'type' => 'Int', |
|
| 94 | + 'description' => esc_html__('Event ID to get the datetimes for.', 'event_espresso'), |
|
| 95 | + ], |
|
| 96 | + 'eventIdIn' => [ |
|
| 97 | + 'type' => ['list_of' => 'Int'], |
|
| 98 | + 'description' => esc_html__('Event IDs to get the datetimes for.', 'event_espresso'), |
|
| 99 | + ], |
|
| 100 | + 'ticket' => [ |
|
| 101 | + 'type' => 'ID', |
|
| 102 | + 'description' => esc_html__('Globally unique ticket ID to get the datetimes for.', 'event_espresso'), |
|
| 103 | + ], |
|
| 104 | + 'ticketIn' => [ |
|
| 105 | + 'type' => ['list_of' => 'ID'], |
|
| 106 | + 'description' => esc_html__('Globally unique ticket IDs to get the datetimes for.', 'event_espresso'), |
|
| 107 | + ], |
|
| 108 | + 'ticketId' => [ |
|
| 109 | + 'type' => 'Int', |
|
| 110 | + 'description' => esc_html__('Ticket ID to get the datetimes for.', 'event_espresso'), |
|
| 111 | + ], |
|
| 112 | + 'ticketIdIn' => [ |
|
| 113 | + 'type' => ['list_of' => 'Int'], |
|
| 114 | + 'description' => esc_html__('Ticket IDs to get the datetimes for.', 'event_espresso'), |
|
| 115 | + ], |
|
| 116 | + 'upcoming' => [ |
|
| 117 | + 'type' => 'Boolean', |
|
| 118 | + 'description' => esc_html__('Datetimes which are upcoming.', 'event_espresso'), |
|
| 119 | + ], |
|
| 120 | + 'active' => [ |
|
| 121 | + 'type' => 'Boolean', |
|
| 122 | + 'description' => esc_html__('Datetimes which are active.', 'event_espresso'), |
|
| 123 | + ], |
|
| 124 | + 'expired' => [ |
|
| 125 | + 'type' => 'Boolean', |
|
| 126 | + 'description' => esc_html__('Datetimes which are expired.', 'event_espresso'), |
|
| 127 | + ], |
|
| 128 | + ], |
|
| 129 | + $args |
|
| 130 | + ); |
|
| 131 | + } |
|
| 132 | 132 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * @param $args |
| 38 | 38 | * @param $context |
| 39 | 39 | * @param $info |
| 40 | - * @return array |
|
| 40 | + * @return \GraphQL\Deferred |
|
| 41 | 41 | * @throws Exception |
| 42 | 42 | * @since $VID:$ |
| 43 | 43 | */ |
@@ -2,12 +2,10 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace EventEspresso\core\domain\services\graphql\connections; |
| 4 | 4 | |
| 5 | -use EE_Base_Class; |
|
| 6 | 5 | use EEM_Venue; |
| 7 | 6 | use EventEspresso\core\domain\services\graphql\connection_resolvers\VenueConnectionResolver; |
| 8 | 7 | use EventEspresso\core\services\graphql\connections\ConnectionBase; |
| 9 | 8 | use Exception; |
| 10 | -use WPGraphQL\Data\DataSource; |
|
| 11 | 9 | |
| 12 | 10 | /** |
| 13 | 11 | * Class EventVenuesConnection |
@@ -21,45 +21,45 @@ |
||
| 21 | 21 | { |
| 22 | 22 | |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * DatetimeConnection constructor. |
|
| 26 | - * |
|
| 27 | - * @param EEM_Venue $model |
|
| 28 | - */ |
|
| 29 | - public function __construct(EEM_Venue $model) |
|
| 30 | - { |
|
| 31 | - $this->model = $model; |
|
| 32 | - } |
|
| 24 | + /** |
|
| 25 | + * DatetimeConnection constructor. |
|
| 26 | + * |
|
| 27 | + * @param EEM_Venue $model |
|
| 28 | + */ |
|
| 29 | + public function __construct(EEM_Venue $model) |
|
| 30 | + { |
|
| 31 | + $this->model = $model; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @return array |
|
| 37 | - * @since $VID:$ |
|
| 38 | - */ |
|
| 39 | - public function config() |
|
| 40 | - { |
|
| 41 | - return [ |
|
| 42 | - 'fromType' => $this->namespace . 'Event', |
|
| 43 | - 'toType' => $this->namespace . 'Venue', |
|
| 44 | - 'fromFieldName' => 'venues', |
|
| 45 | - 'connectionTypeName' => "{$this->namespace}EventVenuesConnection", |
|
| 46 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 47 | - ]; |
|
| 48 | - } |
|
| 35 | + /** |
|
| 36 | + * @return array |
|
| 37 | + * @since $VID:$ |
|
| 38 | + */ |
|
| 39 | + public function config() |
|
| 40 | + { |
|
| 41 | + return [ |
|
| 42 | + 'fromType' => $this->namespace . 'Event', |
|
| 43 | + 'toType' => $this->namespace . 'Venue', |
|
| 44 | + 'fromFieldName' => 'venues', |
|
| 45 | + 'connectionTypeName' => "{$this->namespace}EventVenuesConnection", |
|
| 46 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 47 | + ]; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @param $entity |
|
| 53 | - * @param $args |
|
| 54 | - * @param $context |
|
| 55 | - * @param $info |
|
| 56 | - * @return array |
|
| 57 | - * @throws Exception |
|
| 58 | - * @since $VID:$ |
|
| 59 | - */ |
|
| 60 | - public function resolveConnection($entity, $args, $context, $info) |
|
| 61 | - { |
|
| 62 | - $resolver = new VenueConnectionResolver($entity, $args, $context, $info); |
|
| 63 | - return $resolver->get_connection(); |
|
| 64 | - } |
|
| 51 | + /** |
|
| 52 | + * @param $entity |
|
| 53 | + * @param $args |
|
| 54 | + * @param $context |
|
| 55 | + * @param $info |
|
| 56 | + * @return array |
|
| 57 | + * @throws Exception |
|
| 58 | + * @since $VID:$ |
|
| 59 | + */ |
|
| 60 | + public function resolveConnection($entity, $args, $context, $info) |
|
| 61 | + { |
|
| 62 | + $resolver = new VenueConnectionResolver($entity, $args, $context, $info); |
|
| 63 | + return $resolver->get_connection(); |
|
| 64 | + } |
|
| 65 | 65 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * @param $args |
| 38 | 38 | * @param $context |
| 39 | 39 | * @param $info |
| 40 | - * @return array |
|
| 40 | + * @return \GraphQL\Deferred |
|
| 41 | 41 | * @throws Exception |
| 42 | 42 | * @since $VID:$ |
| 43 | 43 | */ |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace EventEspresso\core\domain\services\graphql\connections; |
| 4 | 4 | |
| 5 | -use EE_Base_Class; |
|
| 6 | 5 | use EEM_Datetime; |
| 7 | 6 | use EventEspresso\core\domain\services\graphql\connection_resolvers\DatetimeConnectionResolver; |
| 8 | 7 | use EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection; |
@@ -21,46 +21,46 @@ |
||
| 21 | 21 | { |
| 22 | 22 | |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * DatetimeConnection constructor. |
|
| 26 | - * |
|
| 27 | - * @param EEM_Datetime $model |
|
| 28 | - */ |
|
| 29 | - public function __construct(EEM_Datetime $model) |
|
| 30 | - { |
|
| 31 | - $this->model = $model; |
|
| 32 | - } |
|
| 24 | + /** |
|
| 25 | + * DatetimeConnection constructor. |
|
| 26 | + * |
|
| 27 | + * @param EEM_Datetime $model |
|
| 28 | + */ |
|
| 29 | + public function __construct(EEM_Datetime $model) |
|
| 30 | + { |
|
| 31 | + $this->model = $model; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @return array |
|
| 37 | - * @since $VID:$ |
|
| 38 | - */ |
|
| 39 | - public function config() |
|
| 40 | - { |
|
| 41 | - return [ |
|
| 42 | - 'fromType' => $this->namespace . 'Ticket', |
|
| 43 | - 'toType' => $this->namespace . 'Datetime', |
|
| 44 | - 'fromFieldName' => 'datetimes', |
|
| 45 | - 'connectionTypeName' => "{$this->namespace}TicketDatetimesConnection", |
|
| 46 | - 'connectionArgs' => EventDatetimesConnection::get_connection_args(), |
|
| 47 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 48 | - ]; |
|
| 49 | - } |
|
| 35 | + /** |
|
| 36 | + * @return array |
|
| 37 | + * @since $VID:$ |
|
| 38 | + */ |
|
| 39 | + public function config() |
|
| 40 | + { |
|
| 41 | + return [ |
|
| 42 | + 'fromType' => $this->namespace . 'Ticket', |
|
| 43 | + 'toType' => $this->namespace . 'Datetime', |
|
| 44 | + 'fromFieldName' => 'datetimes', |
|
| 45 | + 'connectionTypeName' => "{$this->namespace}TicketDatetimesConnection", |
|
| 46 | + 'connectionArgs' => EventDatetimesConnection::get_connection_args(), |
|
| 47 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 48 | + ]; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @param $entity |
|
| 54 | - * @param $args |
|
| 55 | - * @param $context |
|
| 56 | - * @param $info |
|
| 57 | - * @return array |
|
| 58 | - * @throws Exception |
|
| 59 | - * @since $VID:$ |
|
| 60 | - */ |
|
| 61 | - public function resolveConnection($entity, $args, $context, $info) |
|
| 62 | - { |
|
| 63 | - $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
| 64 | - return $resolver->get_connection(); |
|
| 65 | - } |
|
| 52 | + /** |
|
| 53 | + * @param $entity |
|
| 54 | + * @param $args |
|
| 55 | + * @param $context |
|
| 56 | + * @param $info |
|
| 57 | + * @return array |
|
| 58 | + * @throws Exception |
|
| 59 | + * @since $VID:$ |
|
| 60 | + */ |
|
| 61 | + public function resolveConnection($entity, $args, $context, $info) |
|
| 62 | + { |
|
| 63 | + $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
| 64 | + return $resolver->get_connection(); |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * @param $args |
| 38 | 38 | * @param $context |
| 39 | 39 | * @param $info |
| 40 | - * @return array |
|
| 40 | + * @return \GraphQL\Deferred |
|
| 41 | 41 | * @throws Exception |
| 42 | 42 | * @since $VID:$ |
| 43 | 43 | */ |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace EventEspresso\core\domain\services\graphql\connections; |
| 4 | 4 | |
| 5 | -use EE_Base_Class; |
|
| 6 | 5 | use EEM_Price; |
| 7 | 6 | use EventEspresso\core\domain\services\graphql\connection_resolvers\PriceConnectionResolver; |
| 8 | 7 | use EventEspresso\core\services\graphql\connections\ConnectionBase; |
@@ -20,104 +20,104 @@ |
||
| 20 | 20 | { |
| 21 | 21 | |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * TicketConnection constructor. |
|
| 25 | - * |
|
| 26 | - * @param EEM_Price $model |
|
| 27 | - */ |
|
| 28 | - public function __construct(EEM_Price $model) |
|
| 29 | - { |
|
| 30 | - $this->model = $model; |
|
| 31 | - } |
|
| 23 | + /** |
|
| 24 | + * TicketConnection constructor. |
|
| 25 | + * |
|
| 26 | + * @param EEM_Price $model |
|
| 27 | + */ |
|
| 28 | + public function __construct(EEM_Price $model) |
|
| 29 | + { |
|
| 30 | + $this->model = $model; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @return array |
|
| 36 | - * @since $VID:$ |
|
| 37 | - */ |
|
| 38 | - public function config() |
|
| 39 | - { |
|
| 40 | - return [ |
|
| 41 | - 'fromType' => $this->namespace . 'Ticket', |
|
| 42 | - 'toType' => $this->namespace . 'Price', |
|
| 43 | - 'fromFieldName' => 'prices', |
|
| 44 | - 'connectionTypeName' => "{$this->namespace}TicketPricesConnection", |
|
| 45 | - 'connectionArgs' => self::get_connection_args(), |
|
| 46 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 47 | - ]; |
|
| 48 | - } |
|
| 34 | + /** |
|
| 35 | + * @return array |
|
| 36 | + * @since $VID:$ |
|
| 37 | + */ |
|
| 38 | + public function config() |
|
| 39 | + { |
|
| 40 | + return [ |
|
| 41 | + 'fromType' => $this->namespace . 'Ticket', |
|
| 42 | + 'toType' => $this->namespace . 'Price', |
|
| 43 | + 'fromFieldName' => 'prices', |
|
| 44 | + 'connectionTypeName' => "{$this->namespace}TicketPricesConnection", |
|
| 45 | + 'connectionArgs' => self::get_connection_args(), |
|
| 46 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 47 | + ]; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @param $entity |
|
| 53 | - * @param $args |
|
| 54 | - * @param $context |
|
| 55 | - * @param $info |
|
| 56 | - * @return array |
|
| 57 | - * @throws Exception |
|
| 58 | - * @since $VID:$ |
|
| 59 | - */ |
|
| 60 | - public function resolveConnection($entity, $args, $context, $info) |
|
| 61 | - { |
|
| 62 | - $resolver = new PriceConnectionResolver($entity, $args, $context, $info); |
|
| 63 | - return $resolver->get_connection(); |
|
| 64 | - } |
|
| 51 | + /** |
|
| 52 | + * @param $entity |
|
| 53 | + * @param $args |
|
| 54 | + * @param $context |
|
| 55 | + * @param $info |
|
| 56 | + * @return array |
|
| 57 | + * @throws Exception |
|
| 58 | + * @since $VID:$ |
|
| 59 | + */ |
|
| 60 | + public function resolveConnection($entity, $args, $context, $info) |
|
| 61 | + { |
|
| 62 | + $resolver = new PriceConnectionResolver($entity, $args, $context, $info); |
|
| 63 | + return $resolver->get_connection(); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Given an optional array of args, this returns the args to be used in the connection |
|
| 68 | - * |
|
| 69 | - * @access public |
|
| 70 | - * @param array $args The args to modify the defaults |
|
| 71 | - * |
|
| 72 | - * @return array |
|
| 73 | - */ |
|
| 74 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 75 | - public static function get_connection_args($args = []) |
|
| 76 | - { |
|
| 77 | - return array_merge( |
|
| 78 | - [ |
|
| 79 | - 'ticket' => [ |
|
| 80 | - 'type' => 'ID', |
|
| 81 | - 'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'), |
|
| 82 | - ], |
|
| 83 | - 'ticketIn' => [ |
|
| 84 | - 'type' => ['list_of' => 'ID'], |
|
| 85 | - 'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'), |
|
| 86 | - ], |
|
| 87 | - 'ticketId' => [ |
|
| 88 | - 'type' => 'Int', |
|
| 89 | - 'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'), |
|
| 90 | - ], |
|
| 91 | - 'ticketIdIn' => [ |
|
| 92 | - 'type' => ['list_of' => 'Int'], |
|
| 93 | - 'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'), |
|
| 94 | - ], |
|
| 95 | - 'priceType' => [ |
|
| 96 | - 'type' => 'ID', |
|
| 97 | - 'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'), |
|
| 98 | - ], |
|
| 99 | - 'priceTypeIn' => [ |
|
| 100 | - 'type' => ['list_of' => 'ID'], |
|
| 101 | - 'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'), |
|
| 102 | - ], |
|
| 103 | - 'priceTypeId' => [ |
|
| 104 | - 'type' => 'Int', |
|
| 105 | - 'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'), |
|
| 106 | - ], |
|
| 107 | - 'priceTypeIdIn' => [ |
|
| 108 | - 'type' => ['list_of' => 'Int'], |
|
| 109 | - 'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'), |
|
| 110 | - ], |
|
| 111 | - 'priceBaseType' => [ |
|
| 112 | - 'type' => 'PriceBaseTypeEnum', |
|
| 113 | - 'description' => esc_html__('Price Base type.', 'event_espresso'), |
|
| 114 | - ], |
|
| 115 | - 'priceBaseTypeIn' => [ |
|
| 116 | - 'type' => ['list_of' => 'PriceBaseTypeEnum'], |
|
| 117 | - 'description' => esc_html__('Price Base types.', 'event_espresso'), |
|
| 118 | - ], |
|
| 119 | - ], |
|
| 120 | - $args |
|
| 121 | - ); |
|
| 122 | - } |
|
| 66 | + /** |
|
| 67 | + * Given an optional array of args, this returns the args to be used in the connection |
|
| 68 | + * |
|
| 69 | + * @access public |
|
| 70 | + * @param array $args The args to modify the defaults |
|
| 71 | + * |
|
| 72 | + * @return array |
|
| 73 | + */ |
|
| 74 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 75 | + public static function get_connection_args($args = []) |
|
| 76 | + { |
|
| 77 | + return array_merge( |
|
| 78 | + [ |
|
| 79 | + 'ticket' => [ |
|
| 80 | + 'type' => 'ID', |
|
| 81 | + 'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'), |
|
| 82 | + ], |
|
| 83 | + 'ticketIn' => [ |
|
| 84 | + 'type' => ['list_of' => 'ID'], |
|
| 85 | + 'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'), |
|
| 86 | + ], |
|
| 87 | + 'ticketId' => [ |
|
| 88 | + 'type' => 'Int', |
|
| 89 | + 'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'), |
|
| 90 | + ], |
|
| 91 | + 'ticketIdIn' => [ |
|
| 92 | + 'type' => ['list_of' => 'Int'], |
|
| 93 | + 'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'), |
|
| 94 | + ], |
|
| 95 | + 'priceType' => [ |
|
| 96 | + 'type' => 'ID', |
|
| 97 | + 'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'), |
|
| 98 | + ], |
|
| 99 | + 'priceTypeIn' => [ |
|
| 100 | + 'type' => ['list_of' => 'ID'], |
|
| 101 | + 'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'), |
|
| 102 | + ], |
|
| 103 | + 'priceTypeId' => [ |
|
| 104 | + 'type' => 'Int', |
|
| 105 | + 'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'), |
|
| 106 | + ], |
|
| 107 | + 'priceTypeIdIn' => [ |
|
| 108 | + 'type' => ['list_of' => 'Int'], |
|
| 109 | + 'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'), |
|
| 110 | + ], |
|
| 111 | + 'priceBaseType' => [ |
|
| 112 | + 'type' => 'PriceBaseTypeEnum', |
|
| 113 | + 'description' => esc_html__('Price Base type.', 'event_espresso'), |
|
| 114 | + ], |
|
| 115 | + 'priceBaseTypeIn' => [ |
|
| 116 | + 'type' => ['list_of' => 'PriceBaseTypeEnum'], |
|
| 117 | + 'description' => esc_html__('Price Base types.', 'event_espresso'), |
|
| 118 | + ], |
|
| 119 | + ], |
|
| 120 | + $args |
|
| 121 | + ); |
|
| 122 | + } |
|
| 123 | 123 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | class DatetimeLoader extends AbstractLoader |
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | - * @return EE_Base_Class |
|
| 16 | + * @return EEM_Datetime |
|
| 17 | 17 | * @throws EE_Error |
| 18 | 18 | * @throws InvalidArgumentException |
| 19 | 19 | * @throws InvalidDataTypeException |
@@ -12,32 +12,32 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class DatetimeLoader extends AbstractLoader |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * @return EE_Base_Class |
|
| 17 | - * @throws EE_Error |
|
| 18 | - * @throws InvalidArgumentException |
|
| 19 | - * @throws InvalidDataTypeException |
|
| 20 | - * @throws InvalidInterfaceException |
|
| 21 | - */ |
|
| 22 | - protected function getQuery() |
|
| 23 | - { |
|
| 24 | - return EEM_Datetime::instance(); |
|
| 25 | - } |
|
| 15 | + /** |
|
| 16 | + * @return EE_Base_Class |
|
| 17 | + * @throws EE_Error |
|
| 18 | + * @throws InvalidArgumentException |
|
| 19 | + * @throws InvalidDataTypeException |
|
| 20 | + * @throws InvalidInterfaceException |
|
| 21 | + */ |
|
| 22 | + protected function getQuery() |
|
| 23 | + { |
|
| 24 | + return EEM_Datetime::instance(); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @param array $keys |
|
| 29 | - * |
|
| 30 | - * @return array |
|
| 31 | - * @throws EE_Error |
|
| 32 | - * @throws InvalidArgumentException |
|
| 33 | - * @throws InvalidDataTypeException |
|
| 34 | - * @throws InvalidInterfaceException |
|
| 35 | - */ |
|
| 36 | - protected function getWhereParams(array $keys) |
|
| 37 | - { |
|
| 38 | - return [ |
|
| 39 | - 'DTT_ID' => ['IN', $keys], |
|
| 40 | - 'DTT_deleted' => ['IN', [true, false]] |
|
| 41 | - ]; |
|
| 42 | - } |
|
| 27 | + /** |
|
| 28 | + * @param array $keys |
|
| 29 | + * |
|
| 30 | + * @return array |
|
| 31 | + * @throws EE_Error |
|
| 32 | + * @throws InvalidArgumentException |
|
| 33 | + * @throws InvalidDataTypeException |
|
| 34 | + * @throws InvalidInterfaceException |
|
| 35 | + */ |
|
| 36 | + protected function getWhereParams(array $keys) |
|
| 37 | + { |
|
| 38 | + return [ |
|
| 39 | + 'DTT_ID' => ['IN', $keys], |
|
| 40 | + 'DTT_deleted' => ['IN', [true, false]] |
|
| 41 | + ]; |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | class PriceLoader extends AbstractLoader |
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | - * @return EE_Base_Class |
|
| 16 | + * @return EEM_Price |
|
| 17 | 17 | * @throws EE_Error |
| 18 | 18 | * @throws InvalidArgumentException |
| 19 | 19 | * @throws InvalidDataTypeException |
@@ -12,31 +12,31 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class PriceLoader extends AbstractLoader |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * @return EE_Base_Class |
|
| 17 | - * @throws EE_Error |
|
| 18 | - * @throws InvalidArgumentException |
|
| 19 | - * @throws InvalidDataTypeException |
|
| 20 | - * @throws InvalidInterfaceException |
|
| 21 | - */ |
|
| 22 | - protected function getQuery() |
|
| 23 | - { |
|
| 24 | - return EEM_Price::instance(); |
|
| 25 | - } |
|
| 15 | + /** |
|
| 16 | + * @return EE_Base_Class |
|
| 17 | + * @throws EE_Error |
|
| 18 | + * @throws InvalidArgumentException |
|
| 19 | + * @throws InvalidDataTypeException |
|
| 20 | + * @throws InvalidInterfaceException |
|
| 21 | + */ |
|
| 22 | + protected function getQuery() |
|
| 23 | + { |
|
| 24 | + return EEM_Price::instance(); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @param array $keys |
|
| 29 | - * |
|
| 30 | - * @return array |
|
| 31 | - * @throws EE_Error |
|
| 32 | - * @throws InvalidArgumentException |
|
| 33 | - * @throws InvalidDataTypeException |
|
| 34 | - * @throws InvalidInterfaceException |
|
| 35 | - */ |
|
| 36 | - protected function getWhereParams(array $keys) |
|
| 37 | - { |
|
| 38 | - return [ |
|
| 39 | - 'PRC_ID' => ['IN', $keys], |
|
| 40 | - ]; |
|
| 41 | - } |
|
| 27 | + /** |
|
| 28 | + * @param array $keys |
|
| 29 | + * |
|
| 30 | + * @return array |
|
| 31 | + * @throws EE_Error |
|
| 32 | + * @throws InvalidArgumentException |
|
| 33 | + * @throws InvalidDataTypeException |
|
| 34 | + * @throws InvalidInterfaceException |
|
| 35 | + */ |
|
| 36 | + protected function getWhereParams(array $keys) |
|
| 37 | + { |
|
| 38 | + return [ |
|
| 39 | + 'PRC_ID' => ['IN', $keys], |
|
| 40 | + ]; |
|
| 41 | + } |
|
| 42 | 42 | } |