@@ -5,13 +5,11 @@ |
||
| 5 | 5 | use EE_Datetime; |
| 6 | 6 | use EventEspresso\core\domain\services\graphql\types\Datetime; |
| 7 | 7 | use EventEspresso\core\domain\services\graphql\data\mutations\DatetimeMutation; |
| 8 | - |
|
| 9 | 8 | use EE_Error; |
| 10 | 9 | use InvalidArgumentException; |
| 11 | 10 | use ReflectionException; |
| 12 | 11 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
| 13 | 12 | use EventEspresso\core\exceptions\InvalidInterfaceException; |
| 14 | - |
|
| 15 | 13 | use GraphQL\Type\Definition\ResolveInfo; |
| 16 | 14 | use WPGraphQL\AppContext; |
| 17 | 15 | use GraphQL\Error\UserError; |
@@ -42,15 +42,15 @@ discard block |
||
| 42 | 42 | * @throws InvalidDataTypeException |
| 43 | 43 | * @throws EE_Error |
| 44 | 44 | */ |
| 45 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) |
|
| 45 | + return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) |
|
| 46 | 46 | { |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Stop now if a user isn't allowed to create a datetime. |
| 50 | 50 | */ |
| 51 | - if (! current_user_can('ee_edit_events')) { |
|
| 51 | + if ( ! current_user_can('ee_edit_events')) { |
|
| 52 | 52 | // translators: the %1$s is the name of the object being mutated |
| 53 | - throw new UserError(sprintf(__('Sorry, you are not allowed to create %1$s', 'event_espresso' ), $type->name())); |
|
| 53 | + throw new UserError(sprintf(__('Sorry, you are not allowed to create %1$s', 'event_espresso'), $type->name())); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $args = DatetimeMutation::prepare_fields($input); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $id = $entity->save(); |
| 60 | 60 | |
| 61 | 61 | if (empty($id)) { |
| 62 | - throw new UserError(__( 'The object failed to create but no error was provided', 'event_espresso')); |
|
| 62 | + throw new UserError(__('The object failed to create but no error was provided', 'event_espresso')); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | return [ |
@@ -4,13 +4,11 @@ |
||
| 4 | 4 | use EEM_Datetime; |
| 5 | 5 | use EE_Datetime; |
| 6 | 6 | use EventEspresso\core\domain\services\graphql\types\Datetime; |
| 7 | - |
|
| 8 | 7 | use EE_Error; |
| 9 | 8 | use InvalidArgumentException; |
| 10 | 9 | use ReflectionException; |
| 11 | 10 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
| 12 | 11 | use EventEspresso\core\exceptions\InvalidInterfaceException; |
| 13 | - |
|
| 14 | 12 | use GraphQL\Type\Definition\ResolveInfo; |
| 15 | 13 | use WPGraphQL\AppContext; |
| 16 | 14 | use GraphQL\Error\UserError; |
@@ -40,14 +40,14 @@ discard block |
||
| 40 | 40 | * @throws InvalidDataTypeException |
| 41 | 41 | * @throws EE_Error |
| 42 | 42 | */ |
| 43 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) |
|
| 43 | + return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) |
|
| 44 | 44 | { |
| 45 | 45 | /** |
| 46 | 46 | * Stop now if a user isn't allowed to create a datetime. |
| 47 | 47 | */ |
| 48 | - if (! current_user_can('ee_edit_events')) { |
|
| 48 | + if ( ! current_user_can('ee_edit_events')) { |
|
| 49 | 49 | // translators: the %1$s is the name of the object being mutated |
| 50 | - throw new UserError(sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso' ), $type->name())); |
|
| 50 | + throw new UserError(sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $id = ! empty($input['id']) ? absint($input['id']) : 0; |
@@ -60,16 +60,16 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * If there's no existing datetime, throw an exception |
| 62 | 62 | */ |
| 63 | - if (! $id || ! ($entity instanceof EE_Datetime)) { |
|
| 63 | + if ( ! $id || ! ($entity instanceof EE_Datetime)) { |
|
| 64 | 64 | // translators: the placeholder is the name of the type being updated |
| 65 | - throw new UserError(sprintf(__( 'No %1$s could be found to delete', 'event_espresso' ), $type->name())); |
|
| 65 | + throw new UserError(sprintf(__('No %1$s could be found to delete', 'event_espresso'), $type->name())); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // Delete the entity |
| 69 | 69 | $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete(); |
| 70 | 70 | |
| 71 | 71 | if (empty($result)) { |
| 72 | - throw new UserError(__( 'The object failed to delete but no error was provided', 'event_espresso')); |
|
| 72 | + throw new UserError(__('The object failed to delete but no error was provided', 'event_espresso')); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | return [ |
@@ -5,13 +5,11 @@ |
||
| 5 | 5 | use EE_Datetime; |
| 6 | 6 | use EventEspresso\core\domain\services\graphql\types\Datetime; |
| 7 | 7 | use EventEspresso\core\domain\services\graphql\data\mutations\DatetimeMutation; |
| 8 | - |
|
| 9 | 8 | use EE_Error; |
| 10 | 9 | use InvalidArgumentException; |
| 11 | 10 | use ReflectionException; |
| 12 | 11 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
| 13 | 12 | use EventEspresso\core\exceptions\InvalidInterfaceException; |
| 14 | - |
|
| 15 | 13 | use GraphQL\Type\Definition\ResolveInfo; |
| 16 | 14 | use WPGraphQL\AppContext; |
| 17 | 15 | use GraphQL\Error\UserError; |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | * @throws InvalidDataTypeException |
| 42 | 42 | * @throws EE_Error |
| 43 | 43 | */ |
| 44 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) |
|
| 44 | + return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) |
|
| 45 | 45 | { |
| 46 | 46 | /** |
| 47 | 47 | * Stop now if a user isn't allowed to create a datetime. |
| 48 | 48 | */ |
| 49 | - if (! current_user_can('ee_edit_events')) { |
|
| 49 | + if ( ! current_user_can('ee_edit_events')) { |
|
| 50 | 50 | // translators: the %1$s is the name of the object being mutated |
| 51 | - throw new UserError(sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso' ), $type->name())); |
|
| 51 | + throw new UserError(sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | $id = ! empty($input['id']) ? absint($input['id']) : 0; |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * If there's no existing datetime, throw an exception |
| 63 | 63 | */ |
| 64 | - if (! $id || ! ($entity instanceof EE_Datetime)) { |
|
| 64 | + if ( ! $id || ! ($entity instanceof EE_Datetime)) { |
|
| 65 | 65 | // translators: the placeholder is the name of the type being updated |
| 66 | - throw new UserError(sprintf(__( 'No %1$s could be found to update', 'event_espresso' ), $type->name())); |
|
| 66 | + throw new UserError(sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name())); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $args = DatetimeMutation::prepare_fields($input); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $result = $entity->save($args); |
| 73 | 73 | |
| 74 | 74 | if (empty($result)) { |
| 75 | - throw new UserError(__( 'The object failed to update but no error was provided', 'event_espresso')); |
|
| 75 | + throw new UserError(__('The object failed to update but no error was provided', 'event_espresso')); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | return [ |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * |
| 25 | 25 | * @param EEM_Ticket $model |
| 26 | 26 | * @param Ticket $type |
| 27 | - * @return callable |
|
| 27 | + * @return \Closure |
|
| 28 | 28 | */ |
| 29 | 29 | public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
| 30 | 30 | { |
@@ -5,13 +5,11 @@ |
||
| 5 | 5 | use EE_Ticket; |
| 6 | 6 | use EventEspresso\core\domain\services\graphql\types\Ticket; |
| 7 | 7 | use EventEspresso\core\domain\services\graphql\data\mutations\TicketMutation; |
| 8 | - |
|
| 9 | 8 | use EE_Error; |
| 10 | 9 | use InvalidArgumentException; |
| 11 | 10 | use ReflectionException; |
| 12 | 11 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
| 13 | 12 | use EventEspresso\core\exceptions\InvalidInterfaceException; |
| 14 | - |
|
| 15 | 13 | use GraphQL\Type\Definition\ResolveInfo; |
| 16 | 14 | use WPGraphQL\AppContext; |
| 17 | 15 | use GraphQL\Error\UserError; |
@@ -22,8 +22,8 @@ |
||
| 22 | 22 | /** |
| 23 | 23 | * Defines the mutation data modification closure. |
| 24 | 24 | * |
| 25 | - * @param EEM_Ticket $model |
|
| 26 | - * @param Ticket $type |
|
| 25 | + * @param EEM_Ticket $model |
|
| 26 | + * @param Ticket $type |
|
| 27 | 27 | * @return callable |
| 28 | 28 | */ |
| 29 | 29 | public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
@@ -42,15 +42,15 @@ discard block |
||
| 42 | 42 | * @throws InvalidDataTypeException |
| 43 | 43 | * @throws EE_Error |
| 44 | 44 | */ |
| 45 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) |
|
| 45 | + return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) |
|
| 46 | 46 | { |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Stop now if a user isn't allowed to create a datetime. |
| 50 | 50 | */ |
| 51 | - if (! current_user_can('ee_edit_events')) { |
|
| 51 | + if ( ! current_user_can('ee_edit_events')) { |
|
| 52 | 52 | // translators: the %1$s is the name of the object being mutated |
| 53 | - throw new UserError(sprintf(__('Sorry, you are not allowed to create %1$s', 'event_espresso' ), $type->name())); |
|
| 53 | + throw new UserError(sprintf(__('Sorry, you are not allowed to create %1$s', 'event_espresso'), $type->name())); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $args = TicketMutation::prepare_fields($input); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $id = $entity->save(); |
| 60 | 60 | |
| 61 | 61 | if (empty($id)) { |
| 62 | - throw new UserError(__( 'The object failed to create but no error was provided', 'event_espresso')); |
|
| 62 | + throw new UserError(__('The object failed to create but no error was provided', 'event_espresso')); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | return [ |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @param EEM_Ticket $model |
| 24 | 24 | * @param Ticket $type |
| 25 | - * @return callable |
|
| 25 | + * @return \Closure |
|
| 26 | 26 | */ |
| 27 | 27 | public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
| 28 | 28 | { |
@@ -4,13 +4,11 @@ |
||
| 4 | 4 | use EEM_Ticket; |
| 5 | 5 | use EE_Ticket; |
| 6 | 6 | use EventEspresso\core\domain\services\graphql\types\Ticket; |
| 7 | - |
|
| 8 | 7 | use EE_Error; |
| 9 | 8 | use InvalidArgumentException; |
| 10 | 9 | use ReflectionException; |
| 11 | 10 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
| 12 | 11 | use EventEspresso\core\exceptions\InvalidInterfaceException; |
| 13 | - |
|
| 14 | 12 | use GraphQL\Type\Definition\ResolveInfo; |
| 15 | 13 | use WPGraphQL\AppContext; |
| 16 | 14 | use GraphQL\Error\UserError; |
@@ -20,8 +20,8 @@ |
||
| 20 | 20 | /** |
| 21 | 21 | * Defines the mutation data modification closure. |
| 22 | 22 | * |
| 23 | - * @param EEM_Ticket $model |
|
| 24 | - * @param Ticket $type |
|
| 23 | + * @param EEM_Ticket $model |
|
| 24 | + * @param Ticket $type |
|
| 25 | 25 | * @return callable |
| 26 | 26 | */ |
| 27 | 27 | public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
@@ -40,14 +40,14 @@ discard block |
||
| 40 | 40 | * @throws InvalidDataTypeException |
| 41 | 41 | * @throws EE_Error |
| 42 | 42 | */ |
| 43 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) |
|
| 43 | + return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) |
|
| 44 | 44 | { |
| 45 | 45 | /** |
| 46 | 46 | * Stop now if a user isn't allowed to create a datetime. |
| 47 | 47 | */ |
| 48 | - if (! current_user_can('ee_edit_events')) { |
|
| 48 | + if ( ! current_user_can('ee_edit_events')) { |
|
| 49 | 49 | // translators: the %1$s is the name of the object being mutated |
| 50 | - throw new UserError(sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso' ), $type->name())); |
|
| 50 | + throw new UserError(sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $id = ! empty($input['id']) ? absint($input['id']) : 0; |
@@ -60,16 +60,16 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * If there's no existing datetime, throw an exception |
| 62 | 62 | */ |
| 63 | - if (! $id || ! ($entity instanceof EE_Ticket)) { |
|
| 63 | + if ( ! $id || ! ($entity instanceof EE_Ticket)) { |
|
| 64 | 64 | // translators: the placeholder is the name of the type being updated |
| 65 | - throw new UserError(sprintf(__( 'No %1$s could be found to delete', 'event_espresso' ), $type->name())); |
|
| 65 | + throw new UserError(sprintf(__('No %1$s could be found to delete', 'event_espresso'), $type->name())); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // Delete the entity |
| 69 | 69 | $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete(); |
| 70 | 70 | |
| 71 | 71 | if (empty($result)) { |
| 72 | - throw new UserError(__( 'The object failed to delete but no error was provided', 'event_espresso')); |
|
| 72 | + throw new UserError(__('The object failed to delete but no error was provided', 'event_espresso')); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | return [ |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | * |
| 24 | 24 | * @param EEM_Ticket $model |
| 25 | 25 | * @param Ticket $type |
| 26 | - * @return callable |
|
| 26 | + * @return \Closure |
|
| 27 | 27 | */ |
| 28 | 28 | public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
| 29 | 29 | { |
@@ -5,13 +5,11 @@ |
||
| 5 | 5 | use EE_Ticket; |
| 6 | 6 | use EventEspresso\core\domain\services\graphql\types\Ticket; |
| 7 | 7 | use EventEspresso\core\domain\services\graphql\data\mutations\TicketMutation; |
| 8 | - |
|
| 9 | 8 | use EE_Error; |
| 10 | 9 | use InvalidArgumentException; |
| 11 | 10 | use ReflectionException; |
| 12 | 11 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
| 13 | 12 | use EventEspresso\core\exceptions\InvalidInterfaceException; |
| 14 | - |
|
| 15 | 13 | use GraphQL\Type\Definition\ResolveInfo; |
| 16 | 14 | use WPGraphQL\AppContext; |
| 17 | 15 | use GraphQL\Error\UserError; |
@@ -21,8 +21,8 @@ |
||
| 21 | 21 | /** |
| 22 | 22 | * Defines the mutation data modification closure. |
| 23 | 23 | * |
| 24 | - * @param EEM_Ticket $model |
|
| 25 | - * @param Ticket $type |
|
| 24 | + * @param EEM_Ticket $model |
|
| 25 | + * @param Ticket $type |
|
| 26 | 26 | * @return callable |
| 27 | 27 | */ |
| 28 | 28 | public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type) |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | * @throws InvalidDataTypeException |
| 42 | 42 | * @throws EE_Error |
| 43 | 43 | */ |
| 44 | - return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) |
|
| 44 | + return static function($input, AppContext $context, ResolveInfo $info) use ($model, $type) |
|
| 45 | 45 | { |
| 46 | 46 | /** |
| 47 | 47 | * Stop now if a user isn't allowed to create a datetime. |
| 48 | 48 | */ |
| 49 | - if (! current_user_can('ee_edit_events')) { |
|
| 49 | + if ( ! current_user_can('ee_edit_events')) { |
|
| 50 | 50 | // translators: the %1$s is the name of the object being mutated |
| 51 | - throw new UserError(sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso' ), $type->name())); |
|
| 51 | + throw new UserError(sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | $id = ! empty($input['id']) ? absint($input['id']) : 0; |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * If there's no existing datetime, throw an exception |
| 63 | 63 | */ |
| 64 | - if (! $id || ! ($entity instanceof EE_Ticket)) { |
|
| 64 | + if ( ! $id || ! ($entity instanceof EE_Ticket)) { |
|
| 65 | 65 | // translators: the placeholder is the name of the type being updated |
| 66 | - throw new UserError(sprintf(__( 'No %1$s could be found to update', 'event_espresso' ), $type->name())); |
|
| 66 | + throw new UserError(sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name())); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $args = TicketMutation::prepare_fields($input); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $result = $entity->save($args); |
| 73 | 73 | |
| 74 | 74 | if (empty($result)) { |
| 75 | - throw new UserError(__( 'The object failed to update but no error was provided', 'event_espresso')); |
|
| 75 | + throw new UserError(__('The object failed to update but no error was provided', 'event_espresso')); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | return [ |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | - * @return GraphQLFieldInterface[] |
|
| 42 | + * @return GraphQLField[] |
|
| 43 | 43 | * @since $VID:$ |
| 44 | 44 | */ |
| 45 | 45 | protected function getFields() |
@@ -23,243 +23,243 @@ |
||
| 23 | 23 | class Ticket extends TypeBase |
| 24 | 24 | { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Ticket constructor. |
|
| 28 | - * |
|
| 29 | - * @param EEM_Ticket $ticket_model |
|
| 30 | - */ |
|
| 31 | - public function __construct(EEM_Ticket $ticket_model) |
|
| 32 | - { |
|
| 33 | - $this->model = $ticket_model; |
|
| 34 | - $this->setName('Ticket'); |
|
| 35 | - $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
|
| 36 | - $this->setIsCustomPostType(false); |
|
| 37 | - parent::__construct(); |
|
| 38 | - } |
|
| 26 | + /** |
|
| 27 | + * Ticket constructor. |
|
| 28 | + * |
|
| 29 | + * @param EEM_Ticket $ticket_model |
|
| 30 | + */ |
|
| 31 | + public function __construct(EEM_Ticket $ticket_model) |
|
| 32 | + { |
|
| 33 | + $this->model = $ticket_model; |
|
| 34 | + $this->setName('Ticket'); |
|
| 35 | + $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
|
| 36 | + $this->setIsCustomPostType(false); |
|
| 37 | + parent::__construct(); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @return GraphQLFieldInterface[] |
|
| 43 | - * @since $VID:$ |
|
| 44 | - */ |
|
| 45 | - protected function getFields() |
|
| 46 | - { |
|
| 47 | - return [ |
|
| 48 | - new GraphQLField( |
|
| 49 | - 'id', |
|
| 50 | - ['non_null' => 'Int'], |
|
| 51 | - 'ID', |
|
| 52 | - __('Ticket ID', 'event_espresso') |
|
| 53 | - ), |
|
| 54 | - new GraphQLField( |
|
| 55 | - 'name', |
|
| 56 | - 'String', |
|
| 57 | - 'name', |
|
| 58 | - __('Ticket Name', 'event_espresso') |
|
| 59 | - ), |
|
| 60 | - new GraphQLField( |
|
| 61 | - 'description', |
|
| 62 | - 'String', |
|
| 63 | - 'description', |
|
| 64 | - __('Description of Ticket', 'event_espresso') |
|
| 65 | - ), |
|
| 66 | - new GraphQLField( |
|
| 67 | - 'startDate', |
|
| 68 | - 'String', |
|
| 69 | - 'start_date', |
|
| 70 | - __('Start time/date of Ticket', 'event_espresso') |
|
| 71 | - ), |
|
| 72 | - new GraphQLField( |
|
| 73 | - 'endDate', |
|
| 74 | - 'String', |
|
| 75 | - 'end_date', |
|
| 76 | - __('End time/date of Ticket', 'event_espresso') |
|
| 77 | - ), |
|
| 78 | - new GraphQLField( |
|
| 79 | - 'min', |
|
| 80 | - 'Int', |
|
| 81 | - 'min', |
|
| 82 | - __('Minimum quantity of this ticket that must be purchased', 'event_espresso') |
|
| 83 | - ), |
|
| 84 | - new GraphQLField( |
|
| 85 | - 'max', |
|
| 86 | - 'Int', |
|
| 87 | - 'max', |
|
| 88 | - __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), |
|
| 89 | - [$this, 'parseInfiniteValue'] |
|
| 90 | - ), |
|
| 91 | - new GraphQLField( |
|
| 92 | - 'price', |
|
| 93 | - 'Float', |
|
| 94 | - 'price', |
|
| 95 | - __('Final calculated price for ticket', 'event_espresso') |
|
| 96 | - ), |
|
| 97 | - new GraphQLField( |
|
| 98 | - 'sold', |
|
| 99 | - 'Int', |
|
| 100 | - 'sold', |
|
| 101 | - __('Number of this ticket sold', 'event_espresso') |
|
| 102 | - ), |
|
| 103 | - new GraphQLField( |
|
| 104 | - 'quantity', |
|
| 105 | - 'Int', |
|
| 106 | - 'qty', |
|
| 107 | - __('Quantity of this ticket that is available', 'event_espresso'), |
|
| 108 | - [$this, 'parseInfiniteValue'] |
|
| 109 | - ), |
|
| 110 | - new GraphQLField( |
|
| 111 | - 'reserved', |
|
| 112 | - 'Int', |
|
| 113 | - 'reserved', |
|
| 114 | - __('Quantity of this ticket that is reserved, but not yet fully purchased', 'event_espresso') |
|
| 115 | - ), |
|
| 116 | - new GraphQLField( |
|
| 117 | - 'uses', |
|
| 118 | - 'Int', |
|
| 119 | - 'uses', |
|
| 120 | - __('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
| 121 | - [$this, 'parseInfiniteValue'] |
|
| 122 | - ), |
|
| 123 | - new GraphQLField( |
|
| 124 | - 'isRequired', |
|
| 125 | - 'Boolean', |
|
| 126 | - 'required', |
|
| 127 | - __('Flag indicating whether this ticket must be purchased with a transaction', 'event_espresso') |
|
| 128 | - ), |
|
| 129 | - new GraphQLField( |
|
| 130 | - 'isTaxable', |
|
| 131 | - 'Boolean', |
|
| 132 | - 'taxable', |
|
| 133 | - __('Flag indicating whether there is tax applied on this ticket', 'event_espresso') |
|
| 134 | - ), |
|
| 135 | - new GraphQLField( |
|
| 136 | - 'isDefault', |
|
| 137 | - 'Boolean', |
|
| 138 | - 'is_default', |
|
| 139 | - __('Flag indicating that this ticket is a default ticket', 'event_espresso') |
|
| 140 | - ), |
|
| 141 | - new GraphQLField( |
|
| 142 | - 'order', |
|
| 143 | - 'Int', |
|
| 144 | - 'order', |
|
| 145 | - __('The order in which the Datetime is displayed', 'event_espresso') |
|
| 146 | - ), |
|
| 147 | - new GraphQLField( |
|
| 148 | - 'row', |
|
| 149 | - 'Int', |
|
| 150 | - 'row', |
|
| 151 | - __('How tickets are displayed in the ui', 'event_espresso') |
|
| 152 | - ), |
|
| 153 | - new GraphQLOutputField( |
|
| 154 | - 'wpUser', |
|
| 155 | - 'User', |
|
| 156 | - null, |
|
| 157 | - __('Ticket Creator', 'event_espresso') |
|
| 158 | - ), |
|
| 159 | - new GraphQLInputField( |
|
| 160 | - 'wpUser', |
|
| 161 | - 'Int', |
|
| 162 | - null, |
|
| 163 | - __('Ticket Creator ID', 'event_espresso') |
|
| 164 | - ), |
|
| 165 | - new GraphQLOutputField( |
|
| 166 | - 'parent', |
|
| 167 | - 'Ticket', |
|
| 168 | - null, |
|
| 169 | - __('The parent ticket of the current ticket', 'event_espresso') |
|
| 170 | - ), |
|
| 171 | - new GraphQLInputField( |
|
| 172 | - 'parent', |
|
| 173 | - 'Int', |
|
| 174 | - null, |
|
| 175 | - __('The parent ticket ID', 'event_espresso') |
|
| 176 | - ), |
|
| 177 | - new GraphQLField( |
|
| 178 | - 'reverseCalculate', |
|
| 179 | - 'Boolean', |
|
| 180 | - 'reverse_calculate', |
|
| 181 | - __('Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', 'event_espresso') |
|
| 182 | - ), |
|
| 183 | - new GraphQLField( |
|
| 184 | - 'isFree', |
|
| 185 | - 'Boolean', |
|
| 186 | - 'is_free', |
|
| 187 | - __('Flag indicating whether the ticket is free.', 'event_espresso') |
|
| 188 | - ), |
|
| 189 | - new GraphQLOutputField( |
|
| 190 | - 'event', |
|
| 191 | - 'Event', |
|
| 192 | - null, |
|
| 193 | - __('Event of the ticket.', 'event_espresso') |
|
| 194 | - ), |
|
| 195 | - ]; |
|
| 196 | - } |
|
| 41 | + /** |
|
| 42 | + * @return GraphQLFieldInterface[] |
|
| 43 | + * @since $VID:$ |
|
| 44 | + */ |
|
| 45 | + protected function getFields() |
|
| 46 | + { |
|
| 47 | + return [ |
|
| 48 | + new GraphQLField( |
|
| 49 | + 'id', |
|
| 50 | + ['non_null' => 'Int'], |
|
| 51 | + 'ID', |
|
| 52 | + __('Ticket ID', 'event_espresso') |
|
| 53 | + ), |
|
| 54 | + new GraphQLField( |
|
| 55 | + 'name', |
|
| 56 | + 'String', |
|
| 57 | + 'name', |
|
| 58 | + __('Ticket Name', 'event_espresso') |
|
| 59 | + ), |
|
| 60 | + new GraphQLField( |
|
| 61 | + 'description', |
|
| 62 | + 'String', |
|
| 63 | + 'description', |
|
| 64 | + __('Description of Ticket', 'event_espresso') |
|
| 65 | + ), |
|
| 66 | + new GraphQLField( |
|
| 67 | + 'startDate', |
|
| 68 | + 'String', |
|
| 69 | + 'start_date', |
|
| 70 | + __('Start time/date of Ticket', 'event_espresso') |
|
| 71 | + ), |
|
| 72 | + new GraphQLField( |
|
| 73 | + 'endDate', |
|
| 74 | + 'String', |
|
| 75 | + 'end_date', |
|
| 76 | + __('End time/date of Ticket', 'event_espresso') |
|
| 77 | + ), |
|
| 78 | + new GraphQLField( |
|
| 79 | + 'min', |
|
| 80 | + 'Int', |
|
| 81 | + 'min', |
|
| 82 | + __('Minimum quantity of this ticket that must be purchased', 'event_espresso') |
|
| 83 | + ), |
|
| 84 | + new GraphQLField( |
|
| 85 | + 'max', |
|
| 86 | + 'Int', |
|
| 87 | + 'max', |
|
| 88 | + __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), |
|
| 89 | + [$this, 'parseInfiniteValue'] |
|
| 90 | + ), |
|
| 91 | + new GraphQLField( |
|
| 92 | + 'price', |
|
| 93 | + 'Float', |
|
| 94 | + 'price', |
|
| 95 | + __('Final calculated price for ticket', 'event_espresso') |
|
| 96 | + ), |
|
| 97 | + new GraphQLField( |
|
| 98 | + 'sold', |
|
| 99 | + 'Int', |
|
| 100 | + 'sold', |
|
| 101 | + __('Number of this ticket sold', 'event_espresso') |
|
| 102 | + ), |
|
| 103 | + new GraphQLField( |
|
| 104 | + 'quantity', |
|
| 105 | + 'Int', |
|
| 106 | + 'qty', |
|
| 107 | + __('Quantity of this ticket that is available', 'event_espresso'), |
|
| 108 | + [$this, 'parseInfiniteValue'] |
|
| 109 | + ), |
|
| 110 | + new GraphQLField( |
|
| 111 | + 'reserved', |
|
| 112 | + 'Int', |
|
| 113 | + 'reserved', |
|
| 114 | + __('Quantity of this ticket that is reserved, but not yet fully purchased', 'event_espresso') |
|
| 115 | + ), |
|
| 116 | + new GraphQLField( |
|
| 117 | + 'uses', |
|
| 118 | + 'Int', |
|
| 119 | + 'uses', |
|
| 120 | + __('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
| 121 | + [$this, 'parseInfiniteValue'] |
|
| 122 | + ), |
|
| 123 | + new GraphQLField( |
|
| 124 | + 'isRequired', |
|
| 125 | + 'Boolean', |
|
| 126 | + 'required', |
|
| 127 | + __('Flag indicating whether this ticket must be purchased with a transaction', 'event_espresso') |
|
| 128 | + ), |
|
| 129 | + new GraphQLField( |
|
| 130 | + 'isTaxable', |
|
| 131 | + 'Boolean', |
|
| 132 | + 'taxable', |
|
| 133 | + __('Flag indicating whether there is tax applied on this ticket', 'event_espresso') |
|
| 134 | + ), |
|
| 135 | + new GraphQLField( |
|
| 136 | + 'isDefault', |
|
| 137 | + 'Boolean', |
|
| 138 | + 'is_default', |
|
| 139 | + __('Flag indicating that this ticket is a default ticket', 'event_espresso') |
|
| 140 | + ), |
|
| 141 | + new GraphQLField( |
|
| 142 | + 'order', |
|
| 143 | + 'Int', |
|
| 144 | + 'order', |
|
| 145 | + __('The order in which the Datetime is displayed', 'event_espresso') |
|
| 146 | + ), |
|
| 147 | + new GraphQLField( |
|
| 148 | + 'row', |
|
| 149 | + 'Int', |
|
| 150 | + 'row', |
|
| 151 | + __('How tickets are displayed in the ui', 'event_espresso') |
|
| 152 | + ), |
|
| 153 | + new GraphQLOutputField( |
|
| 154 | + 'wpUser', |
|
| 155 | + 'User', |
|
| 156 | + null, |
|
| 157 | + __('Ticket Creator', 'event_espresso') |
|
| 158 | + ), |
|
| 159 | + new GraphQLInputField( |
|
| 160 | + 'wpUser', |
|
| 161 | + 'Int', |
|
| 162 | + null, |
|
| 163 | + __('Ticket Creator ID', 'event_espresso') |
|
| 164 | + ), |
|
| 165 | + new GraphQLOutputField( |
|
| 166 | + 'parent', |
|
| 167 | + 'Ticket', |
|
| 168 | + null, |
|
| 169 | + __('The parent ticket of the current ticket', 'event_espresso') |
|
| 170 | + ), |
|
| 171 | + new GraphQLInputField( |
|
| 172 | + 'parent', |
|
| 173 | + 'Int', |
|
| 174 | + null, |
|
| 175 | + __('The parent ticket ID', 'event_espresso') |
|
| 176 | + ), |
|
| 177 | + new GraphQLField( |
|
| 178 | + 'reverseCalculate', |
|
| 179 | + 'Boolean', |
|
| 180 | + 'reverse_calculate', |
|
| 181 | + __('Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', 'event_espresso') |
|
| 182 | + ), |
|
| 183 | + new GraphQLField( |
|
| 184 | + 'isFree', |
|
| 185 | + 'Boolean', |
|
| 186 | + 'is_free', |
|
| 187 | + __('Flag indicating whether the ticket is free.', 'event_espresso') |
|
| 188 | + ), |
|
| 189 | + new GraphQLOutputField( |
|
| 190 | + 'event', |
|
| 191 | + 'Event', |
|
| 192 | + null, |
|
| 193 | + __('Event of the ticket.', 'event_espresso') |
|
| 194 | + ), |
|
| 195 | + ]; |
|
| 196 | + } |
|
| 197 | 197 | |
| 198 | 198 | |
| 199 | - /** |
|
| 200 | - * @param array $inputFields The mutation input fields. |
|
| 201 | - * |
|
| 202 | - * @throws InvalidArgumentException |
|
| 203 | - * @throws ReflectionException |
|
| 204 | - * @since $VID:$ |
|
| 205 | - */ |
|
| 206 | - public function registerMutations(array $inputFields) |
|
| 207 | - { |
|
| 208 | - // Register mutation to update an entity. |
|
| 209 | - register_graphql_mutation( |
|
| 199 | + /** |
|
| 200 | + * @param array $inputFields The mutation input fields. |
|
| 201 | + * |
|
| 202 | + * @throws InvalidArgumentException |
|
| 203 | + * @throws ReflectionException |
|
| 204 | + * @since $VID:$ |
|
| 205 | + */ |
|
| 206 | + public function registerMutations(array $inputFields) |
|
| 207 | + { |
|
| 208 | + // Register mutation to update an entity. |
|
| 209 | + register_graphql_mutation( |
|
| 210 | 210 | 'update' . $this->name(), |
| 211 | 211 | [ |
| 212 | 212 | 'inputFields' => $inputFields, |
| 213 | 213 | 'outputFields' => [ |
| 214 | - lcfirst($this->name()) => [ |
|
| 215 | - 'type' => $this->name(), |
|
| 216 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
| 217 | - ], |
|
| 218 | - ], |
|
| 214 | + lcfirst($this->name()) => [ |
|
| 215 | + 'type' => $this->name(), |
|
| 216 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
| 217 | + ], |
|
| 218 | + ], |
|
| 219 | 219 | 'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this), |
| 220 | 220 | ] |
| 221 | - ); |
|
| 222 | - // Register mutation to delete an entity. |
|
| 223 | - register_graphql_mutation( |
|
| 221 | + ); |
|
| 222 | + // Register mutation to delete an entity. |
|
| 223 | + register_graphql_mutation( |
|
| 224 | 224 | 'delete' . $this->name(), |
| 225 | 225 | [ |
| 226 | 226 | 'inputFields' => [ |
| 227 | - 'id' => $inputFields['id'], |
|
| 228 | - 'deletePermanently' => [ |
|
| 229 | - 'type' => 'Boolean', |
|
| 230 | - 'description' => __( 'Whether to delete the entity permanently.', 'event_espresso' ), |
|
| 231 | - ], |
|
| 232 | - ], |
|
| 227 | + 'id' => $inputFields['id'], |
|
| 228 | + 'deletePermanently' => [ |
|
| 229 | + 'type' => 'Boolean', |
|
| 230 | + 'description' => __( 'Whether to delete the entity permanently.', 'event_espresso' ), |
|
| 231 | + ], |
|
| 232 | + ], |
|
| 233 | 233 | 'outputFields' => [ |
| 234 | - lcfirst($this->name()) => [ |
|
| 235 | - 'type' => $this->name(), |
|
| 236 | - 'description' => __( 'The object before it was deleted', 'event_espresso' ), |
|
| 237 | - 'resolve' => function ( $payload ) { |
|
| 238 | - $deleted = (object) $payload['deleted']; |
|
| 234 | + lcfirst($this->name()) => [ |
|
| 235 | + 'type' => $this->name(), |
|
| 236 | + 'description' => __( 'The object before it was deleted', 'event_espresso' ), |
|
| 237 | + 'resolve' => function ( $payload ) { |
|
| 238 | + $deleted = (object) $payload['deleted']; |
|
| 239 | 239 | |
| 240 | - return ! empty( $deleted ) ? $deleted : null; |
|
| 241 | - }, |
|
| 242 | - ], |
|
| 243 | - ], |
|
| 240 | + return ! empty( $deleted ) ? $deleted : null; |
|
| 241 | + }, |
|
| 242 | + ], |
|
| 243 | + ], |
|
| 244 | 244 | 'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this), |
| 245 | 245 | ] |
| 246 | - ); |
|
| 246 | + ); |
|
| 247 | 247 | |
| 248 | - // remove primary key from input. |
|
| 249 | - unset($inputFields['id']); |
|
| 250 | - // Register mutation to update an entity. |
|
| 251 | - register_graphql_mutation( |
|
| 248 | + // remove primary key from input. |
|
| 249 | + unset($inputFields['id']); |
|
| 250 | + // Register mutation to update an entity. |
|
| 251 | + register_graphql_mutation( |
|
| 252 | 252 | 'create' . $this->name(), |
| 253 | 253 | [ |
| 254 | 254 | 'inputFields' => $inputFields, |
| 255 | 255 | 'outputFields' => [ |
| 256 | - lcfirst($this->name()) => [ |
|
| 257 | - 'type' => $this->name(), |
|
| 258 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
| 259 | - ], |
|
| 260 | - ], |
|
| 256 | + lcfirst($this->name()) => [ |
|
| 257 | + 'type' => $this->name(), |
|
| 258 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
| 259 | + ], |
|
| 260 | + ], |
|
| 261 | 261 | 'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this), |
| 262 | 262 | ] |
| 263 | 263 | ); |
| 264 | - } |
|
| 264 | + } |
|
| 265 | 265 | } |
| 266 | 266 | \ No newline at end of file |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | { |
| 208 | 208 | // Register mutation to update an entity. |
| 209 | 209 | register_graphql_mutation( |
| 210 | - 'update' . $this->name(), |
|
| 210 | + 'update'.$this->name(), |
|
| 211 | 211 | [ |
| 212 | 212 | 'inputFields' => $inputFields, |
| 213 | 213 | 'outputFields' => [ |
@@ -221,23 +221,23 @@ discard block |
||
| 221 | 221 | ); |
| 222 | 222 | // Register mutation to delete an entity. |
| 223 | 223 | register_graphql_mutation( |
| 224 | - 'delete' . $this->name(), |
|
| 224 | + 'delete'.$this->name(), |
|
| 225 | 225 | [ |
| 226 | 226 | 'inputFields' => [ |
| 227 | 227 | 'id' => $inputFields['id'], |
| 228 | 228 | 'deletePermanently' => [ |
| 229 | 229 | 'type' => 'Boolean', |
| 230 | - 'description' => __( 'Whether to delete the entity permanently.', 'event_espresso' ), |
|
| 230 | + 'description' => __('Whether to delete the entity permanently.', 'event_espresso'), |
|
| 231 | 231 | ], |
| 232 | 232 | ], |
| 233 | 233 | 'outputFields' => [ |
| 234 | 234 | lcfirst($this->name()) => [ |
| 235 | 235 | 'type' => $this->name(), |
| 236 | - 'description' => __( 'The object before it was deleted', 'event_espresso' ), |
|
| 237 | - 'resolve' => function ( $payload ) { |
|
| 236 | + 'description' => __('The object before it was deleted', 'event_espresso'), |
|
| 237 | + 'resolve' => function($payload) { |
|
| 238 | 238 | $deleted = (object) $payload['deleted']; |
| 239 | 239 | |
| 240 | - return ! empty( $deleted ) ? $deleted : null; |
|
| 240 | + return ! empty($deleted) ? $deleted : null; |
|
| 241 | 241 | }, |
| 242 | 242 | ], |
| 243 | 243 | ], |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | unset($inputFields['id']); |
| 250 | 250 | // Register mutation to update an entity. |
| 251 | 251 | register_graphql_mutation( |
| 252 | - 'create' . $this->name(), |
|
| 252 | + 'create'.$this->name(), |
|
| 253 | 253 | [ |
| 254 | 254 | 'inputFields' => $inputFields, |
| 255 | 255 | 'outputFields' => [ |
@@ -22,12 +22,12 @@ |
||
| 22 | 22 | |
| 23 | 23 | $args = []; |
| 24 | 24 | |
| 25 | - if ( ! empty( $input['name'] ) ) { |
|
| 26 | - $args['TKT_name'] = sanitize_text_field( $input['name'] ); |
|
| 25 | + if ( ! empty($input['name'])) { |
|
| 26 | + $args['TKT_name'] = sanitize_text_field($input['name']); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - if ( ! empty( $input['description'] ) ) { |
|
| 30 | - $args['TKT_description'] = sanitize_text_field( $input['description'] ); |
|
| 29 | + if ( ! empty($input['description'])) { |
|
| 30 | + $args['TKT_description'] = sanitize_text_field($input['description']); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | // Likewise the other fields... |
@@ -25,236 +25,236 @@ |
||
| 25 | 25 | class Datetime extends TypeBase |
| 26 | 26 | { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * EventDate constructor. |
|
| 30 | - * |
|
| 31 | - * @param EEM_Datetime $datetime_model |
|
| 32 | - */ |
|
| 33 | - public function __construct(EEM_Datetime $datetime_model) |
|
| 34 | - { |
|
| 35 | - $this->model = $datetime_model; |
|
| 36 | - $this->setName('Datetime'); |
|
| 37 | - $this->setDescription(__('An event date', 'event_espresso')); |
|
| 38 | - $this->setIsCustomPostType(false); |
|
| 39 | - parent::__construct(); |
|
| 40 | - } |
|
| 28 | + /** |
|
| 29 | + * EventDate constructor. |
|
| 30 | + * |
|
| 31 | + * @param EEM_Datetime $datetime_model |
|
| 32 | + */ |
|
| 33 | + public function __construct(EEM_Datetime $datetime_model) |
|
| 34 | + { |
|
| 35 | + $this->model = $datetime_model; |
|
| 36 | + $this->setName('Datetime'); |
|
| 37 | + $this->setDescription(__('An event date', 'event_espresso')); |
|
| 38 | + $this->setIsCustomPostType(false); |
|
| 39 | + parent::__construct(); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * @return \EventEspresso\core\services\graphql\fields\GraphQLFieldInterface[] |
|
| 45 | - * @since $VID:$ |
|
| 46 | - */ |
|
| 47 | - public function getFields() |
|
| 48 | - { |
|
| 49 | - return [ |
|
| 50 | - new GraphQLField( |
|
| 51 | - 'id', |
|
| 52 | - ['non_null' => 'Int'], |
|
| 53 | - 'ID', |
|
| 54 | - __('The datetime ID.', 'event_espresso') |
|
| 55 | - ), |
|
| 56 | - new GraphQLField( |
|
| 57 | - 'name', |
|
| 58 | - 'String', |
|
| 59 | - 'name', |
|
| 60 | - __('Datetime Name', 'event_espresso') |
|
| 61 | - ), |
|
| 62 | - new GraphQLField( |
|
| 63 | - 'description', |
|
| 64 | - 'String', |
|
| 65 | - 'description', |
|
| 66 | - __('Description for Datetime', 'event_espresso') |
|
| 67 | - ), |
|
| 68 | - new GraphQLField( |
|
| 69 | - 'start', |
|
| 70 | - 'String', |
|
| 71 | - 'start', |
|
| 72 | - __('Start timestamp of Event', 'event_espresso') |
|
| 73 | - ), |
|
| 74 | - new GraphQLField( |
|
| 75 | - 'startDate', |
|
| 76 | - 'String', |
|
| 77 | - 'start_date', |
|
| 78 | - __('Start time/date of Event', 'event_espresso') |
|
| 79 | - ), |
|
| 80 | - new GraphQLField( |
|
| 81 | - 'end', |
|
| 82 | - 'String', |
|
| 83 | - 'end', |
|
| 84 | - __('End timestamp of Event', 'event_espresso') |
|
| 85 | - ), |
|
| 86 | - new GraphQLField( |
|
| 87 | - 'endDate', |
|
| 88 | - 'String', |
|
| 89 | - 'end_date', |
|
| 90 | - __('End time/date of Event', 'event_espresso') |
|
| 91 | - ), |
|
| 92 | - new GraphQLField( |
|
| 93 | - 'startTime', |
|
| 94 | - 'String', |
|
| 95 | - 'start_time', |
|
| 96 | - __('Start time of Event', 'event_espresso') |
|
| 97 | - ), |
|
| 98 | - new GraphQLField( |
|
| 99 | - 'endTime', |
|
| 100 | - 'String', |
|
| 101 | - 'end_time', |
|
| 102 | - __('End time of Event', 'event_espresso') |
|
| 103 | - ), |
|
| 104 | - new GraphQLField( |
|
| 105 | - 'capacity', |
|
| 106 | - 'Int', |
|
| 107 | - 'reg_limit', |
|
| 108 | - __('Registration Limit for this time', 'event_espresso'), |
|
| 109 | - [$this, 'parseInfiniteValue'] |
|
| 110 | - ), |
|
| 111 | - new GraphQLField( |
|
| 112 | - 'sold', |
|
| 113 | - 'Int', |
|
| 114 | - 'sold', |
|
| 115 | - __('How many sales for this Datetime that have occurred', 'event_espresso') |
|
| 116 | - ), |
|
| 117 | - new GraphQLField( |
|
| 118 | - 'reserved', |
|
| 119 | - 'Int', |
|
| 120 | - 'reserved', |
|
| 121 | - __('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso') |
|
| 122 | - ), |
|
| 123 | - new GraphQLField( |
|
| 124 | - 'order', |
|
| 125 | - 'Int', |
|
| 126 | - 'order', |
|
| 127 | - __('The order in which the Datetime is displayed', 'event_espresso') |
|
| 128 | - ), |
|
| 129 | - new GraphQLField( |
|
| 130 | - 'length', |
|
| 131 | - 'Int', |
|
| 132 | - 'length', |
|
| 133 | - __('The length of the event (start to end time) in seconds', 'event_espresso') |
|
| 134 | - ), |
|
| 135 | - new GraphQLOutputField( |
|
| 136 | - 'parent', |
|
| 137 | - 'Datetime', |
|
| 138 | - null, |
|
| 139 | - __('The parent datetime of the current datetime', 'event_espresso') |
|
| 140 | - ), |
|
| 141 | - new GraphQLInputField( |
|
| 142 | - 'parent', |
|
| 143 | - 'Int', |
|
| 144 | - null, |
|
| 145 | - __('The parent datetime ID', 'event_espresso') |
|
| 146 | - ), |
|
| 147 | - new GraphQLField( |
|
| 148 | - 'isPrimary', |
|
| 149 | - 'Boolean', |
|
| 150 | - 'is_primary', |
|
| 151 | - __('Flag indicating datetime is primary one for event', 'event_espresso') |
|
| 152 | - ), |
|
| 153 | - new GraphQLField( |
|
| 154 | - 'isSoldOut', |
|
| 155 | - 'Boolean', |
|
| 156 | - 'sold_out', |
|
| 157 | - __('Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit', |
|
| 158 | - 'event_espresso') |
|
| 159 | - ), |
|
| 160 | - new GraphQLField( |
|
| 161 | - 'isUpcoming', |
|
| 162 | - 'Boolean', |
|
| 163 | - 'is_upcoming', |
|
| 164 | - __('Whether the date is upcoming', 'event_espresso') |
|
| 165 | - ), |
|
| 166 | - new GraphQLField( |
|
| 167 | - 'isActive', |
|
| 168 | - 'Boolean', |
|
| 169 | - 'is_active', |
|
| 170 | - __('Flag indicating datetime is active', 'event_espresso') |
|
| 171 | - ), |
|
| 172 | - new GraphQLField( |
|
| 173 | - 'isExpired', |
|
| 174 | - 'Boolean', |
|
| 175 | - 'is_expired', |
|
| 176 | - __('Flag indicating datetime is expired or not', 'event_espresso') |
|
| 177 | - ), |
|
| 178 | - new GraphQLOutputField( |
|
| 179 | - 'event', |
|
| 180 | - 'Event', |
|
| 181 | - null, |
|
| 182 | - __('Event of the datetime.', 'event_espresso') |
|
| 183 | - ), |
|
| 184 | - new GraphQLInputField( |
|
| 185 | - 'event', |
|
| 186 | - 'Int', |
|
| 187 | - null, |
|
| 188 | - __('Event ID of the datetime.', 'event_espresso') |
|
| 189 | - ), |
|
| 190 | - ]; |
|
| 191 | - } |
|
| 43 | + /** |
|
| 44 | + * @return \EventEspresso\core\services\graphql\fields\GraphQLFieldInterface[] |
|
| 45 | + * @since $VID:$ |
|
| 46 | + */ |
|
| 47 | + public function getFields() |
|
| 48 | + { |
|
| 49 | + return [ |
|
| 50 | + new GraphQLField( |
|
| 51 | + 'id', |
|
| 52 | + ['non_null' => 'Int'], |
|
| 53 | + 'ID', |
|
| 54 | + __('The datetime ID.', 'event_espresso') |
|
| 55 | + ), |
|
| 56 | + new GraphQLField( |
|
| 57 | + 'name', |
|
| 58 | + 'String', |
|
| 59 | + 'name', |
|
| 60 | + __('Datetime Name', 'event_espresso') |
|
| 61 | + ), |
|
| 62 | + new GraphQLField( |
|
| 63 | + 'description', |
|
| 64 | + 'String', |
|
| 65 | + 'description', |
|
| 66 | + __('Description for Datetime', 'event_espresso') |
|
| 67 | + ), |
|
| 68 | + new GraphQLField( |
|
| 69 | + 'start', |
|
| 70 | + 'String', |
|
| 71 | + 'start', |
|
| 72 | + __('Start timestamp of Event', 'event_espresso') |
|
| 73 | + ), |
|
| 74 | + new GraphQLField( |
|
| 75 | + 'startDate', |
|
| 76 | + 'String', |
|
| 77 | + 'start_date', |
|
| 78 | + __('Start time/date of Event', 'event_espresso') |
|
| 79 | + ), |
|
| 80 | + new GraphQLField( |
|
| 81 | + 'end', |
|
| 82 | + 'String', |
|
| 83 | + 'end', |
|
| 84 | + __('End timestamp of Event', 'event_espresso') |
|
| 85 | + ), |
|
| 86 | + new GraphQLField( |
|
| 87 | + 'endDate', |
|
| 88 | + 'String', |
|
| 89 | + 'end_date', |
|
| 90 | + __('End time/date of Event', 'event_espresso') |
|
| 91 | + ), |
|
| 92 | + new GraphQLField( |
|
| 93 | + 'startTime', |
|
| 94 | + 'String', |
|
| 95 | + 'start_time', |
|
| 96 | + __('Start time of Event', 'event_espresso') |
|
| 97 | + ), |
|
| 98 | + new GraphQLField( |
|
| 99 | + 'endTime', |
|
| 100 | + 'String', |
|
| 101 | + 'end_time', |
|
| 102 | + __('End time of Event', 'event_espresso') |
|
| 103 | + ), |
|
| 104 | + new GraphQLField( |
|
| 105 | + 'capacity', |
|
| 106 | + 'Int', |
|
| 107 | + 'reg_limit', |
|
| 108 | + __('Registration Limit for this time', 'event_espresso'), |
|
| 109 | + [$this, 'parseInfiniteValue'] |
|
| 110 | + ), |
|
| 111 | + new GraphQLField( |
|
| 112 | + 'sold', |
|
| 113 | + 'Int', |
|
| 114 | + 'sold', |
|
| 115 | + __('How many sales for this Datetime that have occurred', 'event_espresso') |
|
| 116 | + ), |
|
| 117 | + new GraphQLField( |
|
| 118 | + 'reserved', |
|
| 119 | + 'Int', |
|
| 120 | + 'reserved', |
|
| 121 | + __('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso') |
|
| 122 | + ), |
|
| 123 | + new GraphQLField( |
|
| 124 | + 'order', |
|
| 125 | + 'Int', |
|
| 126 | + 'order', |
|
| 127 | + __('The order in which the Datetime is displayed', 'event_espresso') |
|
| 128 | + ), |
|
| 129 | + new GraphQLField( |
|
| 130 | + 'length', |
|
| 131 | + 'Int', |
|
| 132 | + 'length', |
|
| 133 | + __('The length of the event (start to end time) in seconds', 'event_espresso') |
|
| 134 | + ), |
|
| 135 | + new GraphQLOutputField( |
|
| 136 | + 'parent', |
|
| 137 | + 'Datetime', |
|
| 138 | + null, |
|
| 139 | + __('The parent datetime of the current datetime', 'event_espresso') |
|
| 140 | + ), |
|
| 141 | + new GraphQLInputField( |
|
| 142 | + 'parent', |
|
| 143 | + 'Int', |
|
| 144 | + null, |
|
| 145 | + __('The parent datetime ID', 'event_espresso') |
|
| 146 | + ), |
|
| 147 | + new GraphQLField( |
|
| 148 | + 'isPrimary', |
|
| 149 | + 'Boolean', |
|
| 150 | + 'is_primary', |
|
| 151 | + __('Flag indicating datetime is primary one for event', 'event_espresso') |
|
| 152 | + ), |
|
| 153 | + new GraphQLField( |
|
| 154 | + 'isSoldOut', |
|
| 155 | + 'Boolean', |
|
| 156 | + 'sold_out', |
|
| 157 | + __('Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit', |
|
| 158 | + 'event_espresso') |
|
| 159 | + ), |
|
| 160 | + new GraphQLField( |
|
| 161 | + 'isUpcoming', |
|
| 162 | + 'Boolean', |
|
| 163 | + 'is_upcoming', |
|
| 164 | + __('Whether the date is upcoming', 'event_espresso') |
|
| 165 | + ), |
|
| 166 | + new GraphQLField( |
|
| 167 | + 'isActive', |
|
| 168 | + 'Boolean', |
|
| 169 | + 'is_active', |
|
| 170 | + __('Flag indicating datetime is active', 'event_espresso') |
|
| 171 | + ), |
|
| 172 | + new GraphQLField( |
|
| 173 | + 'isExpired', |
|
| 174 | + 'Boolean', |
|
| 175 | + 'is_expired', |
|
| 176 | + __('Flag indicating datetime is expired or not', 'event_espresso') |
|
| 177 | + ), |
|
| 178 | + new GraphQLOutputField( |
|
| 179 | + 'event', |
|
| 180 | + 'Event', |
|
| 181 | + null, |
|
| 182 | + __('Event of the datetime.', 'event_espresso') |
|
| 183 | + ), |
|
| 184 | + new GraphQLInputField( |
|
| 185 | + 'event', |
|
| 186 | + 'Int', |
|
| 187 | + null, |
|
| 188 | + __('Event ID of the datetime.', 'event_espresso') |
|
| 189 | + ), |
|
| 190 | + ]; |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | 193 | |
| 194 | - /** |
|
| 195 | - * @param array $inputFields The mutation input fields. |
|
| 196 | - * |
|
| 197 | - * @throws InvalidArgumentException |
|
| 198 | - * @throws ReflectionException |
|
| 199 | - * @since $VID:$ |
|
| 200 | - */ |
|
| 201 | - public function registerMutations(array $inputFields) |
|
| 202 | - { |
|
| 203 | - // Register mutation to update an entity. |
|
| 204 | - register_graphql_mutation( |
|
| 194 | + /** |
|
| 195 | + * @param array $inputFields The mutation input fields. |
|
| 196 | + * |
|
| 197 | + * @throws InvalidArgumentException |
|
| 198 | + * @throws ReflectionException |
|
| 199 | + * @since $VID:$ |
|
| 200 | + */ |
|
| 201 | + public function registerMutations(array $inputFields) |
|
| 202 | + { |
|
| 203 | + // Register mutation to update an entity. |
|
| 204 | + register_graphql_mutation( |
|
| 205 | 205 | 'update' . $this->name(), |
| 206 | 206 | [ |
| 207 | 207 | 'inputFields' => $inputFields, |
| 208 | 208 | 'outputFields' => [ |
| 209 | - lcfirst($this->name()) => [ |
|
| 210 | - 'type' => $this->name(), |
|
| 211 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
| 212 | - ], |
|
| 213 | - ], |
|
| 209 | + lcfirst($this->name()) => [ |
|
| 210 | + 'type' => $this->name(), |
|
| 211 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
| 212 | + ], |
|
| 213 | + ], |
|
| 214 | 214 | 'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this), |
| 215 | 215 | ] |
| 216 | - ); |
|
| 217 | - // Register mutation to delete an entity. |
|
| 218 | - register_graphql_mutation( |
|
| 216 | + ); |
|
| 217 | + // Register mutation to delete an entity. |
|
| 218 | + register_graphql_mutation( |
|
| 219 | 219 | 'delete' . $this->name(), |
| 220 | 220 | [ |
| 221 | 221 | 'inputFields' => [ |
| 222 | - 'id' => $inputFields['id'], |
|
| 223 | - 'deletePermanently' => [ |
|
| 224 | - 'type' => 'Boolean', |
|
| 225 | - 'description' => __( 'Whether to delete the entity permanently.', 'event_espresso' ), |
|
| 226 | - ], |
|
| 227 | - ], |
|
| 222 | + 'id' => $inputFields['id'], |
|
| 223 | + 'deletePermanently' => [ |
|
| 224 | + 'type' => 'Boolean', |
|
| 225 | + 'description' => __( 'Whether to delete the entity permanently.', 'event_espresso' ), |
|
| 226 | + ], |
|
| 227 | + ], |
|
| 228 | 228 | 'outputFields' => [ |
| 229 | - lcfirst($this->name()) => [ |
|
| 230 | - 'type' => $this->name(), |
|
| 231 | - 'description' => __( 'The object before it was deleted', 'event_espresso' ), |
|
| 232 | - 'resolve' => function ( $payload ) { |
|
| 233 | - $deleted = (object) $payload['deleted']; |
|
| 229 | + lcfirst($this->name()) => [ |
|
| 230 | + 'type' => $this->name(), |
|
| 231 | + 'description' => __( 'The object before it was deleted', 'event_espresso' ), |
|
| 232 | + 'resolve' => function ( $payload ) { |
|
| 233 | + $deleted = (object) $payload['deleted']; |
|
| 234 | 234 | |
| 235 | - return ! empty( $deleted ) ? $deleted : null; |
|
| 236 | - }, |
|
| 237 | - ], |
|
| 238 | - ], |
|
| 235 | + return ! empty( $deleted ) ? $deleted : null; |
|
| 236 | + }, |
|
| 237 | + ], |
|
| 238 | + ], |
|
| 239 | 239 | 'mutateAndGetPayload' => DatetimeDelete::mutateAndGetPayload($this->model, $this), |
| 240 | 240 | ] |
| 241 | - ); |
|
| 241 | + ); |
|
| 242 | 242 | |
| 243 | - // remove primary key from input. |
|
| 244 | - unset($inputFields['id']); |
|
| 245 | - // Register mutation to update an entity. |
|
| 246 | - register_graphql_mutation( |
|
| 243 | + // remove primary key from input. |
|
| 244 | + unset($inputFields['id']); |
|
| 245 | + // Register mutation to update an entity. |
|
| 246 | + register_graphql_mutation( |
|
| 247 | 247 | 'create' . $this->name(), |
| 248 | 248 | [ |
| 249 | 249 | 'inputFields' => $inputFields, |
| 250 | 250 | 'outputFields' => [ |
| 251 | - lcfirst($this->name()) => [ |
|
| 252 | - 'type' => $this->name(), |
|
| 253 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
| 254 | - ], |
|
| 255 | - ], |
|
| 251 | + lcfirst($this->name()) => [ |
|
| 252 | + 'type' => $this->name(), |
|
| 253 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
| 254 | + ], |
|
| 255 | + ], |
|
| 256 | 256 | 'mutateAndGetPayload' => DatetimeCreate::mutateAndGetPayload($this->model, $this), |
| 257 | 257 | ] |
| 258 | 258 | ); |
| 259 | - } |
|
| 259 | + } |
|
| 260 | 260 | } |
| 261 | 261 | \ No newline at end of file |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | { |
| 203 | 203 | // Register mutation to update an entity. |
| 204 | 204 | register_graphql_mutation( |
| 205 | - 'update' . $this->name(), |
|
| 205 | + 'update'.$this->name(), |
|
| 206 | 206 | [ |
| 207 | 207 | 'inputFields' => $inputFields, |
| 208 | 208 | 'outputFields' => [ |
@@ -216,23 +216,23 @@ discard block |
||
| 216 | 216 | ); |
| 217 | 217 | // Register mutation to delete an entity. |
| 218 | 218 | register_graphql_mutation( |
| 219 | - 'delete' . $this->name(), |
|
| 219 | + 'delete'.$this->name(), |
|
| 220 | 220 | [ |
| 221 | 221 | 'inputFields' => [ |
| 222 | 222 | 'id' => $inputFields['id'], |
| 223 | 223 | 'deletePermanently' => [ |
| 224 | 224 | 'type' => 'Boolean', |
| 225 | - 'description' => __( 'Whether to delete the entity permanently.', 'event_espresso' ), |
|
| 225 | + 'description' => __('Whether to delete the entity permanently.', 'event_espresso'), |
|
| 226 | 226 | ], |
| 227 | 227 | ], |
| 228 | 228 | 'outputFields' => [ |
| 229 | 229 | lcfirst($this->name()) => [ |
| 230 | 230 | 'type' => $this->name(), |
| 231 | - 'description' => __( 'The object before it was deleted', 'event_espresso' ), |
|
| 232 | - 'resolve' => function ( $payload ) { |
|
| 231 | + 'description' => __('The object before it was deleted', 'event_espresso'), |
|
| 232 | + 'resolve' => function($payload) { |
|
| 233 | 233 | $deleted = (object) $payload['deleted']; |
| 234 | 234 | |
| 235 | - return ! empty( $deleted ) ? $deleted : null; |
|
| 235 | + return ! empty($deleted) ? $deleted : null; |
|
| 236 | 236 | }, |
| 237 | 237 | ], |
| 238 | 238 | ], |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | unset($inputFields['id']); |
| 245 | 245 | // Register mutation to update an entity. |
| 246 | 246 | register_graphql_mutation( |
| 247 | - 'create' . $this->name(), |
|
| 247 | + 'create'.$this->name(), |
|
| 248 | 248 | [ |
| 249 | 249 | 'inputFields' => $inputFields, |
| 250 | 250 | 'outputFields' => [ |