@@ -214,7 +214,7 @@ |
||
| 214 | 214 | |
| 215 | 215 | /** |
| 216 | 216 | * @param EE_Datetime $datetime |
| 217 | - * @param mixed $field |
|
| 217 | + * @param string $field |
|
| 218 | 218 | * @return string |
| 219 | 219 | * @since $VID:$ |
| 220 | 220 | */ |
@@ -20,7 +20,6 @@ |
||
| 20 | 20 | |
| 21 | 21 | namespace EventEspresso\core\domain\services\graphql\types; |
| 22 | 22 | |
| 23 | -use EE_Base_Class; |
|
| 24 | 23 | use EE_Datetime; |
| 25 | 24 | use EE_Error; |
| 26 | 25 | use EE_Event; |
@@ -45,203 +45,203 @@ |
||
| 45 | 45 | class Datetime extends TypeBase |
| 46 | 46 | { |
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * EventDate constructor. |
|
| 50 | - * |
|
| 51 | - * @param EEM_Datetime $datetime_model |
|
| 52 | - */ |
|
| 53 | - public function __construct(EEM_Datetime $datetime_model) |
|
| 54 | - { |
|
| 55 | - $this->model = $datetime_model; |
|
| 56 | - $this->setName('Datetime'); |
|
| 57 | - $this->setDescription(__('An event date', 'event_espresso')); |
|
| 58 | - $this->setIsCustomPostType(false); |
|
| 59 | - $this->setFields([ |
|
| 60 | - 'id' => [ |
|
| 61 | - 'type' => [ |
|
| 62 | - 'non_null' => 'Int', |
|
| 63 | - ], |
|
| 64 | - 'description' => __('The datetime ID.', 'event_espresso'), |
|
| 65 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 66 | - return $this->resolveField($datetime, 'ID'); |
|
| 67 | - }, |
|
| 68 | - ], |
|
| 69 | - 'name' => [ |
|
| 70 | - 'type' => 'String', |
|
| 71 | - 'description' => __('Datetime Name', 'event_espresso'), |
|
| 72 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 73 | - return $this->resolveField($datetime, 'name'); |
|
| 74 | - }, |
|
| 75 | - ], |
|
| 76 | - 'description' => [ |
|
| 77 | - 'type' => 'String', |
|
| 78 | - 'description' => __('Description for Datetime', 'event_espresso'), |
|
| 79 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 80 | - return $this->resolveField($datetime, 'description'); |
|
| 81 | - }, |
|
| 82 | - ], |
|
| 83 | - 'start' => [ |
|
| 84 | - 'type' => 'String', |
|
| 85 | - 'description' => __('Start timestamp of Event', 'event_espresso'), |
|
| 86 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 87 | - return $this->resolveField($datetime, 'start'); |
|
| 88 | - }, |
|
| 89 | - ], |
|
| 90 | - 'startDate' => [ |
|
| 91 | - 'type' => 'String', |
|
| 92 | - 'description' => __('Start time/date of Event', 'event_espresso'), |
|
| 93 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 94 | - return $this->resolveField($datetime, 'start_date'); |
|
| 95 | - }, |
|
| 96 | - ], |
|
| 97 | - 'end' => [ |
|
| 98 | - 'type' => 'String', |
|
| 99 | - 'description' => __('End timestamp of Event', 'event_espresso'), |
|
| 100 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 101 | - return $this->resolveField($datetime, 'end'); |
|
| 102 | - }, |
|
| 103 | - ], |
|
| 104 | - 'endDate' => [ |
|
| 105 | - 'type' => 'String', |
|
| 106 | - 'description' => __('End time/date of Event', 'event_espresso'), |
|
| 107 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 108 | - return $this->resolveField($datetime, 'end_date'); |
|
| 109 | - }, |
|
| 110 | - ], |
|
| 111 | - 'startTime' => [ |
|
| 112 | - 'type' => 'String', |
|
| 113 | - 'description' => __('Start time of Event', 'event_espresso'), |
|
| 114 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 115 | - return $this->resolveField($datetime, 'start_time'); |
|
| 116 | - }, |
|
| 117 | - ], |
|
| 118 | - 'endTime' => [ |
|
| 119 | - 'type' => 'String', |
|
| 120 | - 'description' => __('End time of Event', 'event_espresso'), |
|
| 121 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 122 | - return $this->resolveField($datetime, 'end_time'); |
|
| 123 | - }, |
|
| 124 | - ], |
|
| 125 | - 'capacity' => [ |
|
| 126 | - 'type' => 'Int', |
|
| 127 | - 'description' => __('Registration Limit for this time', 'event_espresso'), |
|
| 128 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 129 | - $capacity = $datetime instanceof EE_Datetime ? $datetime->reg_limit() : EE_INF; |
|
| 130 | - return $this->parseInfiniteValue($capacity); |
|
| 131 | - }, |
|
| 132 | - ], |
|
| 133 | - 'sold' => [ |
|
| 134 | - 'type' => 'Int', |
|
| 135 | - 'description' => __('How many sales for this Datetime that have occurred', 'event_espresso'), |
|
| 136 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 137 | - return $this->resolveField($datetime, 'sold'); |
|
| 138 | - }, |
|
| 139 | - ], |
|
| 140 | - 'reserved' => [ |
|
| 141 | - 'type' => 'Int', |
|
| 142 | - 'description' => __('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso'), |
|
| 143 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 144 | - return $this->resolveField($datetime, 'reserved'); |
|
| 145 | - }, |
|
| 146 | - ], |
|
| 147 | - 'order' => [ |
|
| 148 | - 'type' => 'Int', |
|
| 149 | - 'description' => __('The order in which the Datetime is displayed', 'event_espresso'), |
|
| 150 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 151 | - return $this->resolveField($datetime, 'order'); |
|
| 152 | - }, |
|
| 153 | - ], |
|
| 154 | - 'length' => [ |
|
| 155 | - 'type' => 'Int', |
|
| 156 | - 'description' => __('The length of the event (start to end time) in seconds', 'event_espresso'), |
|
| 157 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 158 | - return $this->resolveField($datetime, 'length'); |
|
| 159 | - }, |
|
| 160 | - ], |
|
| 161 | - 'parent' => [ |
|
| 162 | - 'type' => 'Datetime', |
|
| 163 | - 'description' => __('The parent datetime of the current datetime', 'event_espresso'), |
|
| 164 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 165 | - return $this->resolveParent($datetime); |
|
| 166 | - }, |
|
| 167 | - ], |
|
| 168 | - 'isPrimary' => [ |
|
| 169 | - 'type' => 'Boolean', |
|
| 170 | - 'description' => __('Flag indicating datetime is primary one for event', 'event_espresso'), |
|
| 171 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 172 | - return $this->resolveField($datetime, 'is_primary'); |
|
| 173 | - }, |
|
| 174 | - ], |
|
| 175 | - 'isSoldOut' => [ |
|
| 176 | - 'type' => 'Boolean', |
|
| 177 | - 'description' => __('Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit', |
|
| 178 | - 'event_espresso'), |
|
| 179 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 180 | - return $this->resolveField($datetime, 'sold_out'); |
|
| 181 | - }, |
|
| 182 | - ], |
|
| 183 | - 'isUpcoming' => [ |
|
| 184 | - 'type' => 'Boolean', |
|
| 185 | - 'description' => __('Whether the date is upcoming', 'event_espresso'), |
|
| 186 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 187 | - return $this->resolveField($datetime, 'is_upcoming'); |
|
| 188 | - }, |
|
| 189 | - ], |
|
| 190 | - 'isActive' => [ |
|
| 191 | - 'type' => 'Boolean', |
|
| 192 | - 'description' => __('Flag indicating datetime is active', 'event_espresso'), |
|
| 193 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 194 | - return $this->resolveField($datetime, 'is_active'); |
|
| 195 | - }, |
|
| 196 | - ], |
|
| 197 | - 'isExpired' => [ |
|
| 198 | - 'type' => 'Boolean', |
|
| 199 | - 'description' => __('Flag indicating datetime is expired or not', 'event_espresso'), |
|
| 200 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 201 | - return $this->resolveField($datetime, 'is_expired'); |
|
| 202 | - }, |
|
| 203 | - ], |
|
| 204 | - 'event' => [ |
|
| 205 | - 'type' => 'Event', |
|
| 206 | - 'description' => __('Event of the datetime.', 'event_espresso'), |
|
| 207 | - 'resolve' => function (EE_Datetime $datetime, $args, $context) { |
|
| 208 | - return $this->resolveEvent($datetime, $args, $context); |
|
| 209 | - }, |
|
| 210 | - ], |
|
| 211 | - ]); |
|
| 212 | - } |
|
| 48 | + /** |
|
| 49 | + * EventDate constructor. |
|
| 50 | + * |
|
| 51 | + * @param EEM_Datetime $datetime_model |
|
| 52 | + */ |
|
| 53 | + public function __construct(EEM_Datetime $datetime_model) |
|
| 54 | + { |
|
| 55 | + $this->model = $datetime_model; |
|
| 56 | + $this->setName('Datetime'); |
|
| 57 | + $this->setDescription(__('An event date', 'event_espresso')); |
|
| 58 | + $this->setIsCustomPostType(false); |
|
| 59 | + $this->setFields([ |
|
| 60 | + 'id' => [ |
|
| 61 | + 'type' => [ |
|
| 62 | + 'non_null' => 'Int', |
|
| 63 | + ], |
|
| 64 | + 'description' => __('The datetime ID.', 'event_espresso'), |
|
| 65 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 66 | + return $this->resolveField($datetime, 'ID'); |
|
| 67 | + }, |
|
| 68 | + ], |
|
| 69 | + 'name' => [ |
|
| 70 | + 'type' => 'String', |
|
| 71 | + 'description' => __('Datetime Name', 'event_espresso'), |
|
| 72 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 73 | + return $this->resolveField($datetime, 'name'); |
|
| 74 | + }, |
|
| 75 | + ], |
|
| 76 | + 'description' => [ |
|
| 77 | + 'type' => 'String', |
|
| 78 | + 'description' => __('Description for Datetime', 'event_espresso'), |
|
| 79 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 80 | + return $this->resolveField($datetime, 'description'); |
|
| 81 | + }, |
|
| 82 | + ], |
|
| 83 | + 'start' => [ |
|
| 84 | + 'type' => 'String', |
|
| 85 | + 'description' => __('Start timestamp of Event', 'event_espresso'), |
|
| 86 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 87 | + return $this->resolveField($datetime, 'start'); |
|
| 88 | + }, |
|
| 89 | + ], |
|
| 90 | + 'startDate' => [ |
|
| 91 | + 'type' => 'String', |
|
| 92 | + 'description' => __('Start time/date of Event', 'event_espresso'), |
|
| 93 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 94 | + return $this->resolveField($datetime, 'start_date'); |
|
| 95 | + }, |
|
| 96 | + ], |
|
| 97 | + 'end' => [ |
|
| 98 | + 'type' => 'String', |
|
| 99 | + 'description' => __('End timestamp of Event', 'event_espresso'), |
|
| 100 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 101 | + return $this->resolveField($datetime, 'end'); |
|
| 102 | + }, |
|
| 103 | + ], |
|
| 104 | + 'endDate' => [ |
|
| 105 | + 'type' => 'String', |
|
| 106 | + 'description' => __('End time/date of Event', 'event_espresso'), |
|
| 107 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 108 | + return $this->resolveField($datetime, 'end_date'); |
|
| 109 | + }, |
|
| 110 | + ], |
|
| 111 | + 'startTime' => [ |
|
| 112 | + 'type' => 'String', |
|
| 113 | + 'description' => __('Start time of Event', 'event_espresso'), |
|
| 114 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 115 | + return $this->resolveField($datetime, 'start_time'); |
|
| 116 | + }, |
|
| 117 | + ], |
|
| 118 | + 'endTime' => [ |
|
| 119 | + 'type' => 'String', |
|
| 120 | + 'description' => __('End time of Event', 'event_espresso'), |
|
| 121 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 122 | + return $this->resolveField($datetime, 'end_time'); |
|
| 123 | + }, |
|
| 124 | + ], |
|
| 125 | + 'capacity' => [ |
|
| 126 | + 'type' => 'Int', |
|
| 127 | + 'description' => __('Registration Limit for this time', 'event_espresso'), |
|
| 128 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 129 | + $capacity = $datetime instanceof EE_Datetime ? $datetime->reg_limit() : EE_INF; |
|
| 130 | + return $this->parseInfiniteValue($capacity); |
|
| 131 | + }, |
|
| 132 | + ], |
|
| 133 | + 'sold' => [ |
|
| 134 | + 'type' => 'Int', |
|
| 135 | + 'description' => __('How many sales for this Datetime that have occurred', 'event_espresso'), |
|
| 136 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 137 | + return $this->resolveField($datetime, 'sold'); |
|
| 138 | + }, |
|
| 139 | + ], |
|
| 140 | + 'reserved' => [ |
|
| 141 | + 'type' => 'Int', |
|
| 142 | + 'description' => __('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso'), |
|
| 143 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 144 | + return $this->resolveField($datetime, 'reserved'); |
|
| 145 | + }, |
|
| 146 | + ], |
|
| 147 | + 'order' => [ |
|
| 148 | + 'type' => 'Int', |
|
| 149 | + 'description' => __('The order in which the Datetime is displayed', 'event_espresso'), |
|
| 150 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 151 | + return $this->resolveField($datetime, 'order'); |
|
| 152 | + }, |
|
| 153 | + ], |
|
| 154 | + 'length' => [ |
|
| 155 | + 'type' => 'Int', |
|
| 156 | + 'description' => __('The length of the event (start to end time) in seconds', 'event_espresso'), |
|
| 157 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 158 | + return $this->resolveField($datetime, 'length'); |
|
| 159 | + }, |
|
| 160 | + ], |
|
| 161 | + 'parent' => [ |
|
| 162 | + 'type' => 'Datetime', |
|
| 163 | + 'description' => __('The parent datetime of the current datetime', 'event_espresso'), |
|
| 164 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 165 | + return $this->resolveParent($datetime); |
|
| 166 | + }, |
|
| 167 | + ], |
|
| 168 | + 'isPrimary' => [ |
|
| 169 | + 'type' => 'Boolean', |
|
| 170 | + 'description' => __('Flag indicating datetime is primary one for event', 'event_espresso'), |
|
| 171 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 172 | + return $this->resolveField($datetime, 'is_primary'); |
|
| 173 | + }, |
|
| 174 | + ], |
|
| 175 | + 'isSoldOut' => [ |
|
| 176 | + 'type' => 'Boolean', |
|
| 177 | + 'description' => __('Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit', |
|
| 178 | + 'event_espresso'), |
|
| 179 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 180 | + return $this->resolveField($datetime, 'sold_out'); |
|
| 181 | + }, |
|
| 182 | + ], |
|
| 183 | + 'isUpcoming' => [ |
|
| 184 | + 'type' => 'Boolean', |
|
| 185 | + 'description' => __('Whether the date is upcoming', 'event_espresso'), |
|
| 186 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 187 | + return $this->resolveField($datetime, 'is_upcoming'); |
|
| 188 | + }, |
|
| 189 | + ], |
|
| 190 | + 'isActive' => [ |
|
| 191 | + 'type' => 'Boolean', |
|
| 192 | + 'description' => __('Flag indicating datetime is active', 'event_espresso'), |
|
| 193 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 194 | + return $this->resolveField($datetime, 'is_active'); |
|
| 195 | + }, |
|
| 196 | + ], |
|
| 197 | + 'isExpired' => [ |
|
| 198 | + 'type' => 'Boolean', |
|
| 199 | + 'description' => __('Flag indicating datetime is expired or not', 'event_espresso'), |
|
| 200 | + 'resolve' => function (EE_Datetime $datetime) { |
|
| 201 | + return $this->resolveField($datetime, 'is_expired'); |
|
| 202 | + }, |
|
| 203 | + ], |
|
| 204 | + 'event' => [ |
|
| 205 | + 'type' => 'Event', |
|
| 206 | + 'description' => __('Event of the datetime.', 'event_espresso'), |
|
| 207 | + 'resolve' => function (EE_Datetime $datetime, $args, $context) { |
|
| 208 | + return $this->resolveEvent($datetime, $args, $context); |
|
| 209 | + }, |
|
| 210 | + ], |
|
| 211 | + ]); |
|
| 212 | + } |
|
| 213 | 213 | |
| 214 | 214 | |
| 215 | - /** |
|
| 216 | - * @param EE_Datetime $datetime |
|
| 217 | - * @param mixed $field |
|
| 218 | - * @return string |
|
| 219 | - * @since $VID:$ |
|
| 220 | - */ |
|
| 221 | - public function resolveField(EE_Datetime $datetime, $field) |
|
| 222 | - { |
|
| 223 | - return $datetime instanceof EE_Datetime ? $datetime->{$field}() : null; |
|
| 224 | - } |
|
| 215 | + /** |
|
| 216 | + * @param EE_Datetime $datetime |
|
| 217 | + * @param mixed $field |
|
| 218 | + * @return string |
|
| 219 | + * @since $VID:$ |
|
| 220 | + */ |
|
| 221 | + public function resolveField(EE_Datetime $datetime, $field) |
|
| 222 | + { |
|
| 223 | + return $datetime instanceof EE_Datetime ? $datetime->{$field}() : null; |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | 226 | |
| 227 | - /** |
|
| 228 | - * @param EE_Datetime $datetime |
|
| 229 | - * @param $args |
|
| 230 | - * @param $context |
|
| 231 | - * @return Deferred|null |
|
| 232 | - * @throws EE_Error |
|
| 233 | - * @throws InvalidDataTypeException |
|
| 234 | - * @throws InvalidInterfaceException |
|
| 235 | - * @throws UserError |
|
| 236 | - * @throws InvalidArgumentException |
|
| 237 | - * @throws ReflectionException |
|
| 238 | - * @since $VID:$ |
|
| 239 | - */ |
|
| 240 | - public function resolveEvent(EE_Datetime $datetime, $args, $context) |
|
| 241 | - { |
|
| 242 | - $event = $datetime instanceof EE_Datetime ? $datetime->event() : null; |
|
| 243 | - return $event instanceof EE_Event |
|
| 244 | - ? DataSource::resolve_post_object($event->ID(), $context) |
|
| 245 | - : null; |
|
| 246 | - } |
|
| 227 | + /** |
|
| 228 | + * @param EE_Datetime $datetime |
|
| 229 | + * @param $args |
|
| 230 | + * @param $context |
|
| 231 | + * @return Deferred|null |
|
| 232 | + * @throws EE_Error |
|
| 233 | + * @throws InvalidDataTypeException |
|
| 234 | + * @throws InvalidInterfaceException |
|
| 235 | + * @throws UserError |
|
| 236 | + * @throws InvalidArgumentException |
|
| 237 | + * @throws ReflectionException |
|
| 238 | + * @since $VID:$ |
|
| 239 | + */ |
|
| 240 | + public function resolveEvent(EE_Datetime $datetime, $args, $context) |
|
| 241 | + { |
|
| 242 | + $event = $datetime instanceof EE_Datetime ? $datetime->event() : null; |
|
| 243 | + return $event instanceof EE_Event |
|
| 244 | + ? DataSource::resolve_post_object($event->ID(), $context) |
|
| 245 | + : null; |
|
| 246 | + } |
|
| 247 | 247 | } |
| 248 | 248 | \ No newline at end of file |
@@ -62,70 +62,70 @@ discard block |
||
| 62 | 62 | 'non_null' => 'Int', |
| 63 | 63 | ], |
| 64 | 64 | 'description' => __('The datetime ID.', 'event_espresso'), |
| 65 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 65 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 66 | 66 | return $this->resolveField($datetime, 'ID'); |
| 67 | 67 | }, |
| 68 | 68 | ], |
| 69 | 69 | 'name' => [ |
| 70 | 70 | 'type' => 'String', |
| 71 | 71 | 'description' => __('Datetime Name', 'event_espresso'), |
| 72 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 72 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 73 | 73 | return $this->resolveField($datetime, 'name'); |
| 74 | 74 | }, |
| 75 | 75 | ], |
| 76 | 76 | 'description' => [ |
| 77 | 77 | 'type' => 'String', |
| 78 | 78 | 'description' => __('Description for Datetime', 'event_espresso'), |
| 79 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 79 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 80 | 80 | return $this->resolveField($datetime, 'description'); |
| 81 | 81 | }, |
| 82 | 82 | ], |
| 83 | 83 | 'start' => [ |
| 84 | 84 | 'type' => 'String', |
| 85 | 85 | 'description' => __('Start timestamp of Event', 'event_espresso'), |
| 86 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 86 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 87 | 87 | return $this->resolveField($datetime, 'start'); |
| 88 | 88 | }, |
| 89 | 89 | ], |
| 90 | 90 | 'startDate' => [ |
| 91 | 91 | 'type' => 'String', |
| 92 | 92 | 'description' => __('Start time/date of Event', 'event_espresso'), |
| 93 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 93 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 94 | 94 | return $this->resolveField($datetime, 'start_date'); |
| 95 | 95 | }, |
| 96 | 96 | ], |
| 97 | 97 | 'end' => [ |
| 98 | 98 | 'type' => 'String', |
| 99 | 99 | 'description' => __('End timestamp of Event', 'event_espresso'), |
| 100 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 100 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 101 | 101 | return $this->resolveField($datetime, 'end'); |
| 102 | 102 | }, |
| 103 | 103 | ], |
| 104 | 104 | 'endDate' => [ |
| 105 | 105 | 'type' => 'String', |
| 106 | 106 | 'description' => __('End time/date of Event', 'event_espresso'), |
| 107 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 107 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 108 | 108 | return $this->resolveField($datetime, 'end_date'); |
| 109 | 109 | }, |
| 110 | 110 | ], |
| 111 | 111 | 'startTime' => [ |
| 112 | 112 | 'type' => 'String', |
| 113 | 113 | 'description' => __('Start time of Event', 'event_espresso'), |
| 114 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 114 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 115 | 115 | return $this->resolveField($datetime, 'start_time'); |
| 116 | 116 | }, |
| 117 | 117 | ], |
| 118 | 118 | 'endTime' => [ |
| 119 | 119 | 'type' => 'String', |
| 120 | 120 | 'description' => __('End time of Event', 'event_espresso'), |
| 121 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 121 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 122 | 122 | return $this->resolveField($datetime, 'end_time'); |
| 123 | 123 | }, |
| 124 | 124 | ], |
| 125 | 125 | 'capacity' => [ |
| 126 | 126 | 'type' => 'Int', |
| 127 | 127 | 'description' => __('Registration Limit for this time', 'event_espresso'), |
| 128 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 128 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 129 | 129 | $capacity = $datetime instanceof EE_Datetime ? $datetime->reg_limit() : EE_INF; |
| 130 | 130 | return $this->parseInfiniteValue($capacity); |
| 131 | 131 | }, |
@@ -133,42 +133,42 @@ discard block |
||
| 133 | 133 | 'sold' => [ |
| 134 | 134 | 'type' => 'Int', |
| 135 | 135 | 'description' => __('How many sales for this Datetime that have occurred', 'event_espresso'), |
| 136 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 136 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 137 | 137 | return $this->resolveField($datetime, 'sold'); |
| 138 | 138 | }, |
| 139 | 139 | ], |
| 140 | 140 | 'reserved' => [ |
| 141 | 141 | 'type' => 'Int', |
| 142 | 142 | 'description' => __('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso'), |
| 143 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 143 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 144 | 144 | return $this->resolveField($datetime, 'reserved'); |
| 145 | 145 | }, |
| 146 | 146 | ], |
| 147 | 147 | 'order' => [ |
| 148 | 148 | 'type' => 'Int', |
| 149 | 149 | 'description' => __('The order in which the Datetime is displayed', 'event_espresso'), |
| 150 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 150 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 151 | 151 | return $this->resolveField($datetime, 'order'); |
| 152 | 152 | }, |
| 153 | 153 | ], |
| 154 | 154 | 'length' => [ |
| 155 | 155 | 'type' => 'Int', |
| 156 | 156 | 'description' => __('The length of the event (start to end time) in seconds', 'event_espresso'), |
| 157 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 157 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 158 | 158 | return $this->resolveField($datetime, 'length'); |
| 159 | 159 | }, |
| 160 | 160 | ], |
| 161 | 161 | 'parent' => [ |
| 162 | 162 | 'type' => 'Datetime', |
| 163 | 163 | 'description' => __('The parent datetime of the current datetime', 'event_espresso'), |
| 164 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 164 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 165 | 165 | return $this->resolveParent($datetime); |
| 166 | 166 | }, |
| 167 | 167 | ], |
| 168 | 168 | 'isPrimary' => [ |
| 169 | 169 | 'type' => 'Boolean', |
| 170 | 170 | 'description' => __('Flag indicating datetime is primary one for event', 'event_espresso'), |
| 171 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 171 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 172 | 172 | return $this->resolveField($datetime, 'is_primary'); |
| 173 | 173 | }, |
| 174 | 174 | ], |
@@ -176,35 +176,35 @@ discard block |
||
| 176 | 176 | 'type' => 'Boolean', |
| 177 | 177 | 'description' => __('Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit', |
| 178 | 178 | 'event_espresso'), |
| 179 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 179 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 180 | 180 | return $this->resolveField($datetime, 'sold_out'); |
| 181 | 181 | }, |
| 182 | 182 | ], |
| 183 | 183 | 'isUpcoming' => [ |
| 184 | 184 | 'type' => 'Boolean', |
| 185 | 185 | 'description' => __('Whether the date is upcoming', 'event_espresso'), |
| 186 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 186 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 187 | 187 | return $this->resolveField($datetime, 'is_upcoming'); |
| 188 | 188 | }, |
| 189 | 189 | ], |
| 190 | 190 | 'isActive' => [ |
| 191 | 191 | 'type' => 'Boolean', |
| 192 | 192 | 'description' => __('Flag indicating datetime is active', 'event_espresso'), |
| 193 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 193 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 194 | 194 | return $this->resolveField($datetime, 'is_active'); |
| 195 | 195 | }, |
| 196 | 196 | ], |
| 197 | 197 | 'isExpired' => [ |
| 198 | 198 | 'type' => 'Boolean', |
| 199 | 199 | 'description' => __('Flag indicating datetime is expired or not', 'event_espresso'), |
| 200 | - 'resolve' => function (EE_Datetime $datetime) { |
|
| 200 | + 'resolve' => function(EE_Datetime $datetime) { |
|
| 201 | 201 | return $this->resolveField($datetime, 'is_expired'); |
| 202 | 202 | }, |
| 203 | 203 | ], |
| 204 | 204 | 'event' => [ |
| 205 | 205 | 'type' => 'Event', |
| 206 | 206 | 'description' => __('Event of the datetime.', 'event_espresso'), |
| 207 | - 'resolve' => function (EE_Datetime $datetime, $args, $context) { |
|
| 207 | + 'resolve' => function(EE_Datetime $datetime, $args, $context) { |
|
| 208 | 208 | return $this->resolveEvent($datetime, $args, $context); |
| 209 | 209 | }, |
| 210 | 210 | ], |
@@ -248,7 +248,7 @@ |
||
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | 250 | * @param $source |
| 251 | - * @param mixed $field |
|
| 251 | + * @param string $field |
|
| 252 | 252 | * @return string |
| 253 | 253 | * @since $VID:$ |
| 254 | 254 | */ |
@@ -37,224 +37,224 @@ |
||
| 37 | 37 | class Event extends TypeBase |
| 38 | 38 | { |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Event constructor. |
|
| 42 | - * |
|
| 43 | - * @param EEM_Event $event_model |
|
| 44 | - */ |
|
| 45 | - public function __construct(EEM_Event $event_model) |
|
| 46 | - { |
|
| 47 | - $this->model = $event_model; |
|
| 48 | - $this->setName('Event'); |
|
| 49 | - $this->setIsCustomPostType(true); |
|
| 50 | - $this->setFields( [ |
|
| 51 | - 'name' => [ |
|
| 52 | - 'type' => 'String', |
|
| 53 | - 'description' => __('Event Name', 'event_espresso'), |
|
| 54 | - 'resolve' => function ($source) { |
|
| 55 | - return $this->resolveField($source, 'name'); |
|
| 56 | - }, |
|
| 57 | - ], |
|
| 58 | - 'desc' => [ |
|
| 59 | - 'type' => 'String', |
|
| 60 | - 'description' => __('Event Description', 'event_espresso'), |
|
| 61 | - 'resolve' => function ($source) { |
|
| 62 | - return $this->resolveField($source, 'description'); |
|
| 63 | - }, |
|
| 64 | - ], |
|
| 65 | - 'shortDesc' => [ |
|
| 66 | - 'type' => 'String', |
|
| 67 | - 'description' => __('Event Short Description', 'event_espresso'), |
|
| 68 | - 'resolve' => function ($source) { |
|
| 69 | - return $this->resolveField($source, 'short_description'); |
|
| 70 | - }, |
|
| 71 | - ], |
|
| 72 | - 'created' => [ |
|
| 73 | - 'type' => 'String', |
|
| 74 | - 'description' => __('Date/Time Event Created', 'event_espresso'), |
|
| 75 | - 'resolve' => function ($source) { |
|
| 76 | - return $this->resolveField($source, 'created'); |
|
| 77 | - }, |
|
| 78 | - ], |
|
| 79 | - // Already registered by WP GraphQL |
|
| 80 | - /* 'modified' => [ |
|
| 40 | + /** |
|
| 41 | + * Event constructor. |
|
| 42 | + * |
|
| 43 | + * @param EEM_Event $event_model |
|
| 44 | + */ |
|
| 45 | + public function __construct(EEM_Event $event_model) |
|
| 46 | + { |
|
| 47 | + $this->model = $event_model; |
|
| 48 | + $this->setName('Event'); |
|
| 49 | + $this->setIsCustomPostType(true); |
|
| 50 | + $this->setFields( [ |
|
| 51 | + 'name' => [ |
|
| 52 | + 'type' => 'String', |
|
| 53 | + 'description' => __('Event Name', 'event_espresso'), |
|
| 54 | + 'resolve' => function ($source) { |
|
| 55 | + return $this->resolveField($source, 'name'); |
|
| 56 | + }, |
|
| 57 | + ], |
|
| 58 | + 'desc' => [ |
|
| 59 | + 'type' => 'String', |
|
| 60 | + 'description' => __('Event Description', 'event_espresso'), |
|
| 61 | + 'resolve' => function ($source) { |
|
| 62 | + return $this->resolveField($source, 'description'); |
|
| 63 | + }, |
|
| 64 | + ], |
|
| 65 | + 'shortDesc' => [ |
|
| 66 | + 'type' => 'String', |
|
| 67 | + 'description' => __('Event Short Description', 'event_espresso'), |
|
| 68 | + 'resolve' => function ($source) { |
|
| 69 | + return $this->resolveField($source, 'short_description'); |
|
| 70 | + }, |
|
| 71 | + ], |
|
| 72 | + 'created' => [ |
|
| 73 | + 'type' => 'String', |
|
| 74 | + 'description' => __('Date/Time Event Created', 'event_espresso'), |
|
| 75 | + 'resolve' => function ($source) { |
|
| 76 | + return $this->resolveField($source, 'created'); |
|
| 77 | + }, |
|
| 78 | + ], |
|
| 79 | + // Already registered by WP GraphQL |
|
| 80 | + /* 'modified' => [ |
|
| 81 | 81 | 'type' => 'String', |
| 82 | 82 | 'description' => __('Date/Time Event Modified', 'event_espresso'), |
| 83 | 83 | ], */ |
| 84 | - 'wpUser' => [ |
|
| 85 | - 'type' => 'User', |
|
| 86 | - 'description' => __('Event Creator', 'event_espresso'), |
|
| 87 | - 'resolve' => function ($source, $args, $context) { |
|
| 88 | - return $this->resolveWpUser($source, $args, $context); |
|
| 89 | - }, |
|
| 90 | - ], |
|
| 91 | - 'order' => [ |
|
| 92 | - 'type' => 'Int', |
|
| 93 | - 'description' => __('Event Menu Order', 'event_espresso'), |
|
| 94 | - 'resolve' => function ($source) { |
|
| 95 | - return $this->resolveField($source, 'order'); |
|
| 96 | - }, |
|
| 97 | - ], |
|
| 98 | - // Already registered by WP GraphQL |
|
| 99 | - /* 'parent' => [ |
|
| 84 | + 'wpUser' => [ |
|
| 85 | + 'type' => 'User', |
|
| 86 | + 'description' => __('Event Creator', 'event_espresso'), |
|
| 87 | + 'resolve' => function ($source, $args, $context) { |
|
| 88 | + return $this->resolveWpUser($source, $args, $context); |
|
| 89 | + }, |
|
| 90 | + ], |
|
| 91 | + 'order' => [ |
|
| 92 | + 'type' => 'Int', |
|
| 93 | + 'description' => __('Event Menu Order', 'event_espresso'), |
|
| 94 | + 'resolve' => function ($source) { |
|
| 95 | + return $this->resolveField($source, 'order'); |
|
| 96 | + }, |
|
| 97 | + ], |
|
| 98 | + // Already registered by WP GraphQL |
|
| 99 | + /* 'parent' => [ |
|
| 100 | 100 | 'type' => 'Venue', |
| 101 | 101 | 'description' => __('Venue Parent ID', 'event_espresso'), |
| 102 | 102 | ], */ |
| 103 | - 'displayDesc' => [ |
|
| 104 | - 'type' => 'Boolean', |
|
| 105 | - 'description' => __('Display Description Flag', 'event_espresso'), |
|
| 106 | - 'resolve' => function ($source) { |
|
| 107 | - return $this->resolveField($source, 'display_description'); |
|
| 108 | - }, |
|
| 109 | - ], |
|
| 110 | - 'displayTicketSelector' => [ |
|
| 111 | - 'type' => 'Boolean', |
|
| 112 | - 'description' => __('Display Ticket Selector Flag', 'event_espresso'), |
|
| 113 | - 'resolve' => function ($source) { |
|
| 114 | - return $this->resolveField($source, 'display_ticket_selector'); |
|
| 115 | - }, |
|
| 116 | - ], |
|
| 117 | - 'visibleOn' => [ |
|
| 118 | - 'type' => 'String', |
|
| 119 | - 'description' => __('Event Visible Date', 'event_espresso'), |
|
| 120 | - 'resolve' => function ($source) { |
|
| 121 | - return $this->resolveField($source, 'visible_on'); |
|
| 122 | - }, |
|
| 123 | - ], |
|
| 124 | - 'additionalLimit' => [ |
|
| 125 | - 'type' => 'String', |
|
| 126 | - 'description' => __('Limit of Additional Registrations on Same Transaction', 'event_espresso'), |
|
| 127 | - 'resolve' => function ($source) { |
|
| 128 | - return $this->resolveField($source, 'additional_limit'); |
|
| 129 | - }, |
|
| 130 | - ], |
|
| 131 | - 'phone' => [ |
|
| 132 | - 'type' => 'String', |
|
| 133 | - 'description' => __('Event Phone Number', 'event_espresso'), |
|
| 134 | - 'resolve' => function ($source) { |
|
| 135 | - return $this->resolveField($source, 'phone'); |
|
| 136 | - }, |
|
| 137 | - ], |
|
| 138 | - 'memberOnly' => [ |
|
| 139 | - 'type' => 'Boolean', |
|
| 140 | - 'description' => __('Member-Only Event Flag', 'event_espresso'), |
|
| 141 | - 'resolve' => function ($source) { |
|
| 142 | - return $this->resolveField($source, 'member_only'); |
|
| 143 | - }, |
|
| 144 | - ], |
|
| 145 | - 'allowOverflow' => [ |
|
| 146 | - 'type' => 'Boolean', |
|
| 147 | - 'description' => __('Allow Overflow on Event', 'event_espresso'), |
|
| 148 | - 'resolve' => function ($source) { |
|
| 149 | - return $this->resolveField($source, 'allow_overflow'); |
|
| 150 | - }, |
|
| 151 | - ], |
|
| 152 | - 'timezoneString' => [ |
|
| 153 | - 'type' => 'String', |
|
| 154 | - 'description' => __('Timezone (name) for Event times', 'event_espresso'), |
|
| 155 | - 'resolve' => function ($source) { |
|
| 156 | - return $this->resolveField($source, 'timezone_string'); |
|
| 157 | - }, |
|
| 158 | - ], |
|
| 159 | - 'externalUrl' => [ |
|
| 160 | - 'type' => 'String', |
|
| 161 | - 'description' => __('URL of Event Page if hosted elsewhere', 'event_espresso'), |
|
| 162 | - 'resolve' => function ($source) { |
|
| 163 | - return $this->resolveField($source, 'external_url'); |
|
| 164 | - }, |
|
| 165 | - ], |
|
| 166 | - 'donations' => [ |
|
| 167 | - 'type' => 'Boolean', |
|
| 168 | - 'description' => __('Accept Donations?', 'event_espresso'), |
|
| 169 | - 'resolve' => function ($source) { |
|
| 170 | - return $this->resolveField($source, 'donations'); |
|
| 171 | - }, |
|
| 172 | - ], |
|
| 173 | - 'isSoldOut' => [ |
|
| 174 | - 'type' => 'Boolean', |
|
| 175 | - 'description' => __('Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
| 176 | - 'event_espresso'), |
|
| 177 | - 'resolve' => function ($source) { |
|
| 178 | - return $this->resolveField($source, 'is_sold_out'); |
|
| 179 | - }, |
|
| 180 | - ], |
|
| 181 | - 'isPostponed' => [ |
|
| 182 | - 'type' => 'Boolean', |
|
| 183 | - 'description' => __('Flag indicating whether the event is marked as postponed', 'event_espresso'), |
|
| 184 | - 'resolve' => function ($source) { |
|
| 185 | - return $this->resolveField($source, 'is_postponed'); |
|
| 186 | - }, |
|
| 187 | - ], |
|
| 188 | - 'isCancelled' => [ |
|
| 189 | - 'type' => 'Boolean', |
|
| 190 | - 'description' => __('Flag indicating whether the event is marked as cancelled', 'event_espresso'), |
|
| 191 | - 'resolve' => function ($source) { |
|
| 192 | - return $this->resolveField($source, 'is_cancelled'); |
|
| 193 | - }, |
|
| 194 | - ], |
|
| 195 | - 'isUpcoming' => [ |
|
| 196 | - 'type' => 'Boolean', |
|
| 197 | - 'description' => __('Whether the event is upcoming', 'event_espresso'), |
|
| 198 | - 'resolve' => function ($source) { |
|
| 199 | - return $this->resolveField($source, 'is_upcoming'); |
|
| 200 | - }, |
|
| 201 | - ], |
|
| 202 | - 'isActive' => [ |
|
| 203 | - 'type' => 'Boolean', |
|
| 204 | - 'description' => __('Flag indicating event is active', 'event_espresso'), |
|
| 205 | - 'resolve' => function ($source) { |
|
| 206 | - return $this->resolveField($source, 'is_active'); |
|
| 207 | - }, |
|
| 208 | - ], |
|
| 209 | - 'isInactive' => [ |
|
| 210 | - 'type' => 'Boolean', |
|
| 211 | - 'description' => __('Flag indicating event is inactive', 'event_espresso'), |
|
| 212 | - 'resolve' => function ($source) { |
|
| 213 | - return $this->resolveField($source, 'is_inactive'); |
|
| 214 | - }, |
|
| 215 | - ], |
|
| 216 | - 'isExpired' => [ |
|
| 217 | - 'type' => 'Boolean', |
|
| 218 | - 'description' => __('Flag indicating event is expired or not', 'event_espresso'), |
|
| 219 | - 'resolve' => function ($source) { |
|
| 220 | - return $this->resolveField($source, 'is_expired'); |
|
| 221 | - }, |
|
| 222 | - ], |
|
| 223 | - ] ); |
|
| 224 | - } |
|
| 103 | + 'displayDesc' => [ |
|
| 104 | + 'type' => 'Boolean', |
|
| 105 | + 'description' => __('Display Description Flag', 'event_espresso'), |
|
| 106 | + 'resolve' => function ($source) { |
|
| 107 | + return $this->resolveField($source, 'display_description'); |
|
| 108 | + }, |
|
| 109 | + ], |
|
| 110 | + 'displayTicketSelector' => [ |
|
| 111 | + 'type' => 'Boolean', |
|
| 112 | + 'description' => __('Display Ticket Selector Flag', 'event_espresso'), |
|
| 113 | + 'resolve' => function ($source) { |
|
| 114 | + return $this->resolveField($source, 'display_ticket_selector'); |
|
| 115 | + }, |
|
| 116 | + ], |
|
| 117 | + 'visibleOn' => [ |
|
| 118 | + 'type' => 'String', |
|
| 119 | + 'description' => __('Event Visible Date', 'event_espresso'), |
|
| 120 | + 'resolve' => function ($source) { |
|
| 121 | + return $this->resolveField($source, 'visible_on'); |
|
| 122 | + }, |
|
| 123 | + ], |
|
| 124 | + 'additionalLimit' => [ |
|
| 125 | + 'type' => 'String', |
|
| 126 | + 'description' => __('Limit of Additional Registrations on Same Transaction', 'event_espresso'), |
|
| 127 | + 'resolve' => function ($source) { |
|
| 128 | + return $this->resolveField($source, 'additional_limit'); |
|
| 129 | + }, |
|
| 130 | + ], |
|
| 131 | + 'phone' => [ |
|
| 132 | + 'type' => 'String', |
|
| 133 | + 'description' => __('Event Phone Number', 'event_espresso'), |
|
| 134 | + 'resolve' => function ($source) { |
|
| 135 | + return $this->resolveField($source, 'phone'); |
|
| 136 | + }, |
|
| 137 | + ], |
|
| 138 | + 'memberOnly' => [ |
|
| 139 | + 'type' => 'Boolean', |
|
| 140 | + 'description' => __('Member-Only Event Flag', 'event_espresso'), |
|
| 141 | + 'resolve' => function ($source) { |
|
| 142 | + return $this->resolveField($source, 'member_only'); |
|
| 143 | + }, |
|
| 144 | + ], |
|
| 145 | + 'allowOverflow' => [ |
|
| 146 | + 'type' => 'Boolean', |
|
| 147 | + 'description' => __('Allow Overflow on Event', 'event_espresso'), |
|
| 148 | + 'resolve' => function ($source) { |
|
| 149 | + return $this->resolveField($source, 'allow_overflow'); |
|
| 150 | + }, |
|
| 151 | + ], |
|
| 152 | + 'timezoneString' => [ |
|
| 153 | + 'type' => 'String', |
|
| 154 | + 'description' => __('Timezone (name) for Event times', 'event_espresso'), |
|
| 155 | + 'resolve' => function ($source) { |
|
| 156 | + return $this->resolveField($source, 'timezone_string'); |
|
| 157 | + }, |
|
| 158 | + ], |
|
| 159 | + 'externalUrl' => [ |
|
| 160 | + 'type' => 'String', |
|
| 161 | + 'description' => __('URL of Event Page if hosted elsewhere', 'event_espresso'), |
|
| 162 | + 'resolve' => function ($source) { |
|
| 163 | + return $this->resolveField($source, 'external_url'); |
|
| 164 | + }, |
|
| 165 | + ], |
|
| 166 | + 'donations' => [ |
|
| 167 | + 'type' => 'Boolean', |
|
| 168 | + 'description' => __('Accept Donations?', 'event_espresso'), |
|
| 169 | + 'resolve' => function ($source) { |
|
| 170 | + return $this->resolveField($source, 'donations'); |
|
| 171 | + }, |
|
| 172 | + ], |
|
| 173 | + 'isSoldOut' => [ |
|
| 174 | + 'type' => 'Boolean', |
|
| 175 | + 'description' => __('Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
| 176 | + 'event_espresso'), |
|
| 177 | + 'resolve' => function ($source) { |
|
| 178 | + return $this->resolveField($source, 'is_sold_out'); |
|
| 179 | + }, |
|
| 180 | + ], |
|
| 181 | + 'isPostponed' => [ |
|
| 182 | + 'type' => 'Boolean', |
|
| 183 | + 'description' => __('Flag indicating whether the event is marked as postponed', 'event_espresso'), |
|
| 184 | + 'resolve' => function ($source) { |
|
| 185 | + return $this->resolveField($source, 'is_postponed'); |
|
| 186 | + }, |
|
| 187 | + ], |
|
| 188 | + 'isCancelled' => [ |
|
| 189 | + 'type' => 'Boolean', |
|
| 190 | + 'description' => __('Flag indicating whether the event is marked as cancelled', 'event_espresso'), |
|
| 191 | + 'resolve' => function ($source) { |
|
| 192 | + return $this->resolveField($source, 'is_cancelled'); |
|
| 193 | + }, |
|
| 194 | + ], |
|
| 195 | + 'isUpcoming' => [ |
|
| 196 | + 'type' => 'Boolean', |
|
| 197 | + 'description' => __('Whether the event is upcoming', 'event_espresso'), |
|
| 198 | + 'resolve' => function ($source) { |
|
| 199 | + return $this->resolveField($source, 'is_upcoming'); |
|
| 200 | + }, |
|
| 201 | + ], |
|
| 202 | + 'isActive' => [ |
|
| 203 | + 'type' => 'Boolean', |
|
| 204 | + 'description' => __('Flag indicating event is active', 'event_espresso'), |
|
| 205 | + 'resolve' => function ($source) { |
|
| 206 | + return $this->resolveField($source, 'is_active'); |
|
| 207 | + }, |
|
| 208 | + ], |
|
| 209 | + 'isInactive' => [ |
|
| 210 | + 'type' => 'Boolean', |
|
| 211 | + 'description' => __('Flag indicating event is inactive', 'event_espresso'), |
|
| 212 | + 'resolve' => function ($source) { |
|
| 213 | + return $this->resolveField($source, 'is_inactive'); |
|
| 214 | + }, |
|
| 215 | + ], |
|
| 216 | + 'isExpired' => [ |
|
| 217 | + 'type' => 'Boolean', |
|
| 218 | + 'description' => __('Flag indicating event is expired or not', 'event_espresso'), |
|
| 219 | + 'resolve' => function ($source) { |
|
| 220 | + return $this->resolveField($source, 'is_expired'); |
|
| 221 | + }, |
|
| 222 | + ], |
|
| 223 | + ] ); |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | 226 | |
| 227 | - /** |
|
| 228 | - * @param Post|EE_Event $source |
|
| 229 | - * @return EE_Base_Class|EE_Event|null |
|
| 230 | - * @since $VID:$ |
|
| 231 | - */ |
|
| 232 | - private function getEvent($source) |
|
| 233 | - { |
|
| 234 | - // If it comes from a custom connection |
|
| 235 | - // where the $source is already instantiated. |
|
| 236 | - if ($source instanceof EE_Event) { |
|
| 237 | - return $source; |
|
| 238 | - } |
|
| 227 | + /** |
|
| 228 | + * @param Post|EE_Event $source |
|
| 229 | + * @return EE_Base_Class|EE_Event|null |
|
| 230 | + * @since $VID:$ |
|
| 231 | + */ |
|
| 232 | + private function getEvent($source) |
|
| 233 | + { |
|
| 234 | + // If it comes from a custom connection |
|
| 235 | + // where the $source is already instantiated. |
|
| 236 | + if ($source instanceof EE_Event) { |
|
| 237 | + return $source; |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | - $id = $source instanceof Post ? $source->ID : 0; |
|
| 240 | + $id = $source instanceof Post ? $source->ID : 0; |
|
| 241 | 241 | |
| 242 | - if ($id) { |
|
| 243 | - return $this->model->get_one_by_ID($id); |
|
| 244 | - } |
|
| 245 | - return null; |
|
| 246 | - } |
|
| 242 | + if ($id) { |
|
| 243 | + return $this->model->get_one_by_ID($id); |
|
| 244 | + } |
|
| 245 | + return null; |
|
| 246 | + } |
|
| 247 | 247 | |
| 248 | 248 | |
| 249 | - /** |
|
| 250 | - * @param $source |
|
| 251 | - * @param mixed $field |
|
| 252 | - * @return string |
|
| 253 | - * @since $VID:$ |
|
| 254 | - */ |
|
| 255 | - public function resolveField($source, $field) |
|
| 256 | - { |
|
| 257 | - $event = $this->getEvent($source); |
|
| 258 | - return $event instanceof EE_Event ? $event->{$field}() : null; |
|
| 259 | - } |
|
| 249 | + /** |
|
| 250 | + * @param $source |
|
| 251 | + * @param mixed $field |
|
| 252 | + * @return string |
|
| 253 | + * @since $VID:$ |
|
| 254 | + */ |
|
| 255 | + public function resolveField($source, $field) |
|
| 256 | + { |
|
| 257 | + $event = $this->getEvent($source); |
|
| 258 | + return $event instanceof EE_Event ? $event->{$field}() : null; |
|
| 259 | + } |
|
| 260 | 260 | } |
| 261 | 261 | \ No newline at end of file |
@@ -47,32 +47,32 @@ discard block |
||
| 47 | 47 | $this->model = $event_model; |
| 48 | 48 | $this->setName('Event'); |
| 49 | 49 | $this->setIsCustomPostType(true); |
| 50 | - $this->setFields( [ |
|
| 50 | + $this->setFields([ |
|
| 51 | 51 | 'name' => [ |
| 52 | 52 | 'type' => 'String', |
| 53 | 53 | 'description' => __('Event Name', 'event_espresso'), |
| 54 | - 'resolve' => function ($source) { |
|
| 54 | + 'resolve' => function($source) { |
|
| 55 | 55 | return $this->resolveField($source, 'name'); |
| 56 | 56 | }, |
| 57 | 57 | ], |
| 58 | 58 | 'desc' => [ |
| 59 | 59 | 'type' => 'String', |
| 60 | 60 | 'description' => __('Event Description', 'event_espresso'), |
| 61 | - 'resolve' => function ($source) { |
|
| 61 | + 'resolve' => function($source) { |
|
| 62 | 62 | return $this->resolveField($source, 'description'); |
| 63 | 63 | }, |
| 64 | 64 | ], |
| 65 | 65 | 'shortDesc' => [ |
| 66 | 66 | 'type' => 'String', |
| 67 | 67 | 'description' => __('Event Short Description', 'event_espresso'), |
| 68 | - 'resolve' => function ($source) { |
|
| 68 | + 'resolve' => function($source) { |
|
| 69 | 69 | return $this->resolveField($source, 'short_description'); |
| 70 | 70 | }, |
| 71 | 71 | ], |
| 72 | 72 | 'created' => [ |
| 73 | 73 | 'type' => 'String', |
| 74 | 74 | 'description' => __('Date/Time Event Created', 'event_espresso'), |
| 75 | - 'resolve' => function ($source) { |
|
| 75 | + 'resolve' => function($source) { |
|
| 76 | 76 | return $this->resolveField($source, 'created'); |
| 77 | 77 | }, |
| 78 | 78 | ], |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | 'wpUser' => [ |
| 85 | 85 | 'type' => 'User', |
| 86 | 86 | 'description' => __('Event Creator', 'event_espresso'), |
| 87 | - 'resolve' => function ($source, $args, $context) { |
|
| 87 | + 'resolve' => function($source, $args, $context) { |
|
| 88 | 88 | return $this->resolveWpUser($source, $args, $context); |
| 89 | 89 | }, |
| 90 | 90 | ], |
| 91 | 91 | 'order' => [ |
| 92 | 92 | 'type' => 'Int', |
| 93 | 93 | 'description' => __('Event Menu Order', 'event_espresso'), |
| 94 | - 'resolve' => function ($source) { |
|
| 94 | + 'resolve' => function($source) { |
|
| 95 | 95 | return $this->resolveField($source, 'order'); |
| 96 | 96 | }, |
| 97 | 97 | ], |
@@ -103,70 +103,70 @@ discard block |
||
| 103 | 103 | 'displayDesc' => [ |
| 104 | 104 | 'type' => 'Boolean', |
| 105 | 105 | 'description' => __('Display Description Flag', 'event_espresso'), |
| 106 | - 'resolve' => function ($source) { |
|
| 106 | + 'resolve' => function($source) { |
|
| 107 | 107 | return $this->resolveField($source, 'display_description'); |
| 108 | 108 | }, |
| 109 | 109 | ], |
| 110 | 110 | 'displayTicketSelector' => [ |
| 111 | 111 | 'type' => 'Boolean', |
| 112 | 112 | 'description' => __('Display Ticket Selector Flag', 'event_espresso'), |
| 113 | - 'resolve' => function ($source) { |
|
| 113 | + 'resolve' => function($source) { |
|
| 114 | 114 | return $this->resolveField($source, 'display_ticket_selector'); |
| 115 | 115 | }, |
| 116 | 116 | ], |
| 117 | 117 | 'visibleOn' => [ |
| 118 | 118 | 'type' => 'String', |
| 119 | 119 | 'description' => __('Event Visible Date', 'event_espresso'), |
| 120 | - 'resolve' => function ($source) { |
|
| 120 | + 'resolve' => function($source) { |
|
| 121 | 121 | return $this->resolveField($source, 'visible_on'); |
| 122 | 122 | }, |
| 123 | 123 | ], |
| 124 | 124 | 'additionalLimit' => [ |
| 125 | 125 | 'type' => 'String', |
| 126 | 126 | 'description' => __('Limit of Additional Registrations on Same Transaction', 'event_espresso'), |
| 127 | - 'resolve' => function ($source) { |
|
| 127 | + 'resolve' => function($source) { |
|
| 128 | 128 | return $this->resolveField($source, 'additional_limit'); |
| 129 | 129 | }, |
| 130 | 130 | ], |
| 131 | 131 | 'phone' => [ |
| 132 | 132 | 'type' => 'String', |
| 133 | 133 | 'description' => __('Event Phone Number', 'event_espresso'), |
| 134 | - 'resolve' => function ($source) { |
|
| 134 | + 'resolve' => function($source) { |
|
| 135 | 135 | return $this->resolveField($source, 'phone'); |
| 136 | 136 | }, |
| 137 | 137 | ], |
| 138 | 138 | 'memberOnly' => [ |
| 139 | 139 | 'type' => 'Boolean', |
| 140 | 140 | 'description' => __('Member-Only Event Flag', 'event_espresso'), |
| 141 | - 'resolve' => function ($source) { |
|
| 141 | + 'resolve' => function($source) { |
|
| 142 | 142 | return $this->resolveField($source, 'member_only'); |
| 143 | 143 | }, |
| 144 | 144 | ], |
| 145 | 145 | 'allowOverflow' => [ |
| 146 | 146 | 'type' => 'Boolean', |
| 147 | 147 | 'description' => __('Allow Overflow on Event', 'event_espresso'), |
| 148 | - 'resolve' => function ($source) { |
|
| 148 | + 'resolve' => function($source) { |
|
| 149 | 149 | return $this->resolveField($source, 'allow_overflow'); |
| 150 | 150 | }, |
| 151 | 151 | ], |
| 152 | 152 | 'timezoneString' => [ |
| 153 | 153 | 'type' => 'String', |
| 154 | 154 | 'description' => __('Timezone (name) for Event times', 'event_espresso'), |
| 155 | - 'resolve' => function ($source) { |
|
| 155 | + 'resolve' => function($source) { |
|
| 156 | 156 | return $this->resolveField($source, 'timezone_string'); |
| 157 | 157 | }, |
| 158 | 158 | ], |
| 159 | 159 | 'externalUrl' => [ |
| 160 | 160 | 'type' => 'String', |
| 161 | 161 | 'description' => __('URL of Event Page if hosted elsewhere', 'event_espresso'), |
| 162 | - 'resolve' => function ($source) { |
|
| 162 | + 'resolve' => function($source) { |
|
| 163 | 163 | return $this->resolveField($source, 'external_url'); |
| 164 | 164 | }, |
| 165 | 165 | ], |
| 166 | 166 | 'donations' => [ |
| 167 | 167 | 'type' => 'Boolean', |
| 168 | 168 | 'description' => __('Accept Donations?', 'event_espresso'), |
| 169 | - 'resolve' => function ($source) { |
|
| 169 | + 'resolve' => function($source) { |
|
| 170 | 170 | return $this->resolveField($source, 'donations'); |
| 171 | 171 | }, |
| 172 | 172 | ], |
@@ -174,53 +174,53 @@ discard block |
||
| 174 | 174 | 'type' => 'Boolean', |
| 175 | 175 | 'description' => __('Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
| 176 | 176 | 'event_espresso'), |
| 177 | - 'resolve' => function ($source) { |
|
| 177 | + 'resolve' => function($source) { |
|
| 178 | 178 | return $this->resolveField($source, 'is_sold_out'); |
| 179 | 179 | }, |
| 180 | 180 | ], |
| 181 | 181 | 'isPostponed' => [ |
| 182 | 182 | 'type' => 'Boolean', |
| 183 | 183 | 'description' => __('Flag indicating whether the event is marked as postponed', 'event_espresso'), |
| 184 | - 'resolve' => function ($source) { |
|
| 184 | + 'resolve' => function($source) { |
|
| 185 | 185 | return $this->resolveField($source, 'is_postponed'); |
| 186 | 186 | }, |
| 187 | 187 | ], |
| 188 | 188 | 'isCancelled' => [ |
| 189 | 189 | 'type' => 'Boolean', |
| 190 | 190 | 'description' => __('Flag indicating whether the event is marked as cancelled', 'event_espresso'), |
| 191 | - 'resolve' => function ($source) { |
|
| 191 | + 'resolve' => function($source) { |
|
| 192 | 192 | return $this->resolveField($source, 'is_cancelled'); |
| 193 | 193 | }, |
| 194 | 194 | ], |
| 195 | 195 | 'isUpcoming' => [ |
| 196 | 196 | 'type' => 'Boolean', |
| 197 | 197 | 'description' => __('Whether the event is upcoming', 'event_espresso'), |
| 198 | - 'resolve' => function ($source) { |
|
| 198 | + 'resolve' => function($source) { |
|
| 199 | 199 | return $this->resolveField($source, 'is_upcoming'); |
| 200 | 200 | }, |
| 201 | 201 | ], |
| 202 | 202 | 'isActive' => [ |
| 203 | 203 | 'type' => 'Boolean', |
| 204 | 204 | 'description' => __('Flag indicating event is active', 'event_espresso'), |
| 205 | - 'resolve' => function ($source) { |
|
| 205 | + 'resolve' => function($source) { |
|
| 206 | 206 | return $this->resolveField($source, 'is_active'); |
| 207 | 207 | }, |
| 208 | 208 | ], |
| 209 | 209 | 'isInactive' => [ |
| 210 | 210 | 'type' => 'Boolean', |
| 211 | 211 | 'description' => __('Flag indicating event is inactive', 'event_espresso'), |
| 212 | - 'resolve' => function ($source) { |
|
| 212 | + 'resolve' => function($source) { |
|
| 213 | 213 | return $this->resolveField($source, 'is_inactive'); |
| 214 | 214 | }, |
| 215 | 215 | ], |
| 216 | 216 | 'isExpired' => [ |
| 217 | 217 | 'type' => 'Boolean', |
| 218 | 218 | 'description' => __('Flag indicating event is expired or not', 'event_espresso'), |
| 219 | - 'resolve' => function ($source) { |
|
| 219 | + 'resolve' => function($source) { |
|
| 220 | 220 | return $this->resolveField($source, 'is_expired'); |
| 221 | 221 | }, |
| 222 | 222 | ], |
| 223 | - ] ); |
|
| 223 | + ]); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | |
@@ -218,7 +218,7 @@ |
||
| 218 | 218 | |
| 219 | 219 | /** |
| 220 | 220 | * @param EE_Ticket $ticket |
| 221 | - * @param mixed $field |
|
| 221 | + * @param string $field |
|
| 222 | 222 | * @return string |
| 223 | 223 | * @since $VID:$ |
| 224 | 224 | */ |
@@ -20,17 +20,9 @@ |
||
| 20 | 20 | |
| 21 | 21 | namespace EventEspresso\core\domain\services\graphql\types; |
| 22 | 22 | |
| 23 | -use EE_Base_Class; |
|
| 24 | 23 | use EE_Ticket; |
| 25 | -use EE_Error; |
|
| 26 | 24 | use EEM_Ticket; |
| 27 | -use EventEspresso\core\exceptions\InvalidDataTypeException; |
|
| 28 | -use EventEspresso\core\exceptions\InvalidInterfaceException; |
|
| 29 | 25 | use EventEspresso\core\services\graphql\TypeBase; |
| 30 | -use GraphQL\Deferred; |
|
| 31 | -use GraphQL\Error\UserError; |
|
| 32 | -use InvalidArgumentException; |
|
| 33 | -use ReflectionException; |
|
| 34 | 26 | |
| 35 | 27 | /** |
| 36 | 28 | * Class Ticket |
@@ -43,187 +43,187 @@ |
||
| 43 | 43 | class Ticket extends TypeBase |
| 44 | 44 | { |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Ticket constructor. |
|
| 48 | - * |
|
| 49 | - * @param EEM_Ticket $ticket_model |
|
| 50 | - */ |
|
| 51 | - public function __construct(EEM_Ticket $ticket_model) |
|
| 52 | - { |
|
| 53 | - $this->model = $ticket_model; |
|
| 54 | - $this->setName('Ticket'); |
|
| 55 | - $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
|
| 56 | - $this->setIsCustomPostType(false); |
|
| 57 | - $this->setFields([ |
|
| 58 | - 'id' => [ |
|
| 59 | - 'type' => [ |
|
| 60 | - 'non_null' => 'Int', |
|
| 61 | - ], |
|
| 62 | - 'description' => __('Ticket ID', 'event_espresso'), |
|
| 63 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 64 | - return $this->resolveField($ticket, 'ID'); |
|
| 65 | - }, |
|
| 66 | - ], |
|
| 67 | - 'name' => [ |
|
| 68 | - 'type' => 'String', |
|
| 69 | - 'description' => __('Ticket Name', 'event_espresso'), |
|
| 70 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 71 | - return $this->resolveField($ticket, 'name'); |
|
| 72 | - }, |
|
| 73 | - ], |
|
| 74 | - 'description' => [ |
|
| 75 | - 'type' => 'String', |
|
| 76 | - 'description' => __('Description of Ticket', 'event_espresso'), |
|
| 77 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 78 | - return $this->resolveField($ticket, 'description'); |
|
| 79 | - }, |
|
| 80 | - ], |
|
| 81 | - 'startDate' => [ |
|
| 82 | - 'type' => 'String', |
|
| 83 | - 'description' => __('Start time/date of Ticket', 'event_espresso'), |
|
| 84 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 85 | - return $this->resolveField($ticket, 'start_date'); |
|
| 86 | - }, |
|
| 87 | - ], |
|
| 88 | - 'endDate' => [ |
|
| 89 | - 'type' => 'String', |
|
| 90 | - 'description' => __('End time/date of Ticket', 'event_espresso'), |
|
| 91 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 92 | - return $this->resolveField($ticket, 'end_date'); |
|
| 93 | - }, |
|
| 94 | - ], |
|
| 95 | - 'min' => [ |
|
| 96 | - 'type' => 'Int', |
|
| 97 | - 'description' => __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), |
|
| 98 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 99 | - return $this->resolveField($ticket, 'min'); |
|
| 100 | - }, |
|
| 101 | - ], |
|
| 102 | - 'max' => [ |
|
| 103 | - 'type' => 'Int', |
|
| 104 | - 'description' => __('Maximum quantity of this ticket that can be purchased in one transaction', |
|
| 105 | - 'event_espresso'), |
|
| 106 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 107 | - $max = $ticket instanceof EE_Ticket ? $ticket->max() : EE_INF; |
|
| 108 | - return $this->parseInfiniteValue($max); |
|
| 109 | - }, |
|
| 110 | - ], |
|
| 111 | - 'price' => [ |
|
| 112 | - 'type' => 'Float', |
|
| 113 | - 'description' => __('Final calculated price for ticket', 'event_espresso'), |
|
| 114 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 115 | - return $this->resolveField($ticket, 'price'); |
|
| 116 | - }, |
|
| 117 | - ], |
|
| 118 | - 'sold' => [ |
|
| 119 | - 'type' => 'Int', |
|
| 120 | - 'description' => __('Number of this ticket sold', 'event_espresso'), |
|
| 121 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 122 | - return $this->resolveField($ticket, 'sold'); |
|
| 123 | - }, |
|
| 124 | - ], |
|
| 125 | - 'quantity' => [ |
|
| 126 | - 'type' => 'Int', |
|
| 127 | - 'description' => __('Quantity of this ticket that is available', 'event_espresso'), |
|
| 128 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 129 | - $qty = $ticket instanceof EE_Ticket ? $ticket->qty() : EE_INF; |
|
| 130 | - return $this->parseInfiniteValue($qty); |
|
| 131 | - }, |
|
| 132 | - ], |
|
| 133 | - 'reserved' => [ |
|
| 134 | - 'type' => 'Int', |
|
| 135 | - 'description' => __('Quantity of this ticket that is reserved, but not yet fully purchased', |
|
| 136 | - 'event_espresso'), |
|
| 137 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 138 | - return $this->resolveField($ticket, 'reserved'); |
|
| 139 | - }, |
|
| 140 | - ], |
|
| 141 | - 'uses' => [ |
|
| 142 | - 'type' => 'Int', |
|
| 143 | - 'description' => __('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
| 144 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 145 | - $uses = $ticket instanceof EE_Ticket ? $ticket->uses() : EE_INF; |
|
| 146 | - return $this->parseInfiniteValue($uses); |
|
| 147 | - }, |
|
| 148 | - ], |
|
| 149 | - 'isRequired' => [ |
|
| 150 | - 'type' => 'Boolean', |
|
| 151 | - 'description' => __('Flag indicating whether this ticket must be purchased with a transaction', |
|
| 152 | - 'event_espresso'), |
|
| 153 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 154 | - return $this->resolveField($ticket, 'required'); |
|
| 155 | - }, |
|
| 156 | - ], |
|
| 157 | - 'isTaxable' => [ |
|
| 158 | - 'type' => 'Boolean', |
|
| 159 | - 'description' => __('Flag indicating whether there is tax applied on this ticket', |
|
| 160 | - 'event_espresso'), |
|
| 161 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 162 | - return $this->resolveField($ticket, 'taxable'); |
|
| 163 | - }, |
|
| 164 | - ], |
|
| 165 | - 'isDefault' => [ |
|
| 166 | - 'type' => 'Boolean', |
|
| 167 | - 'description' => __('Flag indicating that this ticket is a default ticket', 'event_espresso'), |
|
| 168 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 169 | - return $this->resolveField($ticket, 'is_default'); |
|
| 170 | - }, |
|
| 171 | - ], |
|
| 172 | - 'order' => [ |
|
| 173 | - 'type' => 'Int', |
|
| 174 | - 'description' => __('The order in which the Datetime is displayed', 'event_espresso'), |
|
| 175 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 176 | - return $this->resolveField($ticket, 'order'); |
|
| 177 | - }, |
|
| 178 | - ], |
|
| 179 | - 'row' => [ |
|
| 180 | - 'type' => 'Int', |
|
| 181 | - 'description' => __('How tickets are displayed in the ui', 'event_espresso'), |
|
| 182 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 183 | - return $this->resolveField($ticket, 'row'); |
|
| 184 | - }, |
|
| 185 | - ], |
|
| 186 | - 'wpUser' => [ |
|
| 187 | - 'type' => 'User', |
|
| 188 | - 'description' => __('Ticket Creator ID', 'event_espresso'), |
|
| 189 | - 'resolve' => function (EE_Ticket $ticket, $args, $context) { |
|
| 190 | - return $this->resolveWpUser($ticket, $args, $context); |
|
| 191 | - }, |
|
| 192 | - ], |
|
| 193 | - 'parent' => [ |
|
| 194 | - 'type' => 'Ticket', |
|
| 195 | - 'description' => __('The parent ticket of the current ticket', 'event_espresso'), |
|
| 196 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 197 | - return $this->resolveParent($ticket); |
|
| 198 | - }, |
|
| 199 | - ], |
|
| 200 | - 'reverseCalculate' => [ |
|
| 201 | - 'type' => 'Boolean', |
|
| 202 | - 'description' => __('Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', |
|
| 203 | - 'event_espresso'), |
|
| 204 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 205 | - return $this->resolveField($ticket, 'reverse_calculate'); |
|
| 206 | - }, |
|
| 207 | - ], |
|
| 208 | - 'isFree' => [ |
|
| 209 | - 'type' => 'Boolean', |
|
| 210 | - 'description' => __('Flag indicating whether the ticket is free.', 'event_espresso'), |
|
| 211 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 212 | - return $this->resolveField($ticket, 'is_free'); |
|
| 213 | - }, |
|
| 214 | - ], |
|
| 215 | - ] ); |
|
| 216 | - } |
|
| 46 | + /** |
|
| 47 | + * Ticket constructor. |
|
| 48 | + * |
|
| 49 | + * @param EEM_Ticket $ticket_model |
|
| 50 | + */ |
|
| 51 | + public function __construct(EEM_Ticket $ticket_model) |
|
| 52 | + { |
|
| 53 | + $this->model = $ticket_model; |
|
| 54 | + $this->setName('Ticket'); |
|
| 55 | + $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
|
| 56 | + $this->setIsCustomPostType(false); |
|
| 57 | + $this->setFields([ |
|
| 58 | + 'id' => [ |
|
| 59 | + 'type' => [ |
|
| 60 | + 'non_null' => 'Int', |
|
| 61 | + ], |
|
| 62 | + 'description' => __('Ticket ID', 'event_espresso'), |
|
| 63 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 64 | + return $this->resolveField($ticket, 'ID'); |
|
| 65 | + }, |
|
| 66 | + ], |
|
| 67 | + 'name' => [ |
|
| 68 | + 'type' => 'String', |
|
| 69 | + 'description' => __('Ticket Name', 'event_espresso'), |
|
| 70 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 71 | + return $this->resolveField($ticket, 'name'); |
|
| 72 | + }, |
|
| 73 | + ], |
|
| 74 | + 'description' => [ |
|
| 75 | + 'type' => 'String', |
|
| 76 | + 'description' => __('Description of Ticket', 'event_espresso'), |
|
| 77 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 78 | + return $this->resolveField($ticket, 'description'); |
|
| 79 | + }, |
|
| 80 | + ], |
|
| 81 | + 'startDate' => [ |
|
| 82 | + 'type' => 'String', |
|
| 83 | + 'description' => __('Start time/date of Ticket', 'event_espresso'), |
|
| 84 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 85 | + return $this->resolveField($ticket, 'start_date'); |
|
| 86 | + }, |
|
| 87 | + ], |
|
| 88 | + 'endDate' => [ |
|
| 89 | + 'type' => 'String', |
|
| 90 | + 'description' => __('End time/date of Ticket', 'event_espresso'), |
|
| 91 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 92 | + return $this->resolveField($ticket, 'end_date'); |
|
| 93 | + }, |
|
| 94 | + ], |
|
| 95 | + 'min' => [ |
|
| 96 | + 'type' => 'Int', |
|
| 97 | + 'description' => __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), |
|
| 98 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 99 | + return $this->resolveField($ticket, 'min'); |
|
| 100 | + }, |
|
| 101 | + ], |
|
| 102 | + 'max' => [ |
|
| 103 | + 'type' => 'Int', |
|
| 104 | + 'description' => __('Maximum quantity of this ticket that can be purchased in one transaction', |
|
| 105 | + 'event_espresso'), |
|
| 106 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 107 | + $max = $ticket instanceof EE_Ticket ? $ticket->max() : EE_INF; |
|
| 108 | + return $this->parseInfiniteValue($max); |
|
| 109 | + }, |
|
| 110 | + ], |
|
| 111 | + 'price' => [ |
|
| 112 | + 'type' => 'Float', |
|
| 113 | + 'description' => __('Final calculated price for ticket', 'event_espresso'), |
|
| 114 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 115 | + return $this->resolveField($ticket, 'price'); |
|
| 116 | + }, |
|
| 117 | + ], |
|
| 118 | + 'sold' => [ |
|
| 119 | + 'type' => 'Int', |
|
| 120 | + 'description' => __('Number of this ticket sold', 'event_espresso'), |
|
| 121 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 122 | + return $this->resolveField($ticket, 'sold'); |
|
| 123 | + }, |
|
| 124 | + ], |
|
| 125 | + 'quantity' => [ |
|
| 126 | + 'type' => 'Int', |
|
| 127 | + 'description' => __('Quantity of this ticket that is available', 'event_espresso'), |
|
| 128 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 129 | + $qty = $ticket instanceof EE_Ticket ? $ticket->qty() : EE_INF; |
|
| 130 | + return $this->parseInfiniteValue($qty); |
|
| 131 | + }, |
|
| 132 | + ], |
|
| 133 | + 'reserved' => [ |
|
| 134 | + 'type' => 'Int', |
|
| 135 | + 'description' => __('Quantity of this ticket that is reserved, but not yet fully purchased', |
|
| 136 | + 'event_espresso'), |
|
| 137 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 138 | + return $this->resolveField($ticket, 'reserved'); |
|
| 139 | + }, |
|
| 140 | + ], |
|
| 141 | + 'uses' => [ |
|
| 142 | + 'type' => 'Int', |
|
| 143 | + 'description' => __('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
| 144 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 145 | + $uses = $ticket instanceof EE_Ticket ? $ticket->uses() : EE_INF; |
|
| 146 | + return $this->parseInfiniteValue($uses); |
|
| 147 | + }, |
|
| 148 | + ], |
|
| 149 | + 'isRequired' => [ |
|
| 150 | + 'type' => 'Boolean', |
|
| 151 | + 'description' => __('Flag indicating whether this ticket must be purchased with a transaction', |
|
| 152 | + 'event_espresso'), |
|
| 153 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 154 | + return $this->resolveField($ticket, 'required'); |
|
| 155 | + }, |
|
| 156 | + ], |
|
| 157 | + 'isTaxable' => [ |
|
| 158 | + 'type' => 'Boolean', |
|
| 159 | + 'description' => __('Flag indicating whether there is tax applied on this ticket', |
|
| 160 | + 'event_espresso'), |
|
| 161 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 162 | + return $this->resolveField($ticket, 'taxable'); |
|
| 163 | + }, |
|
| 164 | + ], |
|
| 165 | + 'isDefault' => [ |
|
| 166 | + 'type' => 'Boolean', |
|
| 167 | + 'description' => __('Flag indicating that this ticket is a default ticket', 'event_espresso'), |
|
| 168 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 169 | + return $this->resolveField($ticket, 'is_default'); |
|
| 170 | + }, |
|
| 171 | + ], |
|
| 172 | + 'order' => [ |
|
| 173 | + 'type' => 'Int', |
|
| 174 | + 'description' => __('The order in which the Datetime is displayed', 'event_espresso'), |
|
| 175 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 176 | + return $this->resolveField($ticket, 'order'); |
|
| 177 | + }, |
|
| 178 | + ], |
|
| 179 | + 'row' => [ |
|
| 180 | + 'type' => 'Int', |
|
| 181 | + 'description' => __('How tickets are displayed in the ui', 'event_espresso'), |
|
| 182 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 183 | + return $this->resolveField($ticket, 'row'); |
|
| 184 | + }, |
|
| 185 | + ], |
|
| 186 | + 'wpUser' => [ |
|
| 187 | + 'type' => 'User', |
|
| 188 | + 'description' => __('Ticket Creator ID', 'event_espresso'), |
|
| 189 | + 'resolve' => function (EE_Ticket $ticket, $args, $context) { |
|
| 190 | + return $this->resolveWpUser($ticket, $args, $context); |
|
| 191 | + }, |
|
| 192 | + ], |
|
| 193 | + 'parent' => [ |
|
| 194 | + 'type' => 'Ticket', |
|
| 195 | + 'description' => __('The parent ticket of the current ticket', 'event_espresso'), |
|
| 196 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 197 | + return $this->resolveParent($ticket); |
|
| 198 | + }, |
|
| 199 | + ], |
|
| 200 | + 'reverseCalculate' => [ |
|
| 201 | + 'type' => 'Boolean', |
|
| 202 | + 'description' => __('Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', |
|
| 203 | + 'event_espresso'), |
|
| 204 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 205 | + return $this->resolveField($ticket, 'reverse_calculate'); |
|
| 206 | + }, |
|
| 207 | + ], |
|
| 208 | + 'isFree' => [ |
|
| 209 | + 'type' => 'Boolean', |
|
| 210 | + 'description' => __('Flag indicating whether the ticket is free.', 'event_espresso'), |
|
| 211 | + 'resolve' => function (EE_Ticket $ticket) { |
|
| 212 | + return $this->resolveField($ticket, 'is_free'); |
|
| 213 | + }, |
|
| 214 | + ], |
|
| 215 | + ] ); |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | 218 | |
| 219 | - /** |
|
| 220 | - * @param EE_Ticket $ticket |
|
| 221 | - * @param mixed $field |
|
| 222 | - * @return string |
|
| 223 | - * @since $VID:$ |
|
| 224 | - */ |
|
| 225 | - public function resolveField(EE_Ticket $ticket, $field) |
|
| 226 | - { |
|
| 227 | - return $ticket instanceof EE_Ticket ? $ticket->{$field}() : null; |
|
| 228 | - } |
|
| 219 | + /** |
|
| 220 | + * @param EE_Ticket $ticket |
|
| 221 | + * @param mixed $field |
|
| 222 | + * @return string |
|
| 223 | + * @since $VID:$ |
|
| 224 | + */ |
|
| 225 | + public function resolveField(EE_Ticket $ticket, $field) |
|
| 226 | + { |
|
| 227 | + return $ticket instanceof EE_Ticket ? $ticket->{$field}() : null; |
|
| 228 | + } |
|
| 229 | 229 | } |
| 230 | 230 | \ No newline at end of file |
@@ -60,42 +60,42 @@ discard block |
||
| 60 | 60 | 'non_null' => 'Int', |
| 61 | 61 | ], |
| 62 | 62 | 'description' => __('Ticket ID', 'event_espresso'), |
| 63 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 63 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 64 | 64 | return $this->resolveField($ticket, 'ID'); |
| 65 | 65 | }, |
| 66 | 66 | ], |
| 67 | 67 | 'name' => [ |
| 68 | 68 | 'type' => 'String', |
| 69 | 69 | 'description' => __('Ticket Name', 'event_espresso'), |
| 70 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 70 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 71 | 71 | return $this->resolveField($ticket, 'name'); |
| 72 | 72 | }, |
| 73 | 73 | ], |
| 74 | 74 | 'description' => [ |
| 75 | 75 | 'type' => 'String', |
| 76 | 76 | 'description' => __('Description of Ticket', 'event_espresso'), |
| 77 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 77 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 78 | 78 | return $this->resolveField($ticket, 'description'); |
| 79 | 79 | }, |
| 80 | 80 | ], |
| 81 | 81 | 'startDate' => [ |
| 82 | 82 | 'type' => 'String', |
| 83 | 83 | 'description' => __('Start time/date of Ticket', 'event_espresso'), |
| 84 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 84 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 85 | 85 | return $this->resolveField($ticket, 'start_date'); |
| 86 | 86 | }, |
| 87 | 87 | ], |
| 88 | 88 | 'endDate' => [ |
| 89 | 89 | 'type' => 'String', |
| 90 | 90 | 'description' => __('End time/date of Ticket', 'event_espresso'), |
| 91 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 91 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 92 | 92 | return $this->resolveField($ticket, 'end_date'); |
| 93 | 93 | }, |
| 94 | 94 | ], |
| 95 | 95 | 'min' => [ |
| 96 | 96 | 'type' => 'Int', |
| 97 | 97 | 'description' => __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), |
| 98 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 98 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 99 | 99 | return $this->resolveField($ticket, 'min'); |
| 100 | 100 | }, |
| 101 | 101 | ], |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | 'type' => 'Int', |
| 104 | 104 | 'description' => __('Maximum quantity of this ticket that can be purchased in one transaction', |
| 105 | 105 | 'event_espresso'), |
| 106 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 106 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 107 | 107 | $max = $ticket instanceof EE_Ticket ? $ticket->max() : EE_INF; |
| 108 | 108 | return $this->parseInfiniteValue($max); |
| 109 | 109 | }, |
@@ -111,21 +111,21 @@ discard block |
||
| 111 | 111 | 'price' => [ |
| 112 | 112 | 'type' => 'Float', |
| 113 | 113 | 'description' => __('Final calculated price for ticket', 'event_espresso'), |
| 114 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 114 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 115 | 115 | return $this->resolveField($ticket, 'price'); |
| 116 | 116 | }, |
| 117 | 117 | ], |
| 118 | 118 | 'sold' => [ |
| 119 | 119 | 'type' => 'Int', |
| 120 | 120 | 'description' => __('Number of this ticket sold', 'event_espresso'), |
| 121 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 121 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 122 | 122 | return $this->resolveField($ticket, 'sold'); |
| 123 | 123 | }, |
| 124 | 124 | ], |
| 125 | 125 | 'quantity' => [ |
| 126 | 126 | 'type' => 'Int', |
| 127 | 127 | 'description' => __('Quantity of this ticket that is available', 'event_espresso'), |
| 128 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 128 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 129 | 129 | $qty = $ticket instanceof EE_Ticket ? $ticket->qty() : EE_INF; |
| 130 | 130 | return $this->parseInfiniteValue($qty); |
| 131 | 131 | }, |
@@ -134,14 +134,14 @@ discard block |
||
| 134 | 134 | 'type' => 'Int', |
| 135 | 135 | 'description' => __('Quantity of this ticket that is reserved, but not yet fully purchased', |
| 136 | 136 | 'event_espresso'), |
| 137 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 137 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 138 | 138 | return $this->resolveField($ticket, 'reserved'); |
| 139 | 139 | }, |
| 140 | 140 | ], |
| 141 | 141 | 'uses' => [ |
| 142 | 142 | 'type' => 'Int', |
| 143 | 143 | 'description' => __('Number of datetimes this ticket can be used at', 'event_espresso'), |
| 144 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 144 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 145 | 145 | $uses = $ticket instanceof EE_Ticket ? $ticket->uses() : EE_INF; |
| 146 | 146 | return $this->parseInfiniteValue($uses); |
| 147 | 147 | }, |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | 'type' => 'Boolean', |
| 151 | 151 | 'description' => __('Flag indicating whether this ticket must be purchased with a transaction', |
| 152 | 152 | 'event_espresso'), |
| 153 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 153 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 154 | 154 | return $this->resolveField($ticket, 'required'); |
| 155 | 155 | }, |
| 156 | 156 | ], |
@@ -158,42 +158,42 @@ discard block |
||
| 158 | 158 | 'type' => 'Boolean', |
| 159 | 159 | 'description' => __('Flag indicating whether there is tax applied on this ticket', |
| 160 | 160 | 'event_espresso'), |
| 161 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 161 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 162 | 162 | return $this->resolveField($ticket, 'taxable'); |
| 163 | 163 | }, |
| 164 | 164 | ], |
| 165 | 165 | 'isDefault' => [ |
| 166 | 166 | 'type' => 'Boolean', |
| 167 | 167 | 'description' => __('Flag indicating that this ticket is a default ticket', 'event_espresso'), |
| 168 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 168 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 169 | 169 | return $this->resolveField($ticket, 'is_default'); |
| 170 | 170 | }, |
| 171 | 171 | ], |
| 172 | 172 | 'order' => [ |
| 173 | 173 | 'type' => 'Int', |
| 174 | 174 | 'description' => __('The order in which the Datetime is displayed', 'event_espresso'), |
| 175 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 175 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 176 | 176 | return $this->resolveField($ticket, 'order'); |
| 177 | 177 | }, |
| 178 | 178 | ], |
| 179 | 179 | 'row' => [ |
| 180 | 180 | 'type' => 'Int', |
| 181 | 181 | 'description' => __('How tickets are displayed in the ui', 'event_espresso'), |
| 182 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 182 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 183 | 183 | return $this->resolveField($ticket, 'row'); |
| 184 | 184 | }, |
| 185 | 185 | ], |
| 186 | 186 | 'wpUser' => [ |
| 187 | 187 | 'type' => 'User', |
| 188 | 188 | 'description' => __('Ticket Creator ID', 'event_espresso'), |
| 189 | - 'resolve' => function (EE_Ticket $ticket, $args, $context) { |
|
| 189 | + 'resolve' => function(EE_Ticket $ticket, $args, $context) { |
|
| 190 | 190 | return $this->resolveWpUser($ticket, $args, $context); |
| 191 | 191 | }, |
| 192 | 192 | ], |
| 193 | 193 | 'parent' => [ |
| 194 | 194 | 'type' => 'Ticket', |
| 195 | 195 | 'description' => __('The parent ticket of the current ticket', 'event_espresso'), |
| 196 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 196 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 197 | 197 | return $this->resolveParent($ticket); |
| 198 | 198 | }, |
| 199 | 199 | ], |
@@ -201,18 +201,18 @@ discard block |
||
| 201 | 201 | 'type' => 'Boolean', |
| 202 | 202 | 'description' => __('Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', |
| 203 | 203 | 'event_espresso'), |
| 204 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 204 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 205 | 205 | return $this->resolveField($ticket, 'reverse_calculate'); |
| 206 | 206 | }, |
| 207 | 207 | ], |
| 208 | 208 | 'isFree' => [ |
| 209 | 209 | 'type' => 'Boolean', |
| 210 | 210 | 'description' => __('Flag indicating whether the ticket is free.', 'event_espresso'), |
| 211 | - 'resolve' => function (EE_Ticket $ticket) { |
|
| 211 | + 'resolve' => function(EE_Ticket $ticket) { |
|
| 212 | 212 | return $this->resolveField($ticket, 'is_free'); |
| 213 | 213 | }, |
| 214 | 214 | ], |
| 215 | - ] ); |
|
| 215 | + ]); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | 256 | * @param Post|EE_Venue $source The source instance. |
| 257 | - * @return int |
|
| 257 | + * @return EE_Base_Class|null |
|
| 258 | 258 | * @since $VID:$ |
| 259 | 259 | */ |
| 260 | 260 | public function resolveState($source) |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | 272 | * @param Post|EE_Venue $source The source instance. |
| 273 | - * @return int |
|
| 273 | + * @return EE_Base_Class|null |
|
| 274 | 274 | * @since $VID:$ |
| 275 | 275 | */ |
| 276 | 276 | public function resolveCountry($source) |
@@ -39,247 +39,247 @@ |
||
| 39 | 39 | class Venue extends TypeBase |
| 40 | 40 | { |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Venue constructor. |
|
| 44 | - * |
|
| 45 | - * @param EEM_Venue $venue_model |
|
| 46 | - */ |
|
| 47 | - public function __construct(EEM_Venue $venue_model) |
|
| 48 | - { |
|
| 49 | - $this->model = $venue_model; |
|
| 50 | - $this->setName('Venue'); |
|
| 51 | - $this->setIsCustomPostType(true); |
|
| 52 | - $this->setFields([ |
|
| 53 | - 'name' => [ |
|
| 54 | - 'type' => 'String', |
|
| 55 | - 'description' => __('Venue Name', 'event_espresso'), |
|
| 56 | - 'resolve' => function ($source) { |
|
| 57 | - return $this->resolveField($source, 'name'); |
|
| 58 | - }, |
|
| 59 | - ], |
|
| 60 | - 'desc' => [ |
|
| 61 | - 'type' => 'String', |
|
| 62 | - 'description' => __('Venue Description', 'event_espresso'), |
|
| 63 | - 'resolve' => function ($source) { |
|
| 64 | - return $this->resolveField($source, 'description'); |
|
| 65 | - }, |
|
| 66 | - ], |
|
| 67 | - 'shortDesc' => [ |
|
| 68 | - 'type' => 'String', |
|
| 69 | - 'description' => __('Short Description of Venue', 'event_espresso'), |
|
| 70 | - 'resolve' => function ($source) { |
|
| 71 | - return $this->resolveField($source, 'excerpt'); |
|
| 72 | - }, |
|
| 73 | - ], |
|
| 74 | - 'identifier' => [ |
|
| 75 | - 'type' => 'String', |
|
| 76 | - 'description' => __('Venue Identifier', 'event_espresso'), |
|
| 77 | - 'resolve' => function ($source) { |
|
| 78 | - return $this->resolveField($source, 'identifier'); |
|
| 79 | - }, |
|
| 80 | - ], |
|
| 81 | - 'created' => [ |
|
| 82 | - 'type' => 'String', |
|
| 83 | - 'description' => __('Date Venue Created', 'event_espresso'), |
|
| 84 | - 'resolve' => function ($source) { |
|
| 85 | - return $this->resolveField($source, 'created'); |
|
| 86 | - }, |
|
| 87 | - ], |
|
| 88 | - // Already registered |
|
| 89 | - /* 'modified' => [ |
|
| 42 | + /** |
|
| 43 | + * Venue constructor. |
|
| 44 | + * |
|
| 45 | + * @param EEM_Venue $venue_model |
|
| 46 | + */ |
|
| 47 | + public function __construct(EEM_Venue $venue_model) |
|
| 48 | + { |
|
| 49 | + $this->model = $venue_model; |
|
| 50 | + $this->setName('Venue'); |
|
| 51 | + $this->setIsCustomPostType(true); |
|
| 52 | + $this->setFields([ |
|
| 53 | + 'name' => [ |
|
| 54 | + 'type' => 'String', |
|
| 55 | + 'description' => __('Venue Name', 'event_espresso'), |
|
| 56 | + 'resolve' => function ($source) { |
|
| 57 | + return $this->resolveField($source, 'name'); |
|
| 58 | + }, |
|
| 59 | + ], |
|
| 60 | + 'desc' => [ |
|
| 61 | + 'type' => 'String', |
|
| 62 | + 'description' => __('Venue Description', 'event_espresso'), |
|
| 63 | + 'resolve' => function ($source) { |
|
| 64 | + return $this->resolveField($source, 'description'); |
|
| 65 | + }, |
|
| 66 | + ], |
|
| 67 | + 'shortDesc' => [ |
|
| 68 | + 'type' => 'String', |
|
| 69 | + 'description' => __('Short Description of Venue', 'event_espresso'), |
|
| 70 | + 'resolve' => function ($source) { |
|
| 71 | + return $this->resolveField($source, 'excerpt'); |
|
| 72 | + }, |
|
| 73 | + ], |
|
| 74 | + 'identifier' => [ |
|
| 75 | + 'type' => 'String', |
|
| 76 | + 'description' => __('Venue Identifier', 'event_espresso'), |
|
| 77 | + 'resolve' => function ($source) { |
|
| 78 | + return $this->resolveField($source, 'identifier'); |
|
| 79 | + }, |
|
| 80 | + ], |
|
| 81 | + 'created' => [ |
|
| 82 | + 'type' => 'String', |
|
| 83 | + 'description' => __('Date Venue Created', 'event_espresso'), |
|
| 84 | + 'resolve' => function ($source) { |
|
| 85 | + return $this->resolveField($source, 'created'); |
|
| 86 | + }, |
|
| 87 | + ], |
|
| 88 | + // Already registered |
|
| 89 | + /* 'modified' => [ |
|
| 90 | 90 | 'type' => 'String', |
| 91 | 91 | 'description' => __('Venue Modified Date', 'event_espresso'), |
| 92 | 92 | ], */ |
| 93 | - 'order' => [ |
|
| 94 | - 'type' => 'Int', |
|
| 95 | - 'description' => __('Venue order', 'event_espresso'), |
|
| 96 | - 'resolve' => function ($source) { |
|
| 97 | - return $this->resolveField($source, 'order'); |
|
| 98 | - }, |
|
| 99 | - ], |
|
| 100 | - 'wpUser' => [ |
|
| 101 | - 'type' => 'User', |
|
| 102 | - 'description' => __('Venue Creator', 'event_espresso'), |
|
| 103 | - 'resolve' => function ($source, $args, $context) { |
|
| 104 | - return $this->resolveWpUser($source, $args, $context); |
|
| 105 | - }, |
|
| 106 | - ], |
|
| 107 | - // Already registered |
|
| 108 | - /* 'parent' => [ |
|
| 93 | + 'order' => [ |
|
| 94 | + 'type' => 'Int', |
|
| 95 | + 'description' => __('Venue order', 'event_espresso'), |
|
| 96 | + 'resolve' => function ($source) { |
|
| 97 | + return $this->resolveField($source, 'order'); |
|
| 98 | + }, |
|
| 99 | + ], |
|
| 100 | + 'wpUser' => [ |
|
| 101 | + 'type' => 'User', |
|
| 102 | + 'description' => __('Venue Creator', 'event_espresso'), |
|
| 103 | + 'resolve' => function ($source, $args, $context) { |
|
| 104 | + return $this->resolveWpUser($source, $args, $context); |
|
| 105 | + }, |
|
| 106 | + ], |
|
| 107 | + // Already registered |
|
| 108 | + /* 'parent' => [ |
|
| 109 | 109 | 'type' => 'Venue', |
| 110 | 110 | 'description' => __('Venue Parent ID', 'event_espresso'), |
| 111 | 111 | ], */ |
| 112 | - 'address' => [ |
|
| 113 | - 'type' => 'String', |
|
| 114 | - 'description' => __('Venue Address line 1', 'event_espresso'), |
|
| 115 | - 'resolve' => function ($source) { |
|
| 116 | - return $this->resolveField($source, 'address'); |
|
| 117 | - }, |
|
| 118 | - ], |
|
| 119 | - 'address2' => [ |
|
| 120 | - 'type' => 'String', |
|
| 121 | - 'description' => __('Venue Address line 2', 'event_espresso'), |
|
| 122 | - 'resolve' => function ($source) { |
|
| 123 | - return $this->resolveField($source, 'address2'); |
|
| 124 | - }, |
|
| 125 | - ], |
|
| 126 | - 'city' => [ |
|
| 127 | - 'type' => 'String', |
|
| 128 | - 'description' => __('Venue City', 'event_espresso'), |
|
| 129 | - 'resolve' => function ($source) { |
|
| 130 | - return $this->resolveField($source, 'city'); |
|
| 131 | - }, |
|
| 132 | - ], |
|
| 133 | - 'state' => [ |
|
| 134 | - 'type' => 'State', |
|
| 135 | - 'description' => __('Venue state', 'event_espresso'), |
|
| 136 | - 'resolve' => function ($source) { |
|
| 137 | - return $this->resolveState($source); |
|
| 138 | - }, |
|
| 139 | - ], |
|
| 140 | - 'country' => [ |
|
| 141 | - 'type' => 'Country', |
|
| 142 | - 'description' => __('Venue country', 'event_espresso'), |
|
| 143 | - 'resolve' => function ($source) { |
|
| 144 | - return $this->resolveCountry($source); |
|
| 145 | - }, |
|
| 146 | - ], |
|
| 147 | - 'zip' => [ |
|
| 148 | - 'type' => 'String', |
|
| 149 | - 'description' => __('Venue Zip/Postal Code', 'event_espresso'), |
|
| 150 | - 'resolve' => function ($source) { |
|
| 151 | - return $this->resolveField($source, 'zip'); |
|
| 152 | - }, |
|
| 153 | - ], |
|
| 154 | - 'capacity' => [ |
|
| 155 | - 'type' => 'Int', |
|
| 156 | - 'description' => __('Venue Capacity', 'event_espresso'), |
|
| 157 | - 'resolve' => function ($source) { |
|
| 158 | - return $this->resolveCapacity($source); |
|
| 159 | - }, |
|
| 160 | - ], |
|
| 161 | - 'phone' => [ |
|
| 162 | - 'type' => 'String', |
|
| 163 | - 'description' => __('Venue Phone', 'event_espresso'), |
|
| 164 | - 'resolve' => function ($source) { |
|
| 165 | - return $this->resolveField($source, 'phone'); |
|
| 166 | - }, |
|
| 167 | - ], |
|
| 168 | - 'virtualPhone' => [ |
|
| 169 | - 'type' => 'String', |
|
| 170 | - 'description' => __('Call in Number', 'event_espresso'), |
|
| 171 | - 'resolve' => function ($source) { |
|
| 172 | - return $this->resolveField($source, 'virtual_phone'); |
|
| 173 | - }, |
|
| 174 | - ], |
|
| 175 | - 'url' => [ |
|
| 176 | - 'type' => 'String', |
|
| 177 | - 'description' => __('Venue Website', 'event_espresso'), |
|
| 178 | - 'resolve' => function ($source) { |
|
| 179 | - return $this->resolveField($source, 'venue_url'); |
|
| 180 | - }, |
|
| 181 | - ], |
|
| 182 | - 'virtualUrl' => [ |
|
| 183 | - 'type' => 'String', |
|
| 184 | - 'description' => __('Virtual URL', 'event_espresso'), |
|
| 185 | - 'resolve' => function ($source) { |
|
| 186 | - return $this->resolveField($source, 'virtual_url'); |
|
| 187 | - }, |
|
| 188 | - ], |
|
| 189 | - 'googleMapLink' => [ |
|
| 190 | - 'type' => 'String', |
|
| 191 | - 'description' => __('Google Map Link', 'event_espresso'), |
|
| 192 | - 'resolve' => function ($source) { |
|
| 193 | - return $this->resolveField($source, 'google_map_link'); |
|
| 194 | - }, |
|
| 195 | - ], |
|
| 196 | - 'enableForGmap' => [ |
|
| 197 | - 'type' => 'String', |
|
| 198 | - 'description' => __('Show Google Map?', 'event_espresso'), |
|
| 199 | - 'resolve' => function ($source) { |
|
| 200 | - return $this->resolveField($source, 'enable_for_gmap'); |
|
| 201 | - }, |
|
| 202 | - ], |
|
| 203 | - ] ); |
|
| 204 | - } |
|
| 112 | + 'address' => [ |
|
| 113 | + 'type' => 'String', |
|
| 114 | + 'description' => __('Venue Address line 1', 'event_espresso'), |
|
| 115 | + 'resolve' => function ($source) { |
|
| 116 | + return $this->resolveField($source, 'address'); |
|
| 117 | + }, |
|
| 118 | + ], |
|
| 119 | + 'address2' => [ |
|
| 120 | + 'type' => 'String', |
|
| 121 | + 'description' => __('Venue Address line 2', 'event_espresso'), |
|
| 122 | + 'resolve' => function ($source) { |
|
| 123 | + return $this->resolveField($source, 'address2'); |
|
| 124 | + }, |
|
| 125 | + ], |
|
| 126 | + 'city' => [ |
|
| 127 | + 'type' => 'String', |
|
| 128 | + 'description' => __('Venue City', 'event_espresso'), |
|
| 129 | + 'resolve' => function ($source) { |
|
| 130 | + return $this->resolveField($source, 'city'); |
|
| 131 | + }, |
|
| 132 | + ], |
|
| 133 | + 'state' => [ |
|
| 134 | + 'type' => 'State', |
|
| 135 | + 'description' => __('Venue state', 'event_espresso'), |
|
| 136 | + 'resolve' => function ($source) { |
|
| 137 | + return $this->resolveState($source); |
|
| 138 | + }, |
|
| 139 | + ], |
|
| 140 | + 'country' => [ |
|
| 141 | + 'type' => 'Country', |
|
| 142 | + 'description' => __('Venue country', 'event_espresso'), |
|
| 143 | + 'resolve' => function ($source) { |
|
| 144 | + return $this->resolveCountry($source); |
|
| 145 | + }, |
|
| 146 | + ], |
|
| 147 | + 'zip' => [ |
|
| 148 | + 'type' => 'String', |
|
| 149 | + 'description' => __('Venue Zip/Postal Code', 'event_espresso'), |
|
| 150 | + 'resolve' => function ($source) { |
|
| 151 | + return $this->resolveField($source, 'zip'); |
|
| 152 | + }, |
|
| 153 | + ], |
|
| 154 | + 'capacity' => [ |
|
| 155 | + 'type' => 'Int', |
|
| 156 | + 'description' => __('Venue Capacity', 'event_espresso'), |
|
| 157 | + 'resolve' => function ($source) { |
|
| 158 | + return $this->resolveCapacity($source); |
|
| 159 | + }, |
|
| 160 | + ], |
|
| 161 | + 'phone' => [ |
|
| 162 | + 'type' => 'String', |
|
| 163 | + 'description' => __('Venue Phone', 'event_espresso'), |
|
| 164 | + 'resolve' => function ($source) { |
|
| 165 | + return $this->resolveField($source, 'phone'); |
|
| 166 | + }, |
|
| 167 | + ], |
|
| 168 | + 'virtualPhone' => [ |
|
| 169 | + 'type' => 'String', |
|
| 170 | + 'description' => __('Call in Number', 'event_espresso'), |
|
| 171 | + 'resolve' => function ($source) { |
|
| 172 | + return $this->resolveField($source, 'virtual_phone'); |
|
| 173 | + }, |
|
| 174 | + ], |
|
| 175 | + 'url' => [ |
|
| 176 | + 'type' => 'String', |
|
| 177 | + 'description' => __('Venue Website', 'event_espresso'), |
|
| 178 | + 'resolve' => function ($source) { |
|
| 179 | + return $this->resolveField($source, 'venue_url'); |
|
| 180 | + }, |
|
| 181 | + ], |
|
| 182 | + 'virtualUrl' => [ |
|
| 183 | + 'type' => 'String', |
|
| 184 | + 'description' => __('Virtual URL', 'event_espresso'), |
|
| 185 | + 'resolve' => function ($source) { |
|
| 186 | + return $this->resolveField($source, 'virtual_url'); |
|
| 187 | + }, |
|
| 188 | + ], |
|
| 189 | + 'googleMapLink' => [ |
|
| 190 | + 'type' => 'String', |
|
| 191 | + 'description' => __('Google Map Link', 'event_espresso'), |
|
| 192 | + 'resolve' => function ($source) { |
|
| 193 | + return $this->resolveField($source, 'google_map_link'); |
|
| 194 | + }, |
|
| 195 | + ], |
|
| 196 | + 'enableForGmap' => [ |
|
| 197 | + 'type' => 'String', |
|
| 198 | + 'description' => __('Show Google Map?', 'event_espresso'), |
|
| 199 | + 'resolve' => function ($source) { |
|
| 200 | + return $this->resolveField($source, 'enable_for_gmap'); |
|
| 201 | + }, |
|
| 202 | + ], |
|
| 203 | + ] ); |
|
| 204 | + } |
|
| 205 | 205 | |
| 206 | 206 | |
| 207 | - /** |
|
| 208 | - * @param Post|EE_Venue $source |
|
| 209 | - * @return EE_Base_Class|EE_Venue|null |
|
| 210 | - * @since $VID:$ |
|
| 211 | - */ |
|
| 212 | - private function getVenue($source) |
|
| 213 | - { |
|
| 214 | - // If it comes from a custom connection |
|
| 215 | - // where the $source is already instantiated. |
|
| 216 | - if ($source instanceof EE_Venue) { |
|
| 217 | - return $source; |
|
| 218 | - } |
|
| 207 | + /** |
|
| 208 | + * @param Post|EE_Venue $source |
|
| 209 | + * @return EE_Base_Class|EE_Venue|null |
|
| 210 | + * @since $VID:$ |
|
| 211 | + */ |
|
| 212 | + private function getVenue($source) |
|
| 213 | + { |
|
| 214 | + // If it comes from a custom connection |
|
| 215 | + // where the $source is already instantiated. |
|
| 216 | + if ($source instanceof EE_Venue) { |
|
| 217 | + return $source; |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | - $id = $source instanceof Post ? $source->ID : 0; |
|
| 220 | + $id = $source instanceof Post ? $source->ID : 0; |
|
| 221 | 221 | |
| 222 | - if ($id) { |
|
| 223 | - return $this->model->get_one_by_ID($id); |
|
| 224 | - } |
|
| 225 | - return null; |
|
| 226 | - } |
|
| 222 | + if ($id) { |
|
| 223 | + return $this->model->get_one_by_ID($id); |
|
| 224 | + } |
|
| 225 | + return null; |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | 228 | |
| 229 | - /** |
|
| 230 | - * @param Post|EE_Venue $source The source instance. |
|
| 231 | - * @param string $field The field name. |
|
| 232 | - * @return mixed |
|
| 233 | - * @since $VID:$ |
|
| 234 | - */ |
|
| 235 | - public function resolveField($source, $field) |
|
| 236 | - { |
|
| 237 | - $venue = $this->getVenue($source); |
|
| 238 | - return $venue instanceof EE_Venue ? $venue->{$field}() : null; |
|
| 239 | - } |
|
| 229 | + /** |
|
| 230 | + * @param Post|EE_Venue $source The source instance. |
|
| 231 | + * @param string $field The field name. |
|
| 232 | + * @return mixed |
|
| 233 | + * @since $VID:$ |
|
| 234 | + */ |
|
| 235 | + public function resolveField($source, $field) |
|
| 236 | + { |
|
| 237 | + $venue = $this->getVenue($source); |
|
| 238 | + return $venue instanceof EE_Venue ? $venue->{$field}() : null; |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | 241 | |
| 242 | - /** |
|
| 243 | - * @param Post|EE_Venue $source The source instance. |
|
| 244 | - * @return int |
|
| 245 | - * @since $VID:$ |
|
| 246 | - */ |
|
| 247 | - public function resolveCapacity($source) |
|
| 248 | - { |
|
| 249 | - $venue = $this->getVenue($source); |
|
| 250 | - $capacity = $venue instanceof EE_Venue ? $venue->capacity() : EE_INF; |
|
| 251 | - return $this->parseInfiniteValue($capacity); |
|
| 252 | - } |
|
| 242 | + /** |
|
| 243 | + * @param Post|EE_Venue $source The source instance. |
|
| 244 | + * @return int |
|
| 245 | + * @since $VID:$ |
|
| 246 | + */ |
|
| 247 | + public function resolveCapacity($source) |
|
| 248 | + { |
|
| 249 | + $venue = $this->getVenue($source); |
|
| 250 | + $capacity = $venue instanceof EE_Venue ? $venue->capacity() : EE_INF; |
|
| 251 | + return $this->parseInfiniteValue($capacity); |
|
| 252 | + } |
|
| 253 | 253 | |
| 254 | 254 | |
| 255 | - /** |
|
| 256 | - * @param Post|EE_Venue $source The source instance. |
|
| 257 | - * @return int |
|
| 258 | - * @since $VID:$ |
|
| 259 | - */ |
|
| 260 | - public function resolveState($source) |
|
| 261 | - { |
|
| 262 | - $venue = $this->getVenue($source); |
|
| 263 | - $state_id = $venue instanceof EE_Venue ? $venue->state_ID() : 0; |
|
| 264 | - if ($state_id) { |
|
| 265 | - return EEM_State::instance()->get_one_by_ID($state_id); |
|
| 266 | - } |
|
| 267 | - return null; |
|
| 268 | - } |
|
| 255 | + /** |
|
| 256 | + * @param Post|EE_Venue $source The source instance. |
|
| 257 | + * @return int |
|
| 258 | + * @since $VID:$ |
|
| 259 | + */ |
|
| 260 | + public function resolveState($source) |
|
| 261 | + { |
|
| 262 | + $venue = $this->getVenue($source); |
|
| 263 | + $state_id = $venue instanceof EE_Venue ? $venue->state_ID() : 0; |
|
| 264 | + if ($state_id) { |
|
| 265 | + return EEM_State::instance()->get_one_by_ID($state_id); |
|
| 266 | + } |
|
| 267 | + return null; |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | 270 | |
| 271 | - /** |
|
| 272 | - * @param Post|EE_Venue $source The source instance. |
|
| 273 | - * @return int |
|
| 274 | - * @since $VID:$ |
|
| 275 | - */ |
|
| 276 | - public function resolveCountry($source) |
|
| 277 | - { |
|
| 278 | - $venue = $this->getVenue($source); |
|
| 279 | - $country_id = $venue instanceof EE_Venue ? $venue->country_ID() : 0; |
|
| 280 | - if ($country_id) { |
|
| 281 | - return EEM_Country::instance()->get_one_by_ID($country_id); |
|
| 282 | - } |
|
| 283 | - return null; |
|
| 284 | - } |
|
| 271 | + /** |
|
| 272 | + * @param Post|EE_Venue $source The source instance. |
|
| 273 | + * @return int |
|
| 274 | + * @since $VID:$ |
|
| 275 | + */ |
|
| 276 | + public function resolveCountry($source) |
|
| 277 | + { |
|
| 278 | + $venue = $this->getVenue($source); |
|
| 279 | + $country_id = $venue instanceof EE_Venue ? $venue->country_ID() : 0; |
|
| 280 | + if ($country_id) { |
|
| 281 | + return EEM_Country::instance()->get_one_by_ID($country_id); |
|
| 282 | + } |
|
| 283 | + return null; |
|
| 284 | + } |
|
| 285 | 285 | } |
| 286 | 286 | \ No newline at end of file |
@@ -53,35 +53,35 @@ discard block |
||
| 53 | 53 | 'name' => [ |
| 54 | 54 | 'type' => 'String', |
| 55 | 55 | 'description' => __('Venue Name', 'event_espresso'), |
| 56 | - 'resolve' => function ($source) { |
|
| 56 | + 'resolve' => function($source) { |
|
| 57 | 57 | return $this->resolveField($source, 'name'); |
| 58 | 58 | }, |
| 59 | 59 | ], |
| 60 | 60 | 'desc' => [ |
| 61 | 61 | 'type' => 'String', |
| 62 | 62 | 'description' => __('Venue Description', 'event_espresso'), |
| 63 | - 'resolve' => function ($source) { |
|
| 63 | + 'resolve' => function($source) { |
|
| 64 | 64 | return $this->resolveField($source, 'description'); |
| 65 | 65 | }, |
| 66 | 66 | ], |
| 67 | 67 | 'shortDesc' => [ |
| 68 | 68 | 'type' => 'String', |
| 69 | 69 | 'description' => __('Short Description of Venue', 'event_espresso'), |
| 70 | - 'resolve' => function ($source) { |
|
| 70 | + 'resolve' => function($source) { |
|
| 71 | 71 | return $this->resolveField($source, 'excerpt'); |
| 72 | 72 | }, |
| 73 | 73 | ], |
| 74 | 74 | 'identifier' => [ |
| 75 | 75 | 'type' => 'String', |
| 76 | 76 | 'description' => __('Venue Identifier', 'event_espresso'), |
| 77 | - 'resolve' => function ($source) { |
|
| 77 | + 'resolve' => function($source) { |
|
| 78 | 78 | return $this->resolveField($source, 'identifier'); |
| 79 | 79 | }, |
| 80 | 80 | ], |
| 81 | 81 | 'created' => [ |
| 82 | 82 | 'type' => 'String', |
| 83 | 83 | 'description' => __('Date Venue Created', 'event_espresso'), |
| 84 | - 'resolve' => function ($source) { |
|
| 84 | + 'resolve' => function($source) { |
|
| 85 | 85 | return $this->resolveField($source, 'created'); |
| 86 | 86 | }, |
| 87 | 87 | ], |
@@ -93,14 +93,14 @@ discard block |
||
| 93 | 93 | 'order' => [ |
| 94 | 94 | 'type' => 'Int', |
| 95 | 95 | 'description' => __('Venue order', 'event_espresso'), |
| 96 | - 'resolve' => function ($source) { |
|
| 96 | + 'resolve' => function($source) { |
|
| 97 | 97 | return $this->resolveField($source, 'order'); |
| 98 | 98 | }, |
| 99 | 99 | ], |
| 100 | 100 | 'wpUser' => [ |
| 101 | 101 | 'type' => 'User', |
| 102 | 102 | 'description' => __('Venue Creator', 'event_espresso'), |
| 103 | - 'resolve' => function ($source, $args, $context) { |
|
| 103 | + 'resolve' => function($source, $args, $context) { |
|
| 104 | 104 | return $this->resolveWpUser($source, $args, $context); |
| 105 | 105 | }, |
| 106 | 106 | ], |
@@ -112,95 +112,95 @@ discard block |
||
| 112 | 112 | 'address' => [ |
| 113 | 113 | 'type' => 'String', |
| 114 | 114 | 'description' => __('Venue Address line 1', 'event_espresso'), |
| 115 | - 'resolve' => function ($source) { |
|
| 115 | + 'resolve' => function($source) { |
|
| 116 | 116 | return $this->resolveField($source, 'address'); |
| 117 | 117 | }, |
| 118 | 118 | ], |
| 119 | 119 | 'address2' => [ |
| 120 | 120 | 'type' => 'String', |
| 121 | 121 | 'description' => __('Venue Address line 2', 'event_espresso'), |
| 122 | - 'resolve' => function ($source) { |
|
| 122 | + 'resolve' => function($source) { |
|
| 123 | 123 | return $this->resolveField($source, 'address2'); |
| 124 | 124 | }, |
| 125 | 125 | ], |
| 126 | 126 | 'city' => [ |
| 127 | 127 | 'type' => 'String', |
| 128 | 128 | 'description' => __('Venue City', 'event_espresso'), |
| 129 | - 'resolve' => function ($source) { |
|
| 129 | + 'resolve' => function($source) { |
|
| 130 | 130 | return $this->resolveField($source, 'city'); |
| 131 | 131 | }, |
| 132 | 132 | ], |
| 133 | 133 | 'state' => [ |
| 134 | 134 | 'type' => 'State', |
| 135 | 135 | 'description' => __('Venue state', 'event_espresso'), |
| 136 | - 'resolve' => function ($source) { |
|
| 136 | + 'resolve' => function($source) { |
|
| 137 | 137 | return $this->resolveState($source); |
| 138 | 138 | }, |
| 139 | 139 | ], |
| 140 | 140 | 'country' => [ |
| 141 | 141 | 'type' => 'Country', |
| 142 | 142 | 'description' => __('Venue country', 'event_espresso'), |
| 143 | - 'resolve' => function ($source) { |
|
| 143 | + 'resolve' => function($source) { |
|
| 144 | 144 | return $this->resolveCountry($source); |
| 145 | 145 | }, |
| 146 | 146 | ], |
| 147 | 147 | 'zip' => [ |
| 148 | 148 | 'type' => 'String', |
| 149 | 149 | 'description' => __('Venue Zip/Postal Code', 'event_espresso'), |
| 150 | - 'resolve' => function ($source) { |
|
| 150 | + 'resolve' => function($source) { |
|
| 151 | 151 | return $this->resolveField($source, 'zip'); |
| 152 | 152 | }, |
| 153 | 153 | ], |
| 154 | 154 | 'capacity' => [ |
| 155 | 155 | 'type' => 'Int', |
| 156 | 156 | 'description' => __('Venue Capacity', 'event_espresso'), |
| 157 | - 'resolve' => function ($source) { |
|
| 157 | + 'resolve' => function($source) { |
|
| 158 | 158 | return $this->resolveCapacity($source); |
| 159 | 159 | }, |
| 160 | 160 | ], |
| 161 | 161 | 'phone' => [ |
| 162 | 162 | 'type' => 'String', |
| 163 | 163 | 'description' => __('Venue Phone', 'event_espresso'), |
| 164 | - 'resolve' => function ($source) { |
|
| 164 | + 'resolve' => function($source) { |
|
| 165 | 165 | return $this->resolveField($source, 'phone'); |
| 166 | 166 | }, |
| 167 | 167 | ], |
| 168 | 168 | 'virtualPhone' => [ |
| 169 | 169 | 'type' => 'String', |
| 170 | 170 | 'description' => __('Call in Number', 'event_espresso'), |
| 171 | - 'resolve' => function ($source) { |
|
| 171 | + 'resolve' => function($source) { |
|
| 172 | 172 | return $this->resolveField($source, 'virtual_phone'); |
| 173 | 173 | }, |
| 174 | 174 | ], |
| 175 | 175 | 'url' => [ |
| 176 | 176 | 'type' => 'String', |
| 177 | 177 | 'description' => __('Venue Website', 'event_espresso'), |
| 178 | - 'resolve' => function ($source) { |
|
| 178 | + 'resolve' => function($source) { |
|
| 179 | 179 | return $this->resolveField($source, 'venue_url'); |
| 180 | 180 | }, |
| 181 | 181 | ], |
| 182 | 182 | 'virtualUrl' => [ |
| 183 | 183 | 'type' => 'String', |
| 184 | 184 | 'description' => __('Virtual URL', 'event_espresso'), |
| 185 | - 'resolve' => function ($source) { |
|
| 185 | + 'resolve' => function($source) { |
|
| 186 | 186 | return $this->resolveField($source, 'virtual_url'); |
| 187 | 187 | }, |
| 188 | 188 | ], |
| 189 | 189 | 'googleMapLink' => [ |
| 190 | 190 | 'type' => 'String', |
| 191 | 191 | 'description' => __('Google Map Link', 'event_espresso'), |
| 192 | - 'resolve' => function ($source) { |
|
| 192 | + 'resolve' => function($source) { |
|
| 193 | 193 | return $this->resolveField($source, 'google_map_link'); |
| 194 | 194 | }, |
| 195 | 195 | ], |
| 196 | 196 | 'enableForGmap' => [ |
| 197 | 197 | 'type' => 'String', |
| 198 | 198 | 'description' => __('Show Google Map?', 'event_espresso'), |
| 199 | - 'resolve' => function ($source) { |
|
| 199 | + 'resolve' => function($source) { |
|
| 200 | 200 | return $this->resolveField($source, 'enable_for_gmap'); |
| 201 | 201 | }, |
| 202 | 202 | ], |
| 203 | - ] ); |
|
| 203 | + ]); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | |
@@ -225,7 +225,7 @@ |
||
| 225 | 225 | |
| 226 | 226 | /** |
| 227 | 227 | * @param EE_Base_Class $model |
| 228 | - * @return EE_Base_Class|null |
|
| 228 | + * @return \EE_Base_Class|null |
|
| 229 | 229 | * @throws EE_Error |
| 230 | 230 | * @throws InvalidArgumentException |
| 231 | 231 | * @throws InvalidDataTypeException |
@@ -39,203 +39,203 @@ |
||
| 39 | 39 | abstract class TypeBase implements TypeInterface |
| 40 | 40 | { |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @var EEM_Base $model |
|
| 44 | - */ |
|
| 45 | - protected $model; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * @var string $name |
|
| 49 | - */ |
|
| 50 | - protected $name = ''; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * @var string $description |
|
| 54 | - */ |
|
| 55 | - protected $description = ''; |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * @var array $fields |
|
| 59 | - */ |
|
| 60 | - protected $fields = []; |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * @var bool $is_custom_post_type |
|
| 64 | - */ |
|
| 65 | - protected $is_custom_post_type = false; |
|
| 66 | - |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * @return string |
|
| 70 | - */ |
|
| 71 | - public function name() |
|
| 72 | - { |
|
| 73 | - return $this->name; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * @param string $name |
|
| 79 | - */ |
|
| 80 | - protected function setName($name) |
|
| 81 | - { |
|
| 82 | - $this->name = $name; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * @return string |
|
| 88 | - */ |
|
| 89 | - public function description() |
|
| 90 | - { |
|
| 91 | - return $this->description; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * @param string $description |
|
| 97 | - */ |
|
| 98 | - protected function setDescription($description) |
|
| 99 | - { |
|
| 100 | - $this->description = $description; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * @return array |
|
| 106 | - * @since $VID:$ |
|
| 107 | - */ |
|
| 108 | - public function fields() |
|
| 109 | - { |
|
| 110 | - return $this->fields; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * @param array $fields |
|
| 116 | - */ |
|
| 117 | - protected function setFields(array $fields) |
|
| 118 | - { |
|
| 119 | - $this->fields = $fields; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * @return bool |
|
| 125 | - */ |
|
| 126 | - public function isCustomPostType() |
|
| 127 | - { |
|
| 128 | - return $this->is_custom_post_type; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * @param bool $is_custom_post_type |
|
| 134 | - */ |
|
| 135 | - protected function setIsCustomPostType($is_custom_post_type) |
|
| 136 | - { |
|
| 137 | - $this->is_custom_post_type = filter_var($is_custom_post_type, FILTER_VALIDATE_BOOLEAN); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * @param int $value |
|
| 143 | - * @return int |
|
| 144 | - * @since $VID:$ |
|
| 145 | - */ |
|
| 146 | - protected function parseInfiniteValue($value) |
|
| 147 | - { |
|
| 148 | - return $value === EE_INF || is_infinite($value) ? -1 : $value; |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * @param EE_Model_Field_Base $field |
|
| 154 | - * @return string |
|
| 155 | - * @since $VID:$ |
|
| 156 | - */ |
|
| 157 | - protected function parseFieldType(EE_Model_Field_Base $field) |
|
| 158 | - { |
|
| 159 | - $schema_type = $field->getSchemaType(); |
|
| 160 | - $schema_type = is_array($schema_type) ? array_shift($schema_type) : $schema_type; |
|
| 161 | - switch ($schema_type) { |
|
| 162 | - case 'boolean'; |
|
| 163 | - return 'Boolean'; |
|
| 164 | - case 'date-time'; |
|
| 165 | - case 'string'; |
|
| 166 | - return 'String'; |
|
| 167 | - case 'integer'; |
|
| 168 | - if ($field instanceof EE_WP_User_Field) { |
|
| 169 | - return 'User'; |
|
| 170 | - } |
|
| 171 | - return 'Int'; |
|
| 172 | - case 'number'; |
|
| 173 | - return 'Float'; |
|
| 174 | - case 'object'; |
|
| 175 | - if ($field instanceof EE_Post_Content_Field) { |
|
| 176 | - return 'String'; |
|
| 177 | - } |
|
| 178 | - if ($field instanceof EE_Enum_Text_Field) { |
|
| 179 | - return 'String'; |
|
| 180 | - } |
|
| 181 | - return 'object'; |
|
| 182 | - } |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * @param Post|EE_Base_Class $source |
|
| 188 | - * @return int |
|
| 189 | - * @since $VID:$ |
|
| 190 | - */ |
|
| 191 | - protected function getUserId($source) |
|
| 192 | - { |
|
| 193 | - if ($source instanceof Post) { |
|
| 194 | - $source = $this->model->get_one_by_ID($source->ID); |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - if (is_subclass_of($source, 'EE_Base_Class')) { |
|
| 198 | - return $source->wp_user(); |
|
| 199 | - } |
|
| 200 | - return 0; |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * @param EE_Base_Class|Post $source |
|
| 206 | - * @param $args |
|
| 207 | - * @param $context |
|
| 208 | - * @return Deferred|null |
|
| 209 | - * @throws EE_Error |
|
| 210 | - * @throws InvalidArgumentException |
|
| 211 | - * @throws InvalidDataTypeException |
|
| 212 | - * @throws InvalidInterfaceException |
|
| 213 | - * @throws ReflectionException |
|
| 214 | - * @throws UserError |
|
| 215 | - * @since $VID:$ |
|
| 216 | - */ |
|
| 217 | - public function resolveWpUser($source, $args, $context) |
|
| 218 | - { |
|
| 219 | - $user_id = $this->getUserId($source); |
|
| 220 | - return $user_id |
|
| 221 | - ? DataSource::resolve_user($user_id, $context) |
|
| 222 | - : null; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - |
|
| 226 | - /** |
|
| 227 | - * @param EE_Base_Class $model |
|
| 228 | - * @return EE_Base_Class|null |
|
| 229 | - * @throws EE_Error |
|
| 230 | - * @throws InvalidArgumentException |
|
| 231 | - * @throws InvalidDataTypeException |
|
| 232 | - * @throws InvalidInterfaceException |
|
| 233 | - * @throws ReflectionException |
|
| 234 | - * @since $VID:$ |
|
| 235 | - */ |
|
| 236 | - public function resolveParent($model) |
|
| 237 | - { |
|
| 238 | - return is_subclass_of($model, 'EE_Base_Class') ? $this->model->get_one_by_ID($model->parent()) : null; |
|
| 239 | - } |
|
| 42 | + /** |
|
| 43 | + * @var EEM_Base $model |
|
| 44 | + */ |
|
| 45 | + protected $model; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * @var string $name |
|
| 49 | + */ |
|
| 50 | + protected $name = ''; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * @var string $description |
|
| 54 | + */ |
|
| 55 | + protected $description = ''; |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * @var array $fields |
|
| 59 | + */ |
|
| 60 | + protected $fields = []; |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * @var bool $is_custom_post_type |
|
| 64 | + */ |
|
| 65 | + protected $is_custom_post_type = false; |
|
| 66 | + |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * @return string |
|
| 70 | + */ |
|
| 71 | + public function name() |
|
| 72 | + { |
|
| 73 | + return $this->name; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * @param string $name |
|
| 79 | + */ |
|
| 80 | + protected function setName($name) |
|
| 81 | + { |
|
| 82 | + $this->name = $name; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * @return string |
|
| 88 | + */ |
|
| 89 | + public function description() |
|
| 90 | + { |
|
| 91 | + return $this->description; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * @param string $description |
|
| 97 | + */ |
|
| 98 | + protected function setDescription($description) |
|
| 99 | + { |
|
| 100 | + $this->description = $description; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * @return array |
|
| 106 | + * @since $VID:$ |
|
| 107 | + */ |
|
| 108 | + public function fields() |
|
| 109 | + { |
|
| 110 | + return $this->fields; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * @param array $fields |
|
| 116 | + */ |
|
| 117 | + protected function setFields(array $fields) |
|
| 118 | + { |
|
| 119 | + $this->fields = $fields; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * @return bool |
|
| 125 | + */ |
|
| 126 | + public function isCustomPostType() |
|
| 127 | + { |
|
| 128 | + return $this->is_custom_post_type; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * @param bool $is_custom_post_type |
|
| 134 | + */ |
|
| 135 | + protected function setIsCustomPostType($is_custom_post_type) |
|
| 136 | + { |
|
| 137 | + $this->is_custom_post_type = filter_var($is_custom_post_type, FILTER_VALIDATE_BOOLEAN); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * @param int $value |
|
| 143 | + * @return int |
|
| 144 | + * @since $VID:$ |
|
| 145 | + */ |
|
| 146 | + protected function parseInfiniteValue($value) |
|
| 147 | + { |
|
| 148 | + return $value === EE_INF || is_infinite($value) ? -1 : $value; |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * @param EE_Model_Field_Base $field |
|
| 154 | + * @return string |
|
| 155 | + * @since $VID:$ |
|
| 156 | + */ |
|
| 157 | + protected function parseFieldType(EE_Model_Field_Base $field) |
|
| 158 | + { |
|
| 159 | + $schema_type = $field->getSchemaType(); |
|
| 160 | + $schema_type = is_array($schema_type) ? array_shift($schema_type) : $schema_type; |
|
| 161 | + switch ($schema_type) { |
|
| 162 | + case 'boolean'; |
|
| 163 | + return 'Boolean'; |
|
| 164 | + case 'date-time'; |
|
| 165 | + case 'string'; |
|
| 166 | + return 'String'; |
|
| 167 | + case 'integer'; |
|
| 168 | + if ($field instanceof EE_WP_User_Field) { |
|
| 169 | + return 'User'; |
|
| 170 | + } |
|
| 171 | + return 'Int'; |
|
| 172 | + case 'number'; |
|
| 173 | + return 'Float'; |
|
| 174 | + case 'object'; |
|
| 175 | + if ($field instanceof EE_Post_Content_Field) { |
|
| 176 | + return 'String'; |
|
| 177 | + } |
|
| 178 | + if ($field instanceof EE_Enum_Text_Field) { |
|
| 179 | + return 'String'; |
|
| 180 | + } |
|
| 181 | + return 'object'; |
|
| 182 | + } |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * @param Post|EE_Base_Class $source |
|
| 188 | + * @return int |
|
| 189 | + * @since $VID:$ |
|
| 190 | + */ |
|
| 191 | + protected function getUserId($source) |
|
| 192 | + { |
|
| 193 | + if ($source instanceof Post) { |
|
| 194 | + $source = $this->model->get_one_by_ID($source->ID); |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + if (is_subclass_of($source, 'EE_Base_Class')) { |
|
| 198 | + return $source->wp_user(); |
|
| 199 | + } |
|
| 200 | + return 0; |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * @param EE_Base_Class|Post $source |
|
| 206 | + * @param $args |
|
| 207 | + * @param $context |
|
| 208 | + * @return Deferred|null |
|
| 209 | + * @throws EE_Error |
|
| 210 | + * @throws InvalidArgumentException |
|
| 211 | + * @throws InvalidDataTypeException |
|
| 212 | + * @throws InvalidInterfaceException |
|
| 213 | + * @throws ReflectionException |
|
| 214 | + * @throws UserError |
|
| 215 | + * @since $VID:$ |
|
| 216 | + */ |
|
| 217 | + public function resolveWpUser($source, $args, $context) |
|
| 218 | + { |
|
| 219 | + $user_id = $this->getUserId($source); |
|
| 220 | + return $user_id |
|
| 221 | + ? DataSource::resolve_user($user_id, $context) |
|
| 222 | + : null; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + |
|
| 226 | + /** |
|
| 227 | + * @param EE_Base_Class $model |
|
| 228 | + * @return EE_Base_Class|null |
|
| 229 | + * @throws EE_Error |
|
| 230 | + * @throws InvalidArgumentException |
|
| 231 | + * @throws InvalidDataTypeException |
|
| 232 | + * @throws InvalidInterfaceException |
|
| 233 | + * @throws ReflectionException |
|
| 234 | + * @since $VID:$ |
|
| 235 | + */ |
|
| 236 | + public function resolveParent($model) |
|
| 237 | + { |
|
| 238 | + return is_subclass_of($model, 'EE_Base_Class') ? $this->model->get_one_by_ID($model->parent()) : null; |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | 241 | } |
| 242 | 242 | \ No newline at end of file |
@@ -20,1168 +20,1168 @@ |
||
| 20 | 20 | class EE_Dependency_Map |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * This means that the requested class dependency is not present in the dependency map |
|
| 25 | - */ |
|
| 26 | - const not_registered = 0; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
| 30 | - */ |
|
| 31 | - const load_new_object = 1; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
| 35 | - * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
| 36 | - */ |
|
| 37 | - const load_from_cache = 2; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * When registering a dependency, |
|
| 41 | - * this indicates to keep any existing dependencies that already exist, |
|
| 42 | - * and simply discard any new dependencies declared in the incoming data |
|
| 43 | - */ |
|
| 44 | - const KEEP_EXISTING_DEPENDENCIES = 0; |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * When registering a dependency, |
|
| 48 | - * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
| 49 | - */ |
|
| 50 | - const OVERWRITE_DEPENDENCIES = 1; |
|
| 51 | - |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * @type EE_Dependency_Map $_instance |
|
| 55 | - */ |
|
| 56 | - protected static $_instance; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * @var ClassInterfaceCache $class_cache |
|
| 60 | - */ |
|
| 61 | - private $class_cache; |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * @type RequestInterface $request |
|
| 65 | - */ |
|
| 66 | - protected $request; |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * @type LegacyRequestInterface $legacy_request |
|
| 70 | - */ |
|
| 71 | - protected $legacy_request; |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * @type ResponseInterface $response |
|
| 75 | - */ |
|
| 76 | - protected $response; |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * @type LoaderInterface $loader |
|
| 80 | - */ |
|
| 81 | - protected $loader; |
|
| 82 | - |
|
| 83 | - /** |
|
| 84 | - * @type array $_dependency_map |
|
| 85 | - */ |
|
| 86 | - protected $_dependency_map = array(); |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * @type array $_class_loaders |
|
| 90 | - */ |
|
| 91 | - protected $_class_loaders = array(); |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * EE_Dependency_Map constructor. |
|
| 96 | - * |
|
| 97 | - * @param ClassInterfaceCache $class_cache |
|
| 98 | - */ |
|
| 99 | - protected function __construct(ClassInterfaceCache $class_cache) |
|
| 100 | - { |
|
| 101 | - $this->class_cache = $class_cache; |
|
| 102 | - do_action('EE_Dependency_Map____construct', $this); |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * @return void |
|
| 108 | - */ |
|
| 109 | - public function initialize() |
|
| 110 | - { |
|
| 111 | - $this->_register_core_dependencies(); |
|
| 112 | - $this->_register_core_class_loaders(); |
|
| 113 | - $this->_register_core_aliases(); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * @singleton method used to instantiate class object |
|
| 119 | - * @param ClassInterfaceCache|null $class_cache |
|
| 120 | - * @return EE_Dependency_Map |
|
| 121 | - */ |
|
| 122 | - public static function instance(ClassInterfaceCache $class_cache = null) |
|
| 123 | - { |
|
| 124 | - // check if class object is instantiated, and instantiated properly |
|
| 125 | - if (! self::$_instance instanceof EE_Dependency_Map |
|
| 126 | - && $class_cache instanceof ClassInterfaceCache |
|
| 127 | - ) { |
|
| 128 | - self::$_instance = new EE_Dependency_Map($class_cache); |
|
| 129 | - } |
|
| 130 | - return self::$_instance; |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - |
|
| 134 | - /** |
|
| 135 | - * @param RequestInterface $request |
|
| 136 | - */ |
|
| 137 | - public function setRequest(RequestInterface $request) |
|
| 138 | - { |
|
| 139 | - $this->request = $request; |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * @param LegacyRequestInterface $legacy_request |
|
| 145 | - */ |
|
| 146 | - public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
| 147 | - { |
|
| 148 | - $this->legacy_request = $legacy_request; |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * @param ResponseInterface $response |
|
| 154 | - */ |
|
| 155 | - public function setResponse(ResponseInterface $response) |
|
| 156 | - { |
|
| 157 | - $this->response = $response; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * @param LoaderInterface $loader |
|
| 163 | - */ |
|
| 164 | - public function setLoader(LoaderInterface $loader) |
|
| 165 | - { |
|
| 166 | - $this->loader = $loader; |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * @param string $class |
|
| 172 | - * @param array $dependencies |
|
| 173 | - * @param int $overwrite |
|
| 174 | - * @return bool |
|
| 175 | - */ |
|
| 176 | - public static function register_dependencies( |
|
| 177 | - $class, |
|
| 178 | - array $dependencies, |
|
| 179 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
| 180 | - ) { |
|
| 181 | - return self::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - |
|
| 185 | - /** |
|
| 186 | - * Assigns an array of class names and corresponding load sources (new or cached) |
|
| 187 | - * to the class specified by the first parameter. |
|
| 188 | - * IMPORTANT !!! |
|
| 189 | - * The order of elements in the incoming $dependencies array MUST match |
|
| 190 | - * the order of the constructor parameters for the class in question. |
|
| 191 | - * This is especially important when overriding any existing dependencies that are registered. |
|
| 192 | - * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
| 193 | - * |
|
| 194 | - * @param string $class |
|
| 195 | - * @param array $dependencies |
|
| 196 | - * @param int $overwrite |
|
| 197 | - * @return bool |
|
| 198 | - */ |
|
| 199 | - public function registerDependencies( |
|
| 200 | - $class, |
|
| 201 | - array $dependencies, |
|
| 202 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
| 203 | - ) { |
|
| 204 | - $class = trim($class, '\\'); |
|
| 205 | - $registered = false; |
|
| 206 | - if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
| 207 | - self::$_instance->_dependency_map[ $class ] = array(); |
|
| 208 | - } |
|
| 209 | - // we need to make sure that any aliases used when registering a dependency |
|
| 210 | - // get resolved to the correct class name |
|
| 211 | - foreach ($dependencies as $dependency => $load_source) { |
|
| 212 | - $alias = self::$_instance->getFqnForAlias($dependency); |
|
| 213 | - if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
| 214 | - || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
| 215 | - ) { |
|
| 216 | - unset($dependencies[ $dependency ]); |
|
| 217 | - $dependencies[ $alias ] = $load_source; |
|
| 218 | - $registered = true; |
|
| 219 | - } |
|
| 220 | - } |
|
| 221 | - // now add our two lists of dependencies together. |
|
| 222 | - // using Union (+=) favours the arrays in precedence from left to right, |
|
| 223 | - // so $dependencies is NOT overwritten because it is listed first |
|
| 224 | - // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
| 225 | - // Union is way faster than array_merge() but should be used with caution... |
|
| 226 | - // especially with numerically indexed arrays |
|
| 227 | - $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
| 228 | - // now we need to ensure that the resulting dependencies |
|
| 229 | - // array only has the entries that are required for the class |
|
| 230 | - // so first count how many dependencies were originally registered for the class |
|
| 231 | - $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
| 232 | - // if that count is non-zero (meaning dependencies were already registered) |
|
| 233 | - self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
| 234 | - // then truncate the final array to match that count |
|
| 235 | - ? array_slice($dependencies, 0, $dependency_count) |
|
| 236 | - // otherwise just take the incoming array because nothing previously existed |
|
| 237 | - : $dependencies; |
|
| 238 | - return $registered; |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * @param string $class_name |
|
| 244 | - * @param string $loader |
|
| 245 | - * @return bool |
|
| 246 | - * @throws DomainException |
|
| 247 | - */ |
|
| 248 | - public static function register_class_loader($class_name, $loader = 'load_core') |
|
| 249 | - { |
|
| 250 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
| 251 | - throw new DomainException( |
|
| 252 | - esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
| 253 | - ); |
|
| 254 | - } |
|
| 255 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
| 256 | - if (! is_callable($loader) |
|
| 257 | - && ( |
|
| 258 | - strpos($loader, 'load_') !== 0 |
|
| 259 | - || ! method_exists('EE_Registry', $loader) |
|
| 260 | - ) |
|
| 261 | - ) { |
|
| 262 | - throw new DomainException( |
|
| 263 | - sprintf( |
|
| 264 | - esc_html__( |
|
| 265 | - '"%1$s" is not a valid loader method on EE_Registry.', |
|
| 266 | - 'event_espresso' |
|
| 267 | - ), |
|
| 268 | - $loader |
|
| 269 | - ) |
|
| 270 | - ); |
|
| 271 | - } |
|
| 272 | - $class_name = self::$_instance->getFqnForAlias($class_name); |
|
| 273 | - if (! isset(self::$_instance->_class_loaders[ $class_name ])) { |
|
| 274 | - self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
| 275 | - return true; |
|
| 276 | - } |
|
| 277 | - return false; |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - |
|
| 281 | - /** |
|
| 282 | - * @return array |
|
| 283 | - */ |
|
| 284 | - public function dependency_map() |
|
| 285 | - { |
|
| 286 | - return $this->_dependency_map; |
|
| 287 | - } |
|
| 288 | - |
|
| 289 | - |
|
| 290 | - /** |
|
| 291 | - * returns TRUE if dependency map contains a listing for the provided class name |
|
| 292 | - * |
|
| 293 | - * @param string $class_name |
|
| 294 | - * @return boolean |
|
| 295 | - */ |
|
| 296 | - public function has($class_name = '') |
|
| 297 | - { |
|
| 298 | - // all legacy models have the same dependencies |
|
| 299 | - if (strpos($class_name, 'EEM_') === 0) { |
|
| 300 | - $class_name = 'LEGACY_MODELS'; |
|
| 301 | - } |
|
| 302 | - return isset($this->_dependency_map[ $class_name ]) ? true : false; |
|
| 303 | - } |
|
| 304 | - |
|
| 305 | - |
|
| 306 | - /** |
|
| 307 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
| 308 | - * |
|
| 309 | - * @param string $class_name |
|
| 310 | - * @param string $dependency |
|
| 311 | - * @return bool |
|
| 312 | - */ |
|
| 313 | - public function has_dependency_for_class($class_name = '', $dependency = '') |
|
| 314 | - { |
|
| 315 | - // all legacy models have the same dependencies |
|
| 316 | - if (strpos($class_name, 'EEM_') === 0) { |
|
| 317 | - $class_name = 'LEGACY_MODELS'; |
|
| 318 | - } |
|
| 319 | - $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
| 320 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]) |
|
| 321 | - ? true |
|
| 322 | - : false; |
|
| 323 | - } |
|
| 324 | - |
|
| 325 | - |
|
| 326 | - /** |
|
| 327 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
| 328 | - * |
|
| 329 | - * @param string $class_name |
|
| 330 | - * @param string $dependency |
|
| 331 | - * @return int |
|
| 332 | - */ |
|
| 333 | - public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
| 334 | - { |
|
| 335 | - // all legacy models have the same dependencies |
|
| 336 | - if (strpos($class_name, 'EEM_') === 0) { |
|
| 337 | - $class_name = 'LEGACY_MODELS'; |
|
| 338 | - } |
|
| 339 | - $dependency = $this->getFqnForAlias($dependency); |
|
| 340 | - return $this->has_dependency_for_class($class_name, $dependency) |
|
| 341 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
| 342 | - : EE_Dependency_Map::not_registered; |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - |
|
| 346 | - /** |
|
| 347 | - * @param string $class_name |
|
| 348 | - * @return string | Closure |
|
| 349 | - */ |
|
| 350 | - public function class_loader($class_name) |
|
| 351 | - { |
|
| 352 | - // all legacy models use load_model() |
|
| 353 | - if (strpos($class_name, 'EEM_') === 0) { |
|
| 354 | - return 'load_model'; |
|
| 355 | - } |
|
| 356 | - // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
| 357 | - // perform strpos() first to avoid loading regex every time we load a class |
|
| 358 | - if (strpos($class_name, 'EE_CPT_') === 0 |
|
| 359 | - && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
| 360 | - ) { |
|
| 361 | - return 'load_core'; |
|
| 362 | - } |
|
| 363 | - $class_name = $this->getFqnForAlias($class_name); |
|
| 364 | - return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
| 365 | - } |
|
| 366 | - |
|
| 367 | - |
|
| 368 | - /** |
|
| 369 | - * @return array |
|
| 370 | - */ |
|
| 371 | - public function class_loaders() |
|
| 372 | - { |
|
| 373 | - return $this->_class_loaders; |
|
| 374 | - } |
|
| 375 | - |
|
| 376 | - |
|
| 377 | - /** |
|
| 378 | - * adds an alias for a classname |
|
| 379 | - * |
|
| 380 | - * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
| 381 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
| 382 | - * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
| 383 | - */ |
|
| 384 | - public function add_alias($fqcn, $alias, $for_class = '') |
|
| 385 | - { |
|
| 386 | - $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
| 387 | - } |
|
| 388 | - |
|
| 389 | - |
|
| 390 | - /** |
|
| 391 | - * Returns TRUE if the provided fully qualified name IS an alias |
|
| 392 | - * WHY? |
|
| 393 | - * Because if a class is type hinting for a concretion, |
|
| 394 | - * then why would we need to find another class to supply it? |
|
| 395 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
| 396 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
| 397 | - * Don't go looking for some substitute. |
|
| 398 | - * Whereas if a class is type hinting for an interface... |
|
| 399 | - * then we need to find an actual class to use. |
|
| 400 | - * So the interface IS the alias for some other FQN, |
|
| 401 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
| 402 | - * represents some other class. |
|
| 403 | - * |
|
| 404 | - * @param string $fqn |
|
| 405 | - * @param string $for_class |
|
| 406 | - * @return bool |
|
| 407 | - */ |
|
| 408 | - public function isAlias($fqn = '', $for_class = '') |
|
| 409 | - { |
|
| 410 | - return $this->class_cache->isAlias($fqn, $for_class); |
|
| 411 | - } |
|
| 412 | - |
|
| 413 | - |
|
| 414 | - /** |
|
| 415 | - * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
| 416 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
| 417 | - * for example: |
|
| 418 | - * if the following two entries were added to the _aliases array: |
|
| 419 | - * array( |
|
| 420 | - * 'interface_alias' => 'some\namespace\interface' |
|
| 421 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
| 422 | - * ) |
|
| 423 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
| 424 | - * to load an instance of 'some\namespace\classname' |
|
| 425 | - * |
|
| 426 | - * @param string $alias |
|
| 427 | - * @param string $for_class |
|
| 428 | - * @return string |
|
| 429 | - */ |
|
| 430 | - public function getFqnForAlias($alias = '', $for_class = '') |
|
| 431 | - { |
|
| 432 | - return (string) $this->class_cache->getFqnForAlias($alias, $for_class); |
|
| 433 | - } |
|
| 434 | - |
|
| 435 | - |
|
| 436 | - /** |
|
| 437 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
| 438 | - * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
| 439 | - * This is done by using the following class constants: |
|
| 440 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
| 441 | - * EE_Dependency_Map::load_new_object - generates a new object every time |
|
| 442 | - */ |
|
| 443 | - protected function _register_core_dependencies() |
|
| 444 | - { |
|
| 445 | - $this->_dependency_map = array( |
|
| 446 | - 'EE_Request_Handler' => array( |
|
| 447 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 448 | - ), |
|
| 449 | - 'EE_System' => array( |
|
| 450 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 451 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 452 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 453 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 454 | - ), |
|
| 455 | - 'EE_Session' => array( |
|
| 456 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 457 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
| 458 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 459 | - 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
| 460 | - 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
| 461 | - ), |
|
| 462 | - 'EE_Cart' => array( |
|
| 463 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 464 | - ), |
|
| 465 | - 'EE_Front_Controller' => array( |
|
| 466 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 467 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 468 | - 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
| 469 | - ), |
|
| 470 | - 'EE_Messenger_Collection_Loader' => array( |
|
| 471 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
| 472 | - ), |
|
| 473 | - 'EE_Message_Type_Collection_Loader' => array( |
|
| 474 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
| 475 | - ), |
|
| 476 | - 'EE_Message_Resource_Manager' => array( |
|
| 477 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
| 478 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
| 479 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
| 480 | - ), |
|
| 481 | - 'EE_Message_Factory' => array( |
|
| 482 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 483 | - ), |
|
| 484 | - 'EE_messages' => array( |
|
| 485 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 486 | - ), |
|
| 487 | - 'EE_Messages_Generator' => array( |
|
| 488 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
| 489 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
| 490 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
| 491 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
| 492 | - ), |
|
| 493 | - 'EE_Messages_Processor' => array( |
|
| 494 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 495 | - ), |
|
| 496 | - 'EE_Messages_Queue' => array( |
|
| 497 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
| 498 | - ), |
|
| 499 | - 'EE_Messages_Template_Defaults' => array( |
|
| 500 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
| 501 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
| 502 | - ), |
|
| 503 | - 'EE_Message_To_Generate_From_Request' => array( |
|
| 504 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 505 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 506 | - ), |
|
| 507 | - 'EventEspresso\core\services\commands\CommandBus' => array( |
|
| 508 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
| 509 | - ), |
|
| 510 | - 'EventEspresso\services\commands\CommandHandler' => array( |
|
| 511 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 512 | - 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
| 513 | - ), |
|
| 514 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => array( |
|
| 515 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 516 | - ), |
|
| 517 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => array( |
|
| 518 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
| 519 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
| 520 | - ), |
|
| 521 | - 'EventEspresso\core\services\commands\CommandFactory' => array( |
|
| 522 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 523 | - ), |
|
| 524 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => array( |
|
| 525 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
| 526 | - ), |
|
| 527 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array( |
|
| 528 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
| 529 | - ), |
|
| 530 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array( |
|
| 531 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
| 532 | - ), |
|
| 533 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array( |
|
| 534 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 535 | - ), |
|
| 536 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array( |
|
| 537 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 538 | - ), |
|
| 539 | - 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array( |
|
| 540 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 541 | - ), |
|
| 542 | - 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array( |
|
| 543 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 544 | - ), |
|
| 545 | - 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array( |
|
| 546 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 547 | - ), |
|
| 548 | - 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array( |
|
| 549 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 550 | - ), |
|
| 551 | - 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array( |
|
| 552 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 553 | - ), |
|
| 554 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array( |
|
| 555 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 556 | - ), |
|
| 557 | - 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => array( |
|
| 558 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 559 | - ), |
|
| 560 | - 'EventEspresso\core\services\database\TableManager' => array( |
|
| 561 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 562 | - ), |
|
| 563 | - 'EE_Data_Migration_Class_Base' => array( |
|
| 564 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 565 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 566 | - ), |
|
| 567 | - 'EE_DMS_Core_4_1_0' => array( |
|
| 568 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 569 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 570 | - ), |
|
| 571 | - 'EE_DMS_Core_4_2_0' => array( |
|
| 572 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 573 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 574 | - ), |
|
| 575 | - 'EE_DMS_Core_4_3_0' => array( |
|
| 576 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 577 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 578 | - ), |
|
| 579 | - 'EE_DMS_Core_4_4_0' => array( |
|
| 580 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 581 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 582 | - ), |
|
| 583 | - 'EE_DMS_Core_4_5_0' => array( |
|
| 584 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 585 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 586 | - ), |
|
| 587 | - 'EE_DMS_Core_4_6_0' => array( |
|
| 588 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 589 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 590 | - ), |
|
| 591 | - 'EE_DMS_Core_4_7_0' => array( |
|
| 592 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 593 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 594 | - ), |
|
| 595 | - 'EE_DMS_Core_4_8_0' => array( |
|
| 596 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 597 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 598 | - ), |
|
| 599 | - 'EE_DMS_Core_4_9_0' => array( |
|
| 600 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 601 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 602 | - ), |
|
| 603 | - 'EE_DMS_Core_4_10_0' => array( |
|
| 604 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 605 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 606 | - 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
| 607 | - ), |
|
| 608 | - 'EventEspresso\core\services\assets\I18nRegistry' => array( |
|
| 609 | - array(), |
|
| 610 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 611 | - ), |
|
| 612 | - 'EventEspresso\core\services\assets\Registry' => array( |
|
| 613 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 614 | - 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache, |
|
| 615 | - ), |
|
| 616 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array( |
|
| 617 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 618 | - ), |
|
| 619 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array( |
|
| 620 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 621 | - ), |
|
| 622 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array( |
|
| 623 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 624 | - ), |
|
| 625 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array( |
|
| 626 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 627 | - ), |
|
| 628 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array( |
|
| 629 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 630 | - ), |
|
| 631 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array( |
|
| 632 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 633 | - ), |
|
| 634 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array( |
|
| 635 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 636 | - ), |
|
| 637 | - 'EventEspresso\core\services\cache\BasicCacheManager' => array( |
|
| 638 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 639 | - ), |
|
| 640 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array( |
|
| 641 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 642 | - ), |
|
| 643 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array( |
|
| 644 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 645 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 646 | - ), |
|
| 647 | - 'EventEspresso\core\domain\values\EmailAddress' => array( |
|
| 648 | - null, |
|
| 649 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
| 650 | - ), |
|
| 651 | - 'EventEspresso\core\services\orm\ModelFieldFactory' => array( |
|
| 652 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 653 | - ), |
|
| 654 | - 'LEGACY_MODELS' => array( |
|
| 655 | - null, |
|
| 656 | - 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
| 657 | - ), |
|
| 658 | - 'EE_Module_Request_Router' => array( |
|
| 659 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 660 | - ), |
|
| 661 | - 'EE_Registration_Processor' => array( |
|
| 662 | - 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 663 | - ), |
|
| 664 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array( |
|
| 665 | - null, |
|
| 666 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
| 667 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 668 | - ), |
|
| 669 | - 'EventEspresso\core\services\licensing\LicenseService' => array( |
|
| 670 | - 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, |
|
| 671 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
| 672 | - ), |
|
| 673 | - 'EE_Admin_Transactions_List_Table' => array( |
|
| 674 | - null, |
|
| 675 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
| 676 | - ), |
|
| 677 | - 'EventEspresso\core\domain\services\pue\Stats' => array( |
|
| 678 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
| 679 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 680 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache, |
|
| 681 | - ), |
|
| 682 | - 'EventEspresso\core\domain\services\pue\Config' => array( |
|
| 683 | - 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, |
|
| 684 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
| 685 | - ), |
|
| 686 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => array( |
|
| 687 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
| 688 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 689 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 690 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 691 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 692 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
| 693 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
| 694 | - ), |
|
| 695 | - 'EventEspresso\core\domain\services\admin\ExitModal' => array( |
|
| 696 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 697 | - ), |
|
| 698 | - 'EventEspresso\core\domain\services\admin\PluginUpsells' => array( |
|
| 699 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 700 | - ), |
|
| 701 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => array( |
|
| 702 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 703 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 704 | - ), |
|
| 705 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => array( |
|
| 706 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 707 | - ), |
|
| 708 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => array( |
|
| 709 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 710 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 711 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 712 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 713 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
| 714 | - ), |
|
| 715 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => array( |
|
| 716 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 717 | - ), |
|
| 718 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => array( |
|
| 719 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 720 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 721 | - ), |
|
| 722 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => array( |
|
| 723 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 724 | - ), |
|
| 725 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => array( |
|
| 726 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 727 | - ), |
|
| 728 | - 'EE_CPT_Strategy' => array( |
|
| 729 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 730 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 731 | - ), |
|
| 732 | - 'EventEspresso\core\services\loaders\ObjectIdentifier' => array( |
|
| 733 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
| 734 | - ), |
|
| 735 | - 'EventEspresso\core\domain\services\assets\CoreAssetManager' => array( |
|
| 736 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 737 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
| 738 | - 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
| 739 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 740 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 741 | - ), |
|
| 742 | - 'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => array( |
|
| 743 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
| 744 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache |
|
| 745 | - ), |
|
| 746 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => array( |
|
| 747 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 748 | - ), |
|
| 749 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => array( |
|
| 750 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 751 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache |
|
| 752 | - ), |
|
| 753 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => array( |
|
| 754 | - 'EEM_Checkin' => EE_Dependency_Map::load_from_cache, |
|
| 755 | - ), |
|
| 756 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => array( |
|
| 757 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 758 | - ), |
|
| 759 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => array( |
|
| 760 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
| 761 | - ), |
|
| 762 | - 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => array( |
|
| 763 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 764 | - ), |
|
| 765 | - 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => array( |
|
| 766 | - 'EEM_Answer' => EE_Dependency_Map::load_from_cache, |
|
| 767 | - 'EEM_Question' => EE_Dependency_Map::load_from_cache, |
|
| 768 | - ), |
|
| 769 | - 'EventEspresso\core\CPTs\CptQueryModifier' => array( |
|
| 770 | - null, |
|
| 771 | - null, |
|
| 772 | - null, |
|
| 773 | - 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 774 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 775 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 776 | - ), |
|
| 777 | - 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => array( |
|
| 778 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 779 | - 'EE_Config' => EE_Dependency_Map::load_from_cache |
|
| 780 | - ), |
|
| 781 | - 'EventEspresso\core\services\editor\BlockRegistrationManager' => array( |
|
| 782 | - 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
| 783 | - 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
| 784 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
| 785 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 786 | - ), |
|
| 787 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => array( |
|
| 788 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 789 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 790 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 791 | - ), |
|
| 792 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => array( |
|
| 793 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 794 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 795 | - ), |
|
| 796 | - 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => array( |
|
| 797 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache, |
|
| 798 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 799 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache, |
|
| 800 | - ), |
|
| 801 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => array( |
|
| 802 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
| 803 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
| 804 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 805 | - ), |
|
| 806 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => array( |
|
| 807 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
| 808 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 809 | - ), |
|
| 810 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => array( |
|
| 811 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
| 812 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
| 813 | - ), |
|
| 814 | - 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => array( |
|
| 815 | - 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache |
|
| 816 | - ), |
|
| 817 | - 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => array( |
|
| 818 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 819 | - ), |
|
| 820 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => array( |
|
| 821 | - 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache |
|
| 822 | - ), |
|
| 823 | - 'EventEspresso\core\libraries\rest_api\calculations\Datetime' => array( |
|
| 824 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 825 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 826 | - ), |
|
| 827 | - 'EventEspresso\core\libraries\rest_api\calculations\Event' => array( |
|
| 828 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 829 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 830 | - ), |
|
| 831 | - 'EventEspresso\core\libraries\rest_api\calculations\Registration' => array( |
|
| 832 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 833 | - ), |
|
| 834 | - 'EventEspresso\core\services\session\SessionStartHandler' => array( |
|
| 835 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 836 | - ), |
|
| 837 | - 'EE_URL_Validation_Strategy' => array( |
|
| 838 | - null, |
|
| 839 | - null, |
|
| 840 | - 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache |
|
| 841 | - ), |
|
| 842 | - 'EventEspresso\admin_pages\general_settings\OrganizationSettings' => array( |
|
| 843 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 844 | - 'EE_Organization_Config' => EE_Dependency_Map::load_from_cache, |
|
| 845 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 846 | - 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 847 | - 'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache, |
|
| 848 | - ), |
|
| 849 | - 'EventEspresso\core\services\address\CountrySubRegionDao' => array( |
|
| 850 | - 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
| 851 | - 'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache |
|
| 852 | - ), |
|
| 853 | - 'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => array( |
|
| 854 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 855 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 856 | - ), |
|
| 857 | - 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => array( |
|
| 858 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 859 | - 'EE_Environment_Config' => EE_Dependency_Map::load_from_cache, |
|
| 860 | - ), |
|
| 861 | - 'EventEspresso\core\services\request\files\FilesDataHandler' => array( |
|
| 862 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 863 | - ), |
|
| 864 | - 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
| 865 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 866 | - ], |
|
| 867 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [ |
|
| 868 | - null, |
|
| 869 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 870 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 871 | - ], |
|
| 872 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [ |
|
| 873 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 874 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 875 | - ], |
|
| 876 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [ |
|
| 877 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 878 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 879 | - ], |
|
| 880 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [ |
|
| 881 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 882 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 883 | - ], |
|
| 884 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [ |
|
| 885 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 886 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 887 | - ], |
|
| 888 | - 'EventEspresso\core\services\graphql\GraphQLManager' => [ |
|
| 889 | - 'EventEspresso\core\services\graphql\TypesManager' => EE_Dependency_Map::load_from_cache, |
|
| 890 | - 'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache, |
|
| 891 | - ], |
|
| 892 | - 'EventEspresso\core\services\graphql\TypesManager' => [ |
|
| 893 | - 'EventEspresso\core\services\graphql\TypeCollection' => EE_Dependency_Map::load_from_cache, |
|
| 894 | - ], |
|
| 895 | - 'EventEspresso\core\services\graphql\ConnectionsManager' => [ |
|
| 896 | - 'EventEspresso\core\services\graphql\ConnectionCollection' => EE_Dependency_Map::load_from_cache, |
|
| 897 | - ], |
|
| 898 | - 'EventEspresso\core\domain\services\graphql\types\Datetime' => [ |
|
| 899 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 900 | - ], |
|
| 901 | - 'EventEspresso\core\domain\services\graphql\types\Event' => [ |
|
| 902 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 903 | - ], |
|
| 904 | - 'EventEspresso\core\domain\services\graphql\types\Ticket' => [ |
|
| 905 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 906 | - ], |
|
| 907 | - 'EventEspresso\core\domain\services\graphql\types\Venue' => [ |
|
| 908 | - 'EEM_Venue' => EE_Dependency_Map::load_from_cache, |
|
| 909 | - ], |
|
| 910 | - 'EventEspresso\core\domain\services\graphql\types\State' => [ |
|
| 911 | - 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
| 912 | - ], |
|
| 913 | - 'EventEspresso\core\domain\services\graphql\types\Country' => [ |
|
| 914 | - 'EEM_Country' => EE_Dependency_Map::load_from_cache, |
|
| 915 | - ], |
|
| 916 | - 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection' => [ |
|
| 917 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 918 | - ], |
|
| 919 | - 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection' => [ |
|
| 920 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 921 | - ], |
|
| 922 | - 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection' => [ |
|
| 923 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 924 | - ], |
|
| 925 | - 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection' => [ |
|
| 926 | - 'EEM_Venue' => EE_Dependency_Map::load_from_cache, |
|
| 927 | - ], |
|
| 928 | - ); |
|
| 929 | - } |
|
| 930 | - |
|
| 931 | - |
|
| 932 | - /** |
|
| 933 | - * Registers how core classes are loaded. |
|
| 934 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
| 935 | - * 'EE_Request_Handler' => 'load_core' |
|
| 936 | - * 'EE_Messages_Queue' => 'load_lib' |
|
| 937 | - * 'EEH_Debug_Tools' => 'load_helper' |
|
| 938 | - * or, if greater control is required, by providing a custom closure. For example: |
|
| 939 | - * 'Some_Class' => function () { |
|
| 940 | - * return new Some_Class(); |
|
| 941 | - * }, |
|
| 942 | - * This is required for instantiating dependencies |
|
| 943 | - * where an interface has been type hinted in a class constructor. For example: |
|
| 944 | - * 'Required_Interface' => function () { |
|
| 945 | - * return new A_Class_That_Implements_Required_Interface(); |
|
| 946 | - * }, |
|
| 947 | - */ |
|
| 948 | - protected function _register_core_class_loaders() |
|
| 949 | - { |
|
| 950 | - $this->_class_loaders = array( |
|
| 951 | - // load_core |
|
| 952 | - 'EE_Dependency_Map' => function () { |
|
| 953 | - return $this; |
|
| 954 | - }, |
|
| 955 | - 'EE_Capabilities' => 'load_core', |
|
| 956 | - 'EE_Encryption' => 'load_core', |
|
| 957 | - 'EE_Front_Controller' => 'load_core', |
|
| 958 | - 'EE_Module_Request_Router' => 'load_core', |
|
| 959 | - 'EE_Registry' => 'load_core', |
|
| 960 | - 'EE_Request' => function () { |
|
| 961 | - return $this->legacy_request; |
|
| 962 | - }, |
|
| 963 | - 'EventEspresso\core\services\request\Request' => function () { |
|
| 964 | - return $this->request; |
|
| 965 | - }, |
|
| 966 | - 'EventEspresso\core\services\request\Response' => function () { |
|
| 967 | - return $this->response; |
|
| 968 | - }, |
|
| 969 | - 'EE_Base' => 'load_core', |
|
| 970 | - 'EE_Request_Handler' => 'load_core', |
|
| 971 | - 'EE_Session' => 'load_core', |
|
| 972 | - 'EE_Cron_Tasks' => 'load_core', |
|
| 973 | - 'EE_System' => 'load_core', |
|
| 974 | - 'EE_Maintenance_Mode' => 'load_core', |
|
| 975 | - 'EE_Register_CPTs' => 'load_core', |
|
| 976 | - 'EE_Admin' => 'load_core', |
|
| 977 | - 'EE_CPT_Strategy' => 'load_core', |
|
| 978 | - // load_class |
|
| 979 | - 'EE_Registration_Processor' => 'load_class', |
|
| 980 | - // load_lib |
|
| 981 | - 'EE_Message_Resource_Manager' => 'load_lib', |
|
| 982 | - 'EE_Message_Type_Collection' => 'load_lib', |
|
| 983 | - 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
| 984 | - 'EE_Messenger_Collection' => 'load_lib', |
|
| 985 | - 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
| 986 | - 'EE_Messages_Processor' => 'load_lib', |
|
| 987 | - 'EE_Message_Repository' => 'load_lib', |
|
| 988 | - 'EE_Messages_Queue' => 'load_lib', |
|
| 989 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
| 990 | - 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
| 991 | - 'EE_Payment_Method_Manager' => 'load_lib', |
|
| 992 | - 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
| 993 | - 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
| 994 | - 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
| 995 | - 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
| 996 | - 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
| 997 | - 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
| 998 | - 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
| 999 | - 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
| 1000 | - 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
| 1001 | - 'EE_Messages_Generator' => function () { |
|
| 1002 | - return EE_Registry::instance()->load_lib( |
|
| 1003 | - 'Messages_Generator', |
|
| 1004 | - array(), |
|
| 1005 | - false, |
|
| 1006 | - false |
|
| 1007 | - ); |
|
| 1008 | - }, |
|
| 1009 | - 'EE_Messages_Template_Defaults' => function ($arguments = array()) { |
|
| 1010 | - return EE_Registry::instance()->load_lib( |
|
| 1011 | - 'Messages_Template_Defaults', |
|
| 1012 | - $arguments, |
|
| 1013 | - false, |
|
| 1014 | - false |
|
| 1015 | - ); |
|
| 1016 | - }, |
|
| 1017 | - // load_helper |
|
| 1018 | - 'EEH_Parse_Shortcodes' => function () { |
|
| 1019 | - if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
| 1020 | - return new EEH_Parse_Shortcodes(); |
|
| 1021 | - } |
|
| 1022 | - return null; |
|
| 1023 | - }, |
|
| 1024 | - 'EE_Template_Config' => function () { |
|
| 1025 | - return EE_Config::instance()->template_settings; |
|
| 1026 | - }, |
|
| 1027 | - 'EE_Currency_Config' => function () { |
|
| 1028 | - return EE_Config::instance()->currency; |
|
| 1029 | - }, |
|
| 1030 | - 'EE_Registration_Config' => function () { |
|
| 1031 | - return EE_Config::instance()->registration; |
|
| 1032 | - }, |
|
| 1033 | - 'EE_Core_Config' => function () { |
|
| 1034 | - return EE_Config::instance()->core; |
|
| 1035 | - }, |
|
| 1036 | - 'EventEspresso\core\services\loaders\Loader' => function () { |
|
| 1037 | - return LoaderFactory::getLoader(); |
|
| 1038 | - }, |
|
| 1039 | - 'EE_Network_Config' => function () { |
|
| 1040 | - return EE_Network_Config::instance(); |
|
| 1041 | - }, |
|
| 1042 | - 'EE_Config' => function () { |
|
| 1043 | - return EE_Config::instance(); |
|
| 1044 | - }, |
|
| 1045 | - 'EventEspresso\core\domain\Domain' => function () { |
|
| 1046 | - return DomainFactory::getEventEspressoCoreDomain(); |
|
| 1047 | - }, |
|
| 1048 | - 'EE_Admin_Config' => function () { |
|
| 1049 | - return EE_Config::instance()->admin; |
|
| 1050 | - }, |
|
| 1051 | - 'EE_Organization_Config' => function () { |
|
| 1052 | - return EE_Config::instance()->organization; |
|
| 1053 | - }, |
|
| 1054 | - 'EE_Network_Core_Config' => function () { |
|
| 1055 | - return EE_Network_Config::instance()->core; |
|
| 1056 | - }, |
|
| 1057 | - 'EE_Environment_Config' => function () { |
|
| 1058 | - return EE_Config::instance()->environment; |
|
| 1059 | - }, |
|
| 1060 | - ); |
|
| 1061 | - } |
|
| 1062 | - |
|
| 1063 | - |
|
| 1064 | - /** |
|
| 1065 | - * can be used for supplying alternate names for classes, |
|
| 1066 | - * or for connecting interface names to instantiable classes |
|
| 1067 | - */ |
|
| 1068 | - protected function _register_core_aliases() |
|
| 1069 | - { |
|
| 1070 | - $aliases = array( |
|
| 1071 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
| 1072 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
| 1073 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
| 1074 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
| 1075 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
| 1076 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
| 1077 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
| 1078 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
| 1079 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
| 1080 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
| 1081 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
| 1082 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
| 1083 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
| 1084 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
| 1085 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
| 1086 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
| 1087 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
| 1088 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
| 1089 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
| 1090 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
| 1091 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
| 1092 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
| 1093 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
| 1094 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
| 1095 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
| 1096 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
| 1097 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
| 1098 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
| 1099 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
| 1100 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
| 1101 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
| 1102 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
| 1103 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
| 1104 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
| 1105 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
| 1106 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
| 1107 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
| 1108 | - 'Registration_Processor' => 'EE_Registration_Processor', |
|
| 1109 | - ); |
|
| 1110 | - foreach ($aliases as $alias => $fqn) { |
|
| 1111 | - if (is_array($fqn)) { |
|
| 1112 | - foreach ($fqn as $class => $for_class) { |
|
| 1113 | - $this->class_cache->addAlias($class, $alias, $for_class); |
|
| 1114 | - } |
|
| 1115 | - continue; |
|
| 1116 | - } |
|
| 1117 | - $this->class_cache->addAlias($fqn, $alias); |
|
| 1118 | - } |
|
| 1119 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 1120 | - $this->class_cache->addAlias( |
|
| 1121 | - 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
| 1122 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
| 1123 | - ); |
|
| 1124 | - } |
|
| 1125 | - } |
|
| 1126 | - |
|
| 1127 | - |
|
| 1128 | - /** |
|
| 1129 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
| 1130 | - * request Primarily used by unit tests. |
|
| 1131 | - */ |
|
| 1132 | - public function reset() |
|
| 1133 | - { |
|
| 1134 | - $this->_register_core_class_loaders(); |
|
| 1135 | - $this->_register_core_dependencies(); |
|
| 1136 | - } |
|
| 1137 | - |
|
| 1138 | - |
|
| 1139 | - /** |
|
| 1140 | - * PLZ NOTE: a better name for this method would be is_alias() |
|
| 1141 | - * because it returns TRUE if the provided fully qualified name IS an alias |
|
| 1142 | - * WHY? |
|
| 1143 | - * Because if a class is type hinting for a concretion, |
|
| 1144 | - * then why would we need to find another class to supply it? |
|
| 1145 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
| 1146 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
| 1147 | - * Don't go looking for some substitute. |
|
| 1148 | - * Whereas if a class is type hinting for an interface... |
|
| 1149 | - * then we need to find an actual class to use. |
|
| 1150 | - * So the interface IS the alias for some other FQN, |
|
| 1151 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
| 1152 | - * represents some other class. |
|
| 1153 | - * |
|
| 1154 | - * @deprecated 4.9.62.p |
|
| 1155 | - * @param string $fqn |
|
| 1156 | - * @param string $for_class |
|
| 1157 | - * @return bool |
|
| 1158 | - */ |
|
| 1159 | - public function has_alias($fqn = '', $for_class = '') |
|
| 1160 | - { |
|
| 1161 | - return $this->isAlias($fqn, $for_class); |
|
| 1162 | - } |
|
| 1163 | - |
|
| 1164 | - |
|
| 1165 | - /** |
|
| 1166 | - * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
| 1167 | - * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
| 1168 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
| 1169 | - * for example: |
|
| 1170 | - * if the following two entries were added to the _aliases array: |
|
| 1171 | - * array( |
|
| 1172 | - * 'interface_alias' => 'some\namespace\interface' |
|
| 1173 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
| 1174 | - * ) |
|
| 1175 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
| 1176 | - * to load an instance of 'some\namespace\classname' |
|
| 1177 | - * |
|
| 1178 | - * @deprecated 4.9.62.p |
|
| 1179 | - * @param string $alias |
|
| 1180 | - * @param string $for_class |
|
| 1181 | - * @return string |
|
| 1182 | - */ |
|
| 1183 | - public function get_alias($alias = '', $for_class = '') |
|
| 1184 | - { |
|
| 1185 | - return $this->getFqnForAlias($alias, $for_class); |
|
| 1186 | - } |
|
| 23 | + /** |
|
| 24 | + * This means that the requested class dependency is not present in the dependency map |
|
| 25 | + */ |
|
| 26 | + const not_registered = 0; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
| 30 | + */ |
|
| 31 | + const load_new_object = 1; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
| 35 | + * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
| 36 | + */ |
|
| 37 | + const load_from_cache = 2; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * When registering a dependency, |
|
| 41 | + * this indicates to keep any existing dependencies that already exist, |
|
| 42 | + * and simply discard any new dependencies declared in the incoming data |
|
| 43 | + */ |
|
| 44 | + const KEEP_EXISTING_DEPENDENCIES = 0; |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * When registering a dependency, |
|
| 48 | + * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
| 49 | + */ |
|
| 50 | + const OVERWRITE_DEPENDENCIES = 1; |
|
| 51 | + |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * @type EE_Dependency_Map $_instance |
|
| 55 | + */ |
|
| 56 | + protected static $_instance; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * @var ClassInterfaceCache $class_cache |
|
| 60 | + */ |
|
| 61 | + private $class_cache; |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * @type RequestInterface $request |
|
| 65 | + */ |
|
| 66 | + protected $request; |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * @type LegacyRequestInterface $legacy_request |
|
| 70 | + */ |
|
| 71 | + protected $legacy_request; |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * @type ResponseInterface $response |
|
| 75 | + */ |
|
| 76 | + protected $response; |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * @type LoaderInterface $loader |
|
| 80 | + */ |
|
| 81 | + protected $loader; |
|
| 82 | + |
|
| 83 | + /** |
|
| 84 | + * @type array $_dependency_map |
|
| 85 | + */ |
|
| 86 | + protected $_dependency_map = array(); |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * @type array $_class_loaders |
|
| 90 | + */ |
|
| 91 | + protected $_class_loaders = array(); |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * EE_Dependency_Map constructor. |
|
| 96 | + * |
|
| 97 | + * @param ClassInterfaceCache $class_cache |
|
| 98 | + */ |
|
| 99 | + protected function __construct(ClassInterfaceCache $class_cache) |
|
| 100 | + { |
|
| 101 | + $this->class_cache = $class_cache; |
|
| 102 | + do_action('EE_Dependency_Map____construct', $this); |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * @return void |
|
| 108 | + */ |
|
| 109 | + public function initialize() |
|
| 110 | + { |
|
| 111 | + $this->_register_core_dependencies(); |
|
| 112 | + $this->_register_core_class_loaders(); |
|
| 113 | + $this->_register_core_aliases(); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * @singleton method used to instantiate class object |
|
| 119 | + * @param ClassInterfaceCache|null $class_cache |
|
| 120 | + * @return EE_Dependency_Map |
|
| 121 | + */ |
|
| 122 | + public static function instance(ClassInterfaceCache $class_cache = null) |
|
| 123 | + { |
|
| 124 | + // check if class object is instantiated, and instantiated properly |
|
| 125 | + if (! self::$_instance instanceof EE_Dependency_Map |
|
| 126 | + && $class_cache instanceof ClassInterfaceCache |
|
| 127 | + ) { |
|
| 128 | + self::$_instance = new EE_Dependency_Map($class_cache); |
|
| 129 | + } |
|
| 130 | + return self::$_instance; |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * @param RequestInterface $request |
|
| 136 | + */ |
|
| 137 | + public function setRequest(RequestInterface $request) |
|
| 138 | + { |
|
| 139 | + $this->request = $request; |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * @param LegacyRequestInterface $legacy_request |
|
| 145 | + */ |
|
| 146 | + public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
| 147 | + { |
|
| 148 | + $this->legacy_request = $legacy_request; |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * @param ResponseInterface $response |
|
| 154 | + */ |
|
| 155 | + public function setResponse(ResponseInterface $response) |
|
| 156 | + { |
|
| 157 | + $this->response = $response; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * @param LoaderInterface $loader |
|
| 163 | + */ |
|
| 164 | + public function setLoader(LoaderInterface $loader) |
|
| 165 | + { |
|
| 166 | + $this->loader = $loader; |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * @param string $class |
|
| 172 | + * @param array $dependencies |
|
| 173 | + * @param int $overwrite |
|
| 174 | + * @return bool |
|
| 175 | + */ |
|
| 176 | + public static function register_dependencies( |
|
| 177 | + $class, |
|
| 178 | + array $dependencies, |
|
| 179 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
| 180 | + ) { |
|
| 181 | + return self::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + |
|
| 185 | + /** |
|
| 186 | + * Assigns an array of class names and corresponding load sources (new or cached) |
|
| 187 | + * to the class specified by the first parameter. |
|
| 188 | + * IMPORTANT !!! |
|
| 189 | + * The order of elements in the incoming $dependencies array MUST match |
|
| 190 | + * the order of the constructor parameters for the class in question. |
|
| 191 | + * This is especially important when overriding any existing dependencies that are registered. |
|
| 192 | + * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
| 193 | + * |
|
| 194 | + * @param string $class |
|
| 195 | + * @param array $dependencies |
|
| 196 | + * @param int $overwrite |
|
| 197 | + * @return bool |
|
| 198 | + */ |
|
| 199 | + public function registerDependencies( |
|
| 200 | + $class, |
|
| 201 | + array $dependencies, |
|
| 202 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
| 203 | + ) { |
|
| 204 | + $class = trim($class, '\\'); |
|
| 205 | + $registered = false; |
|
| 206 | + if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
| 207 | + self::$_instance->_dependency_map[ $class ] = array(); |
|
| 208 | + } |
|
| 209 | + // we need to make sure that any aliases used when registering a dependency |
|
| 210 | + // get resolved to the correct class name |
|
| 211 | + foreach ($dependencies as $dependency => $load_source) { |
|
| 212 | + $alias = self::$_instance->getFqnForAlias($dependency); |
|
| 213 | + if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
| 214 | + || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
| 215 | + ) { |
|
| 216 | + unset($dependencies[ $dependency ]); |
|
| 217 | + $dependencies[ $alias ] = $load_source; |
|
| 218 | + $registered = true; |
|
| 219 | + } |
|
| 220 | + } |
|
| 221 | + // now add our two lists of dependencies together. |
|
| 222 | + // using Union (+=) favours the arrays in precedence from left to right, |
|
| 223 | + // so $dependencies is NOT overwritten because it is listed first |
|
| 224 | + // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
| 225 | + // Union is way faster than array_merge() but should be used with caution... |
|
| 226 | + // especially with numerically indexed arrays |
|
| 227 | + $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
| 228 | + // now we need to ensure that the resulting dependencies |
|
| 229 | + // array only has the entries that are required for the class |
|
| 230 | + // so first count how many dependencies were originally registered for the class |
|
| 231 | + $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
| 232 | + // if that count is non-zero (meaning dependencies were already registered) |
|
| 233 | + self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
| 234 | + // then truncate the final array to match that count |
|
| 235 | + ? array_slice($dependencies, 0, $dependency_count) |
|
| 236 | + // otherwise just take the incoming array because nothing previously existed |
|
| 237 | + : $dependencies; |
|
| 238 | + return $registered; |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * @param string $class_name |
|
| 244 | + * @param string $loader |
|
| 245 | + * @return bool |
|
| 246 | + * @throws DomainException |
|
| 247 | + */ |
|
| 248 | + public static function register_class_loader($class_name, $loader = 'load_core') |
|
| 249 | + { |
|
| 250 | + if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
| 251 | + throw new DomainException( |
|
| 252 | + esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
| 253 | + ); |
|
| 254 | + } |
|
| 255 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
| 256 | + if (! is_callable($loader) |
|
| 257 | + && ( |
|
| 258 | + strpos($loader, 'load_') !== 0 |
|
| 259 | + || ! method_exists('EE_Registry', $loader) |
|
| 260 | + ) |
|
| 261 | + ) { |
|
| 262 | + throw new DomainException( |
|
| 263 | + sprintf( |
|
| 264 | + esc_html__( |
|
| 265 | + '"%1$s" is not a valid loader method on EE_Registry.', |
|
| 266 | + 'event_espresso' |
|
| 267 | + ), |
|
| 268 | + $loader |
|
| 269 | + ) |
|
| 270 | + ); |
|
| 271 | + } |
|
| 272 | + $class_name = self::$_instance->getFqnForAlias($class_name); |
|
| 273 | + if (! isset(self::$_instance->_class_loaders[ $class_name ])) { |
|
| 274 | + self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
| 275 | + return true; |
|
| 276 | + } |
|
| 277 | + return false; |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + |
|
| 281 | + /** |
|
| 282 | + * @return array |
|
| 283 | + */ |
|
| 284 | + public function dependency_map() |
|
| 285 | + { |
|
| 286 | + return $this->_dependency_map; |
|
| 287 | + } |
|
| 288 | + |
|
| 289 | + |
|
| 290 | + /** |
|
| 291 | + * returns TRUE if dependency map contains a listing for the provided class name |
|
| 292 | + * |
|
| 293 | + * @param string $class_name |
|
| 294 | + * @return boolean |
|
| 295 | + */ |
|
| 296 | + public function has($class_name = '') |
|
| 297 | + { |
|
| 298 | + // all legacy models have the same dependencies |
|
| 299 | + if (strpos($class_name, 'EEM_') === 0) { |
|
| 300 | + $class_name = 'LEGACY_MODELS'; |
|
| 301 | + } |
|
| 302 | + return isset($this->_dependency_map[ $class_name ]) ? true : false; |
|
| 303 | + } |
|
| 304 | + |
|
| 305 | + |
|
| 306 | + /** |
|
| 307 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
| 308 | + * |
|
| 309 | + * @param string $class_name |
|
| 310 | + * @param string $dependency |
|
| 311 | + * @return bool |
|
| 312 | + */ |
|
| 313 | + public function has_dependency_for_class($class_name = '', $dependency = '') |
|
| 314 | + { |
|
| 315 | + // all legacy models have the same dependencies |
|
| 316 | + if (strpos($class_name, 'EEM_') === 0) { |
|
| 317 | + $class_name = 'LEGACY_MODELS'; |
|
| 318 | + } |
|
| 319 | + $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
| 320 | + return isset($this->_dependency_map[ $class_name ][ $dependency ]) |
|
| 321 | + ? true |
|
| 322 | + : false; |
|
| 323 | + } |
|
| 324 | + |
|
| 325 | + |
|
| 326 | + /** |
|
| 327 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
| 328 | + * |
|
| 329 | + * @param string $class_name |
|
| 330 | + * @param string $dependency |
|
| 331 | + * @return int |
|
| 332 | + */ |
|
| 333 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
| 334 | + { |
|
| 335 | + // all legacy models have the same dependencies |
|
| 336 | + if (strpos($class_name, 'EEM_') === 0) { |
|
| 337 | + $class_name = 'LEGACY_MODELS'; |
|
| 338 | + } |
|
| 339 | + $dependency = $this->getFqnForAlias($dependency); |
|
| 340 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
| 341 | + ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
| 342 | + : EE_Dependency_Map::not_registered; |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + |
|
| 346 | + /** |
|
| 347 | + * @param string $class_name |
|
| 348 | + * @return string | Closure |
|
| 349 | + */ |
|
| 350 | + public function class_loader($class_name) |
|
| 351 | + { |
|
| 352 | + // all legacy models use load_model() |
|
| 353 | + if (strpos($class_name, 'EEM_') === 0) { |
|
| 354 | + return 'load_model'; |
|
| 355 | + } |
|
| 356 | + // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
| 357 | + // perform strpos() first to avoid loading regex every time we load a class |
|
| 358 | + if (strpos($class_name, 'EE_CPT_') === 0 |
|
| 359 | + && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
| 360 | + ) { |
|
| 361 | + return 'load_core'; |
|
| 362 | + } |
|
| 363 | + $class_name = $this->getFqnForAlias($class_name); |
|
| 364 | + return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
| 365 | + } |
|
| 366 | + |
|
| 367 | + |
|
| 368 | + /** |
|
| 369 | + * @return array |
|
| 370 | + */ |
|
| 371 | + public function class_loaders() |
|
| 372 | + { |
|
| 373 | + return $this->_class_loaders; |
|
| 374 | + } |
|
| 375 | + |
|
| 376 | + |
|
| 377 | + /** |
|
| 378 | + * adds an alias for a classname |
|
| 379 | + * |
|
| 380 | + * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
| 381 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
| 382 | + * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
| 383 | + */ |
|
| 384 | + public function add_alias($fqcn, $alias, $for_class = '') |
|
| 385 | + { |
|
| 386 | + $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
| 387 | + } |
|
| 388 | + |
|
| 389 | + |
|
| 390 | + /** |
|
| 391 | + * Returns TRUE if the provided fully qualified name IS an alias |
|
| 392 | + * WHY? |
|
| 393 | + * Because if a class is type hinting for a concretion, |
|
| 394 | + * then why would we need to find another class to supply it? |
|
| 395 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
| 396 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
| 397 | + * Don't go looking for some substitute. |
|
| 398 | + * Whereas if a class is type hinting for an interface... |
|
| 399 | + * then we need to find an actual class to use. |
|
| 400 | + * So the interface IS the alias for some other FQN, |
|
| 401 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
| 402 | + * represents some other class. |
|
| 403 | + * |
|
| 404 | + * @param string $fqn |
|
| 405 | + * @param string $for_class |
|
| 406 | + * @return bool |
|
| 407 | + */ |
|
| 408 | + public function isAlias($fqn = '', $for_class = '') |
|
| 409 | + { |
|
| 410 | + return $this->class_cache->isAlias($fqn, $for_class); |
|
| 411 | + } |
|
| 412 | + |
|
| 413 | + |
|
| 414 | + /** |
|
| 415 | + * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
| 416 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
| 417 | + * for example: |
|
| 418 | + * if the following two entries were added to the _aliases array: |
|
| 419 | + * array( |
|
| 420 | + * 'interface_alias' => 'some\namespace\interface' |
|
| 421 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
| 422 | + * ) |
|
| 423 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
| 424 | + * to load an instance of 'some\namespace\classname' |
|
| 425 | + * |
|
| 426 | + * @param string $alias |
|
| 427 | + * @param string $for_class |
|
| 428 | + * @return string |
|
| 429 | + */ |
|
| 430 | + public function getFqnForAlias($alias = '', $for_class = '') |
|
| 431 | + { |
|
| 432 | + return (string) $this->class_cache->getFqnForAlias($alias, $for_class); |
|
| 433 | + } |
|
| 434 | + |
|
| 435 | + |
|
| 436 | + /** |
|
| 437 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
| 438 | + * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
| 439 | + * This is done by using the following class constants: |
|
| 440 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
| 441 | + * EE_Dependency_Map::load_new_object - generates a new object every time |
|
| 442 | + */ |
|
| 443 | + protected function _register_core_dependencies() |
|
| 444 | + { |
|
| 445 | + $this->_dependency_map = array( |
|
| 446 | + 'EE_Request_Handler' => array( |
|
| 447 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 448 | + ), |
|
| 449 | + 'EE_System' => array( |
|
| 450 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 451 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 452 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 453 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 454 | + ), |
|
| 455 | + 'EE_Session' => array( |
|
| 456 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 457 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
| 458 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 459 | + 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
| 460 | + 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
| 461 | + ), |
|
| 462 | + 'EE_Cart' => array( |
|
| 463 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 464 | + ), |
|
| 465 | + 'EE_Front_Controller' => array( |
|
| 466 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 467 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 468 | + 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
| 469 | + ), |
|
| 470 | + 'EE_Messenger_Collection_Loader' => array( |
|
| 471 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
| 472 | + ), |
|
| 473 | + 'EE_Message_Type_Collection_Loader' => array( |
|
| 474 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
| 475 | + ), |
|
| 476 | + 'EE_Message_Resource_Manager' => array( |
|
| 477 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
| 478 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
| 479 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
| 480 | + ), |
|
| 481 | + 'EE_Message_Factory' => array( |
|
| 482 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 483 | + ), |
|
| 484 | + 'EE_messages' => array( |
|
| 485 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 486 | + ), |
|
| 487 | + 'EE_Messages_Generator' => array( |
|
| 488 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
| 489 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
| 490 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
| 491 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
| 492 | + ), |
|
| 493 | + 'EE_Messages_Processor' => array( |
|
| 494 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 495 | + ), |
|
| 496 | + 'EE_Messages_Queue' => array( |
|
| 497 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
| 498 | + ), |
|
| 499 | + 'EE_Messages_Template_Defaults' => array( |
|
| 500 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
| 501 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
| 502 | + ), |
|
| 503 | + 'EE_Message_To_Generate_From_Request' => array( |
|
| 504 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
| 505 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 506 | + ), |
|
| 507 | + 'EventEspresso\core\services\commands\CommandBus' => array( |
|
| 508 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
| 509 | + ), |
|
| 510 | + 'EventEspresso\services\commands\CommandHandler' => array( |
|
| 511 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 512 | + 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
| 513 | + ), |
|
| 514 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => array( |
|
| 515 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 516 | + ), |
|
| 517 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => array( |
|
| 518 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
| 519 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
| 520 | + ), |
|
| 521 | + 'EventEspresso\core\services\commands\CommandFactory' => array( |
|
| 522 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 523 | + ), |
|
| 524 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => array( |
|
| 525 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
| 526 | + ), |
|
| 527 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => array( |
|
| 528 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
| 529 | + ), |
|
| 530 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => array( |
|
| 531 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
| 532 | + ), |
|
| 533 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler' => array( |
|
| 534 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 535 | + ), |
|
| 536 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler' => array( |
|
| 537 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 538 | + ), |
|
| 539 | + 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => array( |
|
| 540 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 541 | + ), |
|
| 542 | + 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => array( |
|
| 543 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 544 | + ), |
|
| 545 | + 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array( |
|
| 546 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
| 547 | + ), |
|
| 548 | + 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler' => array( |
|
| 549 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 550 | + ), |
|
| 551 | + 'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler' => array( |
|
| 552 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 553 | + ), |
|
| 554 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => array( |
|
| 555 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
| 556 | + ), |
|
| 557 | + 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler' => array( |
|
| 558 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 559 | + ), |
|
| 560 | + 'EventEspresso\core\services\database\TableManager' => array( |
|
| 561 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 562 | + ), |
|
| 563 | + 'EE_Data_Migration_Class_Base' => array( |
|
| 564 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 565 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 566 | + ), |
|
| 567 | + 'EE_DMS_Core_4_1_0' => array( |
|
| 568 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 569 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 570 | + ), |
|
| 571 | + 'EE_DMS_Core_4_2_0' => array( |
|
| 572 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 573 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 574 | + ), |
|
| 575 | + 'EE_DMS_Core_4_3_0' => array( |
|
| 576 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 577 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 578 | + ), |
|
| 579 | + 'EE_DMS_Core_4_4_0' => array( |
|
| 580 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 581 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 582 | + ), |
|
| 583 | + 'EE_DMS_Core_4_5_0' => array( |
|
| 584 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 585 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 586 | + ), |
|
| 587 | + 'EE_DMS_Core_4_6_0' => array( |
|
| 588 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 589 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 590 | + ), |
|
| 591 | + 'EE_DMS_Core_4_7_0' => array( |
|
| 592 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 593 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 594 | + ), |
|
| 595 | + 'EE_DMS_Core_4_8_0' => array( |
|
| 596 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 597 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 598 | + ), |
|
| 599 | + 'EE_DMS_Core_4_9_0' => array( |
|
| 600 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 601 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 602 | + ), |
|
| 603 | + 'EE_DMS_Core_4_10_0' => array( |
|
| 604 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
| 605 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
| 606 | + 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
| 607 | + ), |
|
| 608 | + 'EventEspresso\core\services\assets\I18nRegistry' => array( |
|
| 609 | + array(), |
|
| 610 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 611 | + ), |
|
| 612 | + 'EventEspresso\core\services\assets\Registry' => array( |
|
| 613 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 614 | + 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache, |
|
| 615 | + ), |
|
| 616 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => array( |
|
| 617 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 618 | + ), |
|
| 619 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => array( |
|
| 620 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 621 | + ), |
|
| 622 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => array( |
|
| 623 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 624 | + ), |
|
| 625 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => array( |
|
| 626 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 627 | + ), |
|
| 628 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => array( |
|
| 629 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 630 | + ), |
|
| 631 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => array( |
|
| 632 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 633 | + ), |
|
| 634 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => array( |
|
| 635 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
| 636 | + ), |
|
| 637 | + 'EventEspresso\core\services\cache\BasicCacheManager' => array( |
|
| 638 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 639 | + ), |
|
| 640 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => array( |
|
| 641 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
| 642 | + ), |
|
| 643 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array( |
|
| 644 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 645 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 646 | + ), |
|
| 647 | + 'EventEspresso\core\domain\values\EmailAddress' => array( |
|
| 648 | + null, |
|
| 649 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
| 650 | + ), |
|
| 651 | + 'EventEspresso\core\services\orm\ModelFieldFactory' => array( |
|
| 652 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 653 | + ), |
|
| 654 | + 'LEGACY_MODELS' => array( |
|
| 655 | + null, |
|
| 656 | + 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
| 657 | + ), |
|
| 658 | + 'EE_Module_Request_Router' => array( |
|
| 659 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 660 | + ), |
|
| 661 | + 'EE_Registration_Processor' => array( |
|
| 662 | + 'EE_Request' => EE_Dependency_Map::load_from_cache, |
|
| 663 | + ), |
|
| 664 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array( |
|
| 665 | + null, |
|
| 666 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
| 667 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 668 | + ), |
|
| 669 | + 'EventEspresso\core\services\licensing\LicenseService' => array( |
|
| 670 | + 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, |
|
| 671 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
| 672 | + ), |
|
| 673 | + 'EE_Admin_Transactions_List_Table' => array( |
|
| 674 | + null, |
|
| 675 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
| 676 | + ), |
|
| 677 | + 'EventEspresso\core\domain\services\pue\Stats' => array( |
|
| 678 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
| 679 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 680 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache, |
|
| 681 | + ), |
|
| 682 | + 'EventEspresso\core\domain\services\pue\Config' => array( |
|
| 683 | + 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, |
|
| 684 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
| 685 | + ), |
|
| 686 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => array( |
|
| 687 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
| 688 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 689 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 690 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 691 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 692 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
| 693 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
| 694 | + ), |
|
| 695 | + 'EventEspresso\core\domain\services\admin\ExitModal' => array( |
|
| 696 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 697 | + ), |
|
| 698 | + 'EventEspresso\core\domain\services\admin\PluginUpsells' => array( |
|
| 699 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 700 | + ), |
|
| 701 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => array( |
|
| 702 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 703 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 704 | + ), |
|
| 705 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => array( |
|
| 706 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
| 707 | + ), |
|
| 708 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => array( |
|
| 709 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 710 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 711 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
| 712 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 713 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
| 714 | + ), |
|
| 715 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => array( |
|
| 716 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 717 | + ), |
|
| 718 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => array( |
|
| 719 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 720 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 721 | + ), |
|
| 722 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => array( |
|
| 723 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 724 | + ), |
|
| 725 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => array( |
|
| 726 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 727 | + ), |
|
| 728 | + 'EE_CPT_Strategy' => array( |
|
| 729 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 730 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
| 731 | + ), |
|
| 732 | + 'EventEspresso\core\services\loaders\ObjectIdentifier' => array( |
|
| 733 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
| 734 | + ), |
|
| 735 | + 'EventEspresso\core\domain\services\assets\CoreAssetManager' => array( |
|
| 736 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 737 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
| 738 | + 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
| 739 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 740 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 741 | + ), |
|
| 742 | + 'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => array( |
|
| 743 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
| 744 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache |
|
| 745 | + ), |
|
| 746 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => array( |
|
| 747 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 748 | + ), |
|
| 749 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => array( |
|
| 750 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 751 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache |
|
| 752 | + ), |
|
| 753 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => array( |
|
| 754 | + 'EEM_Checkin' => EE_Dependency_Map::load_from_cache, |
|
| 755 | + ), |
|
| 756 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => array( |
|
| 757 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 758 | + ), |
|
| 759 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => array( |
|
| 760 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
| 761 | + ), |
|
| 762 | + 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => array( |
|
| 763 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 764 | + ), |
|
| 765 | + 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => array( |
|
| 766 | + 'EEM_Answer' => EE_Dependency_Map::load_from_cache, |
|
| 767 | + 'EEM_Question' => EE_Dependency_Map::load_from_cache, |
|
| 768 | + ), |
|
| 769 | + 'EventEspresso\core\CPTs\CptQueryModifier' => array( |
|
| 770 | + null, |
|
| 771 | + null, |
|
| 772 | + null, |
|
| 773 | + 'EE_Request_Handler' => EE_Dependency_Map::load_from_cache, |
|
| 774 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 775 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 776 | + ), |
|
| 777 | + 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => array( |
|
| 778 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 779 | + 'EE_Config' => EE_Dependency_Map::load_from_cache |
|
| 780 | + ), |
|
| 781 | + 'EventEspresso\core\services\editor\BlockRegistrationManager' => array( |
|
| 782 | + 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
| 783 | + 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
| 784 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
| 785 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 786 | + ), |
|
| 787 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => array( |
|
| 788 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 789 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
| 790 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
| 791 | + ), |
|
| 792 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => array( |
|
| 793 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 794 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 795 | + ), |
|
| 796 | + 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => array( |
|
| 797 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache, |
|
| 798 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 799 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache, |
|
| 800 | + ), |
|
| 801 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => array( |
|
| 802 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
| 803 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
| 804 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 805 | + ), |
|
| 806 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => array( |
|
| 807 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
| 808 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 809 | + ), |
|
| 810 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => array( |
|
| 811 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
| 812 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
| 813 | + ), |
|
| 814 | + 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => array( |
|
| 815 | + 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache |
|
| 816 | + ), |
|
| 817 | + 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => array( |
|
| 818 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 819 | + ), |
|
| 820 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => array( |
|
| 821 | + 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache |
|
| 822 | + ), |
|
| 823 | + 'EventEspresso\core\libraries\rest_api\calculations\Datetime' => array( |
|
| 824 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 825 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 826 | + ), |
|
| 827 | + 'EventEspresso\core\libraries\rest_api\calculations\Event' => array( |
|
| 828 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 829 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 830 | + ), |
|
| 831 | + 'EventEspresso\core\libraries\rest_api\calculations\Registration' => array( |
|
| 832 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache |
|
| 833 | + ), |
|
| 834 | + 'EventEspresso\core\services\session\SessionStartHandler' => array( |
|
| 835 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 836 | + ), |
|
| 837 | + 'EE_URL_Validation_Strategy' => array( |
|
| 838 | + null, |
|
| 839 | + null, |
|
| 840 | + 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache |
|
| 841 | + ), |
|
| 842 | + 'EventEspresso\admin_pages\general_settings\OrganizationSettings' => array( |
|
| 843 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
| 844 | + 'EE_Organization_Config' => EE_Dependency_Map::load_from_cache, |
|
| 845 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 846 | + 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
| 847 | + 'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache, |
|
| 848 | + ), |
|
| 849 | + 'EventEspresso\core\services\address\CountrySubRegionDao' => array( |
|
| 850 | + 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
| 851 | + 'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache |
|
| 852 | + ), |
|
| 853 | + 'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => array( |
|
| 854 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 855 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 856 | + ), |
|
| 857 | + 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => array( |
|
| 858 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
| 859 | + 'EE_Environment_Config' => EE_Dependency_Map::load_from_cache, |
|
| 860 | + ), |
|
| 861 | + 'EventEspresso\core\services\request\files\FilesDataHandler' => array( |
|
| 862 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 863 | + ), |
|
| 864 | + 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
| 865 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 866 | + ], |
|
| 867 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [ |
|
| 868 | + null, |
|
| 869 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 870 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
| 871 | + ], |
|
| 872 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [ |
|
| 873 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 874 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
| 875 | + ], |
|
| 876 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [ |
|
| 877 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 878 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 879 | + ], |
|
| 880 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [ |
|
| 881 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 882 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 883 | + ], |
|
| 884 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [ |
|
| 885 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 886 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 887 | + ], |
|
| 888 | + 'EventEspresso\core\services\graphql\GraphQLManager' => [ |
|
| 889 | + 'EventEspresso\core\services\graphql\TypesManager' => EE_Dependency_Map::load_from_cache, |
|
| 890 | + 'EventEspresso\core\services\graphql\ConnectionsManager' => EE_Dependency_Map::load_from_cache, |
|
| 891 | + ], |
|
| 892 | + 'EventEspresso\core\services\graphql\TypesManager' => [ |
|
| 893 | + 'EventEspresso\core\services\graphql\TypeCollection' => EE_Dependency_Map::load_from_cache, |
|
| 894 | + ], |
|
| 895 | + 'EventEspresso\core\services\graphql\ConnectionsManager' => [ |
|
| 896 | + 'EventEspresso\core\services\graphql\ConnectionCollection' => EE_Dependency_Map::load_from_cache, |
|
| 897 | + ], |
|
| 898 | + 'EventEspresso\core\domain\services\graphql\types\Datetime' => [ |
|
| 899 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 900 | + ], |
|
| 901 | + 'EventEspresso\core\domain\services\graphql\types\Event' => [ |
|
| 902 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
| 903 | + ], |
|
| 904 | + 'EventEspresso\core\domain\services\graphql\types\Ticket' => [ |
|
| 905 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 906 | + ], |
|
| 907 | + 'EventEspresso\core\domain\services\graphql\types\Venue' => [ |
|
| 908 | + 'EEM_Venue' => EE_Dependency_Map::load_from_cache, |
|
| 909 | + ], |
|
| 910 | + 'EventEspresso\core\domain\services\graphql\types\State' => [ |
|
| 911 | + 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
| 912 | + ], |
|
| 913 | + 'EventEspresso\core\domain\services\graphql\types\Country' => [ |
|
| 914 | + 'EEM_Country' => EE_Dependency_Map::load_from_cache, |
|
| 915 | + ], |
|
| 916 | + 'EventEspresso\core\domain\services\graphql\connections\EventDatetimesConnection' => [ |
|
| 917 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 918 | + ], |
|
| 919 | + 'EventEspresso\core\domain\services\graphql\connections\DatetimeTicketsConnection' => [ |
|
| 920 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
| 921 | + ], |
|
| 922 | + 'EventEspresso\core\domain\services\graphql\connections\TicketDatetimesConnection' => [ |
|
| 923 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
| 924 | + ], |
|
| 925 | + 'EventEspresso\core\domain\services\graphql\connections\EventVenuesConnection' => [ |
|
| 926 | + 'EEM_Venue' => EE_Dependency_Map::load_from_cache, |
|
| 927 | + ], |
|
| 928 | + ); |
|
| 929 | + } |
|
| 930 | + |
|
| 931 | + |
|
| 932 | + /** |
|
| 933 | + * Registers how core classes are loaded. |
|
| 934 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
| 935 | + * 'EE_Request_Handler' => 'load_core' |
|
| 936 | + * 'EE_Messages_Queue' => 'load_lib' |
|
| 937 | + * 'EEH_Debug_Tools' => 'load_helper' |
|
| 938 | + * or, if greater control is required, by providing a custom closure. For example: |
|
| 939 | + * 'Some_Class' => function () { |
|
| 940 | + * return new Some_Class(); |
|
| 941 | + * }, |
|
| 942 | + * This is required for instantiating dependencies |
|
| 943 | + * where an interface has been type hinted in a class constructor. For example: |
|
| 944 | + * 'Required_Interface' => function () { |
|
| 945 | + * return new A_Class_That_Implements_Required_Interface(); |
|
| 946 | + * }, |
|
| 947 | + */ |
|
| 948 | + protected function _register_core_class_loaders() |
|
| 949 | + { |
|
| 950 | + $this->_class_loaders = array( |
|
| 951 | + // load_core |
|
| 952 | + 'EE_Dependency_Map' => function () { |
|
| 953 | + return $this; |
|
| 954 | + }, |
|
| 955 | + 'EE_Capabilities' => 'load_core', |
|
| 956 | + 'EE_Encryption' => 'load_core', |
|
| 957 | + 'EE_Front_Controller' => 'load_core', |
|
| 958 | + 'EE_Module_Request_Router' => 'load_core', |
|
| 959 | + 'EE_Registry' => 'load_core', |
|
| 960 | + 'EE_Request' => function () { |
|
| 961 | + return $this->legacy_request; |
|
| 962 | + }, |
|
| 963 | + 'EventEspresso\core\services\request\Request' => function () { |
|
| 964 | + return $this->request; |
|
| 965 | + }, |
|
| 966 | + 'EventEspresso\core\services\request\Response' => function () { |
|
| 967 | + return $this->response; |
|
| 968 | + }, |
|
| 969 | + 'EE_Base' => 'load_core', |
|
| 970 | + 'EE_Request_Handler' => 'load_core', |
|
| 971 | + 'EE_Session' => 'load_core', |
|
| 972 | + 'EE_Cron_Tasks' => 'load_core', |
|
| 973 | + 'EE_System' => 'load_core', |
|
| 974 | + 'EE_Maintenance_Mode' => 'load_core', |
|
| 975 | + 'EE_Register_CPTs' => 'load_core', |
|
| 976 | + 'EE_Admin' => 'load_core', |
|
| 977 | + 'EE_CPT_Strategy' => 'load_core', |
|
| 978 | + // load_class |
|
| 979 | + 'EE_Registration_Processor' => 'load_class', |
|
| 980 | + // load_lib |
|
| 981 | + 'EE_Message_Resource_Manager' => 'load_lib', |
|
| 982 | + 'EE_Message_Type_Collection' => 'load_lib', |
|
| 983 | + 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
| 984 | + 'EE_Messenger_Collection' => 'load_lib', |
|
| 985 | + 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
| 986 | + 'EE_Messages_Processor' => 'load_lib', |
|
| 987 | + 'EE_Message_Repository' => 'load_lib', |
|
| 988 | + 'EE_Messages_Queue' => 'load_lib', |
|
| 989 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
| 990 | + 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
| 991 | + 'EE_Payment_Method_Manager' => 'load_lib', |
|
| 992 | + 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
| 993 | + 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
| 994 | + 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
| 995 | + 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
| 996 | + 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
| 997 | + 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
| 998 | + 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
| 999 | + 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
| 1000 | + 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
| 1001 | + 'EE_Messages_Generator' => function () { |
|
| 1002 | + return EE_Registry::instance()->load_lib( |
|
| 1003 | + 'Messages_Generator', |
|
| 1004 | + array(), |
|
| 1005 | + false, |
|
| 1006 | + false |
|
| 1007 | + ); |
|
| 1008 | + }, |
|
| 1009 | + 'EE_Messages_Template_Defaults' => function ($arguments = array()) { |
|
| 1010 | + return EE_Registry::instance()->load_lib( |
|
| 1011 | + 'Messages_Template_Defaults', |
|
| 1012 | + $arguments, |
|
| 1013 | + false, |
|
| 1014 | + false |
|
| 1015 | + ); |
|
| 1016 | + }, |
|
| 1017 | + // load_helper |
|
| 1018 | + 'EEH_Parse_Shortcodes' => function () { |
|
| 1019 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
| 1020 | + return new EEH_Parse_Shortcodes(); |
|
| 1021 | + } |
|
| 1022 | + return null; |
|
| 1023 | + }, |
|
| 1024 | + 'EE_Template_Config' => function () { |
|
| 1025 | + return EE_Config::instance()->template_settings; |
|
| 1026 | + }, |
|
| 1027 | + 'EE_Currency_Config' => function () { |
|
| 1028 | + return EE_Config::instance()->currency; |
|
| 1029 | + }, |
|
| 1030 | + 'EE_Registration_Config' => function () { |
|
| 1031 | + return EE_Config::instance()->registration; |
|
| 1032 | + }, |
|
| 1033 | + 'EE_Core_Config' => function () { |
|
| 1034 | + return EE_Config::instance()->core; |
|
| 1035 | + }, |
|
| 1036 | + 'EventEspresso\core\services\loaders\Loader' => function () { |
|
| 1037 | + return LoaderFactory::getLoader(); |
|
| 1038 | + }, |
|
| 1039 | + 'EE_Network_Config' => function () { |
|
| 1040 | + return EE_Network_Config::instance(); |
|
| 1041 | + }, |
|
| 1042 | + 'EE_Config' => function () { |
|
| 1043 | + return EE_Config::instance(); |
|
| 1044 | + }, |
|
| 1045 | + 'EventEspresso\core\domain\Domain' => function () { |
|
| 1046 | + return DomainFactory::getEventEspressoCoreDomain(); |
|
| 1047 | + }, |
|
| 1048 | + 'EE_Admin_Config' => function () { |
|
| 1049 | + return EE_Config::instance()->admin; |
|
| 1050 | + }, |
|
| 1051 | + 'EE_Organization_Config' => function () { |
|
| 1052 | + return EE_Config::instance()->organization; |
|
| 1053 | + }, |
|
| 1054 | + 'EE_Network_Core_Config' => function () { |
|
| 1055 | + return EE_Network_Config::instance()->core; |
|
| 1056 | + }, |
|
| 1057 | + 'EE_Environment_Config' => function () { |
|
| 1058 | + return EE_Config::instance()->environment; |
|
| 1059 | + }, |
|
| 1060 | + ); |
|
| 1061 | + } |
|
| 1062 | + |
|
| 1063 | + |
|
| 1064 | + /** |
|
| 1065 | + * can be used for supplying alternate names for classes, |
|
| 1066 | + * or for connecting interface names to instantiable classes |
|
| 1067 | + */ |
|
| 1068 | + protected function _register_core_aliases() |
|
| 1069 | + { |
|
| 1070 | + $aliases = array( |
|
| 1071 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
| 1072 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
| 1073 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
| 1074 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
| 1075 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
| 1076 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
| 1077 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
| 1078 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
| 1079 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
| 1080 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
| 1081 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
| 1082 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand', |
|
| 1083 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
| 1084 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
| 1085 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
| 1086 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand', |
|
| 1087 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler', |
|
| 1088 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler', |
|
| 1089 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
| 1090 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
| 1091 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
| 1092 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
| 1093 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
| 1094 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
| 1095 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
| 1096 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
| 1097 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
| 1098 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
| 1099 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
| 1100 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
| 1101 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
| 1102 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
| 1103 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
| 1104 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
| 1105 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
| 1106 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
| 1107 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
| 1108 | + 'Registration_Processor' => 'EE_Registration_Processor', |
|
| 1109 | + ); |
|
| 1110 | + foreach ($aliases as $alias => $fqn) { |
|
| 1111 | + if (is_array($fqn)) { |
|
| 1112 | + foreach ($fqn as $class => $for_class) { |
|
| 1113 | + $this->class_cache->addAlias($class, $alias, $for_class); |
|
| 1114 | + } |
|
| 1115 | + continue; |
|
| 1116 | + } |
|
| 1117 | + $this->class_cache->addAlias($fqn, $alias); |
|
| 1118 | + } |
|
| 1119 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 1120 | + $this->class_cache->addAlias( |
|
| 1121 | + 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
| 1122 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
| 1123 | + ); |
|
| 1124 | + } |
|
| 1125 | + } |
|
| 1126 | + |
|
| 1127 | + |
|
| 1128 | + /** |
|
| 1129 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
| 1130 | + * request Primarily used by unit tests. |
|
| 1131 | + */ |
|
| 1132 | + public function reset() |
|
| 1133 | + { |
|
| 1134 | + $this->_register_core_class_loaders(); |
|
| 1135 | + $this->_register_core_dependencies(); |
|
| 1136 | + } |
|
| 1137 | + |
|
| 1138 | + |
|
| 1139 | + /** |
|
| 1140 | + * PLZ NOTE: a better name for this method would be is_alias() |
|
| 1141 | + * because it returns TRUE if the provided fully qualified name IS an alias |
|
| 1142 | + * WHY? |
|
| 1143 | + * Because if a class is type hinting for a concretion, |
|
| 1144 | + * then why would we need to find another class to supply it? |
|
| 1145 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
| 1146 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
| 1147 | + * Don't go looking for some substitute. |
|
| 1148 | + * Whereas if a class is type hinting for an interface... |
|
| 1149 | + * then we need to find an actual class to use. |
|
| 1150 | + * So the interface IS the alias for some other FQN, |
|
| 1151 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
| 1152 | + * represents some other class. |
|
| 1153 | + * |
|
| 1154 | + * @deprecated 4.9.62.p |
|
| 1155 | + * @param string $fqn |
|
| 1156 | + * @param string $for_class |
|
| 1157 | + * @return bool |
|
| 1158 | + */ |
|
| 1159 | + public function has_alias($fqn = '', $for_class = '') |
|
| 1160 | + { |
|
| 1161 | + return $this->isAlias($fqn, $for_class); |
|
| 1162 | + } |
|
| 1163 | + |
|
| 1164 | + |
|
| 1165 | + /** |
|
| 1166 | + * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
| 1167 | + * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
| 1168 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
| 1169 | + * for example: |
|
| 1170 | + * if the following two entries were added to the _aliases array: |
|
| 1171 | + * array( |
|
| 1172 | + * 'interface_alias' => 'some\namespace\interface' |
|
| 1173 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
| 1174 | + * ) |
|
| 1175 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
| 1176 | + * to load an instance of 'some\namespace\classname' |
|
| 1177 | + * |
|
| 1178 | + * @deprecated 4.9.62.p |
|
| 1179 | + * @param string $alias |
|
| 1180 | + * @param string $for_class |
|
| 1181 | + * @return string |
|
| 1182 | + */ |
|
| 1183 | + public function get_alias($alias = '', $for_class = '') |
|
| 1184 | + { |
|
| 1185 | + return $this->getFqnForAlias($alias, $for_class); |
|
| 1186 | + } |
|
| 1187 | 1187 | } |
@@ -33,29 +33,29 @@ |
||
| 33 | 33 | interface ConnectionInterface |
| 34 | 34 | { |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @return array |
|
| 38 | - * @since $VID:$ |
|
| 39 | - */ |
|
| 40 | - public function config(); |
|
| 36 | + /** |
|
| 37 | + * @return array |
|
| 38 | + * @since $VID:$ |
|
| 39 | + */ |
|
| 40 | + public function config(); |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @param $entity |
|
| 44 | - * @param $args |
|
| 45 | - * @param $context |
|
| 46 | - * @param $info |
|
| 47 | - * @return array |
|
| 48 | - * @since $VID:$ |
|
| 49 | - */ |
|
| 50 | - public function resolveConnection($entity, $args, $context, $info); |
|
| 42 | + /** |
|
| 43 | + * @param $entity |
|
| 44 | + * @param $args |
|
| 45 | + * @param $context |
|
| 46 | + * @param $info |
|
| 47 | + * @return array |
|
| 48 | + * @since $VID:$ |
|
| 49 | + */ |
|
| 50 | + public function resolveConnection($entity, $args, $context, $info); |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @param $id |
|
| 54 | - * @param $args |
|
| 55 | - * @param $context |
|
| 56 | - * @param $info |
|
| 57 | - * @return EE_Base_Class |
|
| 58 | - * @since $VID:$ |
|
| 59 | - */ |
|
| 60 | - public function resolveNode($id, $args, $context, $info); |
|
| 52 | + /** |
|
| 53 | + * @param $id |
|
| 54 | + * @param $args |
|
| 55 | + * @param $context |
|
| 56 | + * @param $info |
|
| 57 | + * @return EE_Base_Class |
|
| 58 | + * @since $VID:$ |
|
| 59 | + */ |
|
| 60 | + public function resolveNode($id, $args, $context, $info); |
|
| 61 | 61 | } |
| 62 | 62 | \ No newline at end of file |
@@ -31,27 +31,27 @@ |
||
| 31 | 31 | interface TypeInterface |
| 32 | 32 | { |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @return string |
|
| 36 | - * @since $VID:$ |
|
| 37 | - */ |
|
| 38 | - public function name(); |
|
| 34 | + /** |
|
| 35 | + * @return string |
|
| 36 | + * @since $VID:$ |
|
| 37 | + */ |
|
| 38 | + public function name(); |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @return string |
|
| 42 | - * @since $VID:$ |
|
| 43 | - */ |
|
| 44 | - public function description(); |
|
| 40 | + /** |
|
| 41 | + * @return string |
|
| 42 | + * @since $VID:$ |
|
| 43 | + */ |
|
| 44 | + public function description(); |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * @return array |
|
| 48 | - * @since $VID:$ |
|
| 49 | - */ |
|
| 50 | - public function fields(); |
|
| 46 | + /** |
|
| 47 | + * @return array |
|
| 48 | + * @since $VID:$ |
|
| 49 | + */ |
|
| 50 | + public function fields(); |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @return bool |
|
| 54 | - * @since $VID:$ |
|
| 55 | - */ |
|
| 56 | - public function isCustomPostType(); |
|
| 52 | + /** |
|
| 53 | + * @return bool |
|
| 54 | + * @since $VID:$ |
|
| 55 | + */ |
|
| 56 | + public function isCustomPostType(); |
|
| 57 | 57 | } |
| 58 | 58 | \ No newline at end of file |
@@ -21,86 +21,86 @@ |
||
| 21 | 21 | class ResolverCollection extends Collection |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - const COLLECTION_NAME = 'espresso_graphql_resolvers'; |
|
| 24 | + const COLLECTION_NAME = 'espresso_graphql_resolvers'; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @var CollectionLoader $loader |
|
| 28 | - */ |
|
| 29 | - protected $loader; |
|
| 26 | + /** |
|
| 27 | + * @var CollectionLoader $loader |
|
| 28 | + */ |
|
| 29 | + protected $loader; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * ResolverCollection constructor |
|
| 33 | - * |
|
| 34 | - * @throws InvalidInterfaceException |
|
| 35 | - */ |
|
| 36 | - public function __construct() |
|
| 37 | - { |
|
| 38 | - parent::__construct( |
|
| 39 | - 'EventEspresso\core\services\graphql\ResolverInterface', |
|
| 40 | - ResolverCollection::COLLECTION_NAME |
|
| 41 | - ); |
|
| 42 | - } |
|
| 31 | + /** |
|
| 32 | + * ResolverCollection constructor |
|
| 33 | + * |
|
| 34 | + * @throws InvalidInterfaceException |
|
| 35 | + */ |
|
| 36 | + public function __construct() |
|
| 37 | + { |
|
| 38 | + parent::__construct( |
|
| 39 | + 'EventEspresso\core\services\graphql\ResolverInterface', |
|
| 40 | + ResolverCollection::COLLECTION_NAME |
|
| 41 | + ); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @throws CollectionDetailsException |
|
| 47 | - * @throws CollectionLoaderException |
|
| 48 | - * @since $VID:$ |
|
| 49 | - */ |
|
| 50 | - private function loadCollection() |
|
| 51 | - { |
|
| 52 | - if (! $this->loader instanceof CollectionLoader) { |
|
| 53 | - $this->loader = new CollectionLoader( |
|
| 54 | - new CollectionDetails( |
|
| 55 | - // collection name |
|
| 56 | - ResolverCollection::COLLECTION_NAME, |
|
| 57 | - // collection interface |
|
| 58 | - 'EventEspresso\core\services\graphql\ResolverInterface', |
|
| 59 | - // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
| 60 | - apply_filters( |
|
| 61 | - 'FHEE__EventEspresso_core_services_graphql_ResolverCollection__loadCollection__collection_FQCNs', |
|
| 62 | - ['EventEspresso\core\domain\services\graphql\resolvers'] |
|
| 63 | - ), |
|
| 64 | - // filepaths to classes to add |
|
| 65 | - array(), |
|
| 66 | - // file mask to use if parsing folder for files to add |
|
| 67 | - '', |
|
| 68 | - // what to use as identifier for collection entities |
|
| 69 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
| 70 | - CollectionDetails::ID_CLASS_NAME |
|
| 71 | - ), |
|
| 72 | - $this |
|
| 73 | - ); |
|
| 74 | - } |
|
| 75 | - } |
|
| 45 | + /** |
|
| 46 | + * @throws CollectionDetailsException |
|
| 47 | + * @throws CollectionLoaderException |
|
| 48 | + * @since $VID:$ |
|
| 49 | + */ |
|
| 50 | + private function loadCollection() |
|
| 51 | + { |
|
| 52 | + if (! $this->loader instanceof CollectionLoader) { |
|
| 53 | + $this->loader = new CollectionLoader( |
|
| 54 | + new CollectionDetails( |
|
| 55 | + // collection name |
|
| 56 | + ResolverCollection::COLLECTION_NAME, |
|
| 57 | + // collection interface |
|
| 58 | + 'EventEspresso\core\services\graphql\ResolverInterface', |
|
| 59 | + // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
| 60 | + apply_filters( |
|
| 61 | + 'FHEE__EventEspresso_core_services_graphql_ResolverCollection__loadCollection__collection_FQCNs', |
|
| 62 | + ['EventEspresso\core\domain\services\graphql\resolvers'] |
|
| 63 | + ), |
|
| 64 | + // filepaths to classes to add |
|
| 65 | + array(), |
|
| 66 | + // file mask to use if parsing folder for files to add |
|
| 67 | + '', |
|
| 68 | + // what to use as identifier for collection entities |
|
| 69 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
| 70 | + CollectionDetails::ID_CLASS_NAME |
|
| 71 | + ), |
|
| 72 | + $this |
|
| 73 | + ); |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * @return CollectionInterface |
|
| 80 | - * @throws CollectionDetailsException |
|
| 81 | - * @throws CollectionLoaderException |
|
| 82 | - * @since $VID:$ |
|
| 83 | - */ |
|
| 84 | - public function loadResolvers() |
|
| 85 | - { |
|
| 86 | - $this->loadCollection(); |
|
| 87 | - return $this->loader->getCollection(); |
|
| 88 | - } |
|
| 78 | + /** |
|
| 79 | + * @return CollectionInterface |
|
| 80 | + * @throws CollectionDetailsException |
|
| 81 | + * @throws CollectionLoaderException |
|
| 82 | + * @since $VID:$ |
|
| 83 | + */ |
|
| 84 | + public function loadResolvers() |
|
| 85 | + { |
|
| 86 | + $this->loadCollection(); |
|
| 87 | + return $this->loader->getCollection(); |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * getIdentifier |
|
| 93 | - * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
| 94 | - * If no $identifier is supplied, then the fully qualified class name is used |
|
| 95 | - * |
|
| 96 | - * @param $object |
|
| 97 | - * @param mixed $identifier |
|
| 98 | - * @return bool |
|
| 99 | - */ |
|
| 100 | - public function getIdentifier($object, $identifier = null) |
|
| 101 | - { |
|
| 102 | - return ! empty($identifier) |
|
| 103 | - ? $identifier |
|
| 104 | - : get_class($object); |
|
| 105 | - } |
|
| 91 | + /** |
|
| 92 | + * getIdentifier |
|
| 93 | + * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
| 94 | + * If no $identifier is supplied, then the fully qualified class name is used |
|
| 95 | + * |
|
| 96 | + * @param $object |
|
| 97 | + * @param mixed $identifier |
|
| 98 | + * @return bool |
|
| 99 | + */ |
|
| 100 | + public function getIdentifier($object, $identifier = null) |
|
| 101 | + { |
|
| 102 | + return ! empty($identifier) |
|
| 103 | + ? $identifier |
|
| 104 | + : get_class($object); |
|
| 105 | + } |
|
| 106 | 106 | } |
| 107 | 107 | \ No newline at end of file |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | private function loadCollection() |
| 51 | 51 | { |
| 52 | - if (! $this->loader instanceof CollectionLoader) { |
|
| 52 | + if ( ! $this->loader instanceof CollectionLoader) { |
|
| 53 | 53 | $this->loader = new CollectionLoader( |
| 54 | 54 | new CollectionDetails( |
| 55 | 55 | // collection name |