| @@ 18-139 (lines=122) @@ | ||
| 15 | * @author Manzoor Ahmad Wani |
|
| 16 | * @since $VID:$ |
|
| 17 | */ |
|
| 18 | class RootQueryAttendeesConnection extends AbstractRootQueryConnection |
|
| 19 | { |
|
| 20 | ||
| 21 | ||
| 22 | /** |
|
| 23 | * AttendeeConnection constructor. |
|
| 24 | * |
|
| 25 | * @param EEM_Attendee $model |
|
| 26 | */ |
|
| 27 | public function __construct(EEM_Attendee $model) |
|
| 28 | { |
|
| 29 | $this->model = $model; |
|
| 30 | } |
|
| 31 | ||
| 32 | ||
| 33 | /** |
|
| 34 | * @return array |
|
| 35 | * @since $VID:$ |
|
| 36 | */ |
|
| 37 | public function config() |
|
| 38 | { |
|
| 39 | return [ |
|
| 40 | 'fromType' => 'RootQuery', |
|
| 41 | 'toType' => $this->namespace . 'Attendee', |
|
| 42 | 'fromFieldName' => lcfirst($this->namespace) . 'Attendees', |
|
| 43 | 'connectionTypeName' => "{$this->namespace}RootQueryAttendeesConnection", |
|
| 44 | 'connectionArgs' => self::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 AttendeeConnectionResolver |
|
| 56 | * @throws Exception |
|
| 57 | * @since $VID:$ |
|
| 58 | */ |
|
| 59 | public function getConnectionResolver($entity, $args, $context, $info) |
|
| 60 | { |
|
| 61 | return new AttendeeConnectionResolver($entity, $args, $context, $info); |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * Given an optional array of args, this returns the args to be used in the connection |
|
| 66 | * |
|
| 67 | * @access public |
|
| 68 | * @param array $args The args to modify the defaults |
|
| 69 | * |
|
| 70 | * @return array |
|
| 71 | */ |
|
| 72 | // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 73 | public static function get_connection_args($args = []) |
|
| 74 | { |
|
| 75 | return array_merge( |
|
| 76 | [ |
|
| 77 | 'datetime' => [ |
|
| 78 | 'type' => 'ID', |
|
| 79 | 'description' => esc_html__( |
|
| 80 | 'Globally unique datetime ID to get the attendees for.', |
|
| 81 | 'event_espresso' |
|
| 82 | ), |
|
| 83 | ], |
|
| 84 | 'datetimeIn' => [ |
|
| 85 | 'type' => ['list_of' => 'ID'], |
|
| 86 | 'description' => esc_html__( |
|
| 87 | 'Globally unique datetime IDs to get the attendees for.', |
|
| 88 | 'event_espresso' |
|
| 89 | ), |
|
| 90 | ], |
|
| 91 | 'event' => [ |
|
| 92 | 'type' => 'ID', |
|
| 93 | 'description' => esc_html__( |
|
| 94 | 'Globally unique event ID to get the attendees for.', |
|
| 95 | 'event_espresso' |
|
| 96 | ), |
|
| 97 | ], |
|
| 98 | 'eventIn' => [ |
|
| 99 | 'type' => ['list_of' => 'ID'], |
|
| 100 | 'description' => esc_html__( |
|
| 101 | 'Globally unique event IDs to get the attendees for.', |
|
| 102 | 'event_espresso' |
|
| 103 | ), |
|
| 104 | ], |
|
| 105 | 'orderby' => [ |
|
| 106 | 'type' => ['list_of' => 'EspressoAttendeesConnectionOrderbyInput'], |
|
| 107 | 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 108 | ], |
|
| 109 | 'regTicket' => [ |
|
| 110 | 'type' => 'ID', |
|
| 111 | 'description' => esc_html__( |
|
| 112 | 'Globally unique registration ticket ID to get the attendees for.', |
|
| 113 | 'event_espresso' |
|
| 114 | ), |
|
| 115 | ], |
|
| 116 | 'regTicketIn' => [ |
|
| 117 | 'type' => ['list_of' => 'ID'], |
|
| 118 | 'description' => esc_html__( |
|
| 119 | 'Globally unique registration ticket IDs to get the attendees for.', |
|
| 120 | 'event_espresso' |
|
| 121 | ), |
|
| 122 | ], |
|
| 123 | 'regTicketId' => [ |
|
| 124 | 'type' => 'Int', |
|
| 125 | 'description' => esc_html__('Registration ticket ID to get the attendees for.', 'event_espresso'), |
|
| 126 | ], |
|
| 127 | 'regTicketIdIn' => [ |
|
| 128 | 'type' => ['list_of' => 'Int'], |
|
| 129 | 'description' => esc_html__('Registration ticket IDs to get the attendees for.', 'event_espresso'), |
|
| 130 | ], |
|
| 131 | 'regStatus' => [ |
|
| 132 | 'type' => 'EspressoRegistrationStatusEnum', |
|
| 133 | 'description' => esc_html__('Limit attendees to registration status.', 'event_espresso'), |
|
| 134 | ], |
|
| 135 | ], |
|
| 136 | $args |
|
| 137 | ); |
|
| 138 | } |
|
| 139 | } |
|
| 140 | ||
| @@ 19-123 (lines=105) @@ | ||
| 16 | * @author Manzoor Wani |
|
| 17 | * @since $VID:$ |
|
| 18 | */ |
|
| 19 | class TicketPricesConnection extends ConnectionBase |
|
| 20 | { |
|
| 21 | ||
| 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 | } |
|
| 32 | ||
| 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 | } |
|
| 49 | ||
| 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 | } |
|
| 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 | } |
|
| 123 | } |
|
| 124 | ||