| @@ -13,69 +13,69 @@ | ||
| 13 | 13 | class DatetimeMutation | 
| 14 | 14 |  { | 
| 15 | 15 | |
| 16 | - /** | |
| 17 | - * Maps the GraphQL input to a format that the model functions can use | |
| 18 | - * | |
| 19 | - * @param array $input Data coming from the GraphQL mutation query input | |
| 20 | - * @return array | |
| 21 | - */ | |
| 22 | - public static function prepareFields(array $input) | |
| 23 | -    { | |
| 16 | + /** | |
| 17 | + * Maps the GraphQL input to a format that the model functions can use | |
| 18 | + * | |
| 19 | + * @param array $input Data coming from the GraphQL mutation query input | |
| 20 | + * @return array | |
| 21 | + */ | |
| 22 | + public static function prepareFields(array $input) | |
| 23 | +	{ | |
| 24 | 24 | |
| 25 | - $args = []; | |
| 25 | + $args = []; | |
| 26 | 26 | |
| 27 | -        if (! empty($input['eventId'])) { | |
| 28 | - $args['EVT_ID'] = absint($input['eventId']); | |
| 29 | -        } elseif (! empty($input['event'])) { | |
| 30 | - $parts = Relay::fromGlobalId($input['event']); | |
| 31 | - $args['EVT_ID'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; | |
| 32 | - } | |
| 27 | +		if (! empty($input['eventId'])) { | |
| 28 | + $args['EVT_ID'] = absint($input['eventId']); | |
| 29 | +		} elseif (! empty($input['event'])) { | |
| 30 | + $parts = Relay::fromGlobalId($input['event']); | |
| 31 | + $args['EVT_ID'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; | |
| 32 | + } | |
| 33 | 33 | |
| 34 | -        if (! empty($input['name'])) { | |
| 35 | - $args['DTT_name'] = sanitize_text_field($input['name']); | |
| 36 | - } | |
| 34 | +		if (! empty($input['name'])) { | |
| 35 | + $args['DTT_name'] = sanitize_text_field($input['name']); | |
| 36 | + } | |
| 37 | 37 | |
| 38 | -        if (! empty($input['description'])) { | |
| 39 | - $args['DTT_description'] = sanitize_text_field($input['description']); | |
| 40 | - } | |
| 38 | +		if (! empty($input['description'])) { | |
| 39 | + $args['DTT_description'] = sanitize_text_field($input['description']); | |
| 40 | + } | |
| 41 | 41 | |
| 42 | -        if (! empty($input['startDate'])) { | |
| 43 | - $args['DTT_EVT_start'] = sanitize_text_field($input['startDate']); | |
| 44 | - } | |
| 42 | +		if (! empty($input['startDate'])) { | |
| 43 | + $args['DTT_EVT_start'] = sanitize_text_field($input['startDate']); | |
| 44 | + } | |
| 45 | 45 | |
| 46 | -        if (! empty($input['endDate'])) { | |
| 47 | - $args['DTT_EVT_end'] = sanitize_text_field($input['endDate']); | |
| 48 | - } | |
| 46 | +		if (! empty($input['endDate'])) { | |
| 47 | + $args['DTT_EVT_end'] = sanitize_text_field($input['endDate']); | |
| 48 | + } | |
| 49 | 49 | |
| 50 | -        if (! empty($input['tickets'])) { | |
| 51 | -            $args['tickets'] = array_map('sanitize_text_field', (array) $input['tickets']); | |
| 52 | - } | |
| 50 | +		if (! empty($input['tickets'])) { | |
| 51 | +			$args['tickets'] = array_map('sanitize_text_field', (array) $input['tickets']); | |
| 52 | + } | |
| 53 | 53 | |
| 54 | - // Likewise the other fields... | |
| 54 | + // Likewise the other fields... | |
| 55 | 55 | |
| 56 | - return $args; | |
| 57 | - } | |
| 56 | + return $args; | |
| 57 | + } | |
| 58 | 58 | |
| 59 | - /** | |
| 60 | - * Sets the related tickets for the given datetime. | |
| 61 | - * | |
| 62 | - * @param EE_Datetime $entity The datetime instance. | |
| 63 | - * @param array $tickets Array of ticket IDs to relate. | |
| 64 | - */ | |
| 65 | - public static function setRelatedTickets($entity, array $tickets) | |
| 66 | -    { | |
| 67 | - $relationName = 'Ticket'; | |
| 68 | - // Remove all the existing related tickets | |
| 69 | - $entity->_remove_relations($relationName); | |
| 59 | + /** | |
| 60 | + * Sets the related tickets for the given datetime. | |
| 61 | + * | |
| 62 | + * @param EE_Datetime $entity The datetime instance. | |
| 63 | + * @param array $tickets Array of ticket IDs to relate. | |
| 64 | + */ | |
| 65 | + public static function setRelatedTickets($entity, array $tickets) | |
| 66 | +	{ | |
| 67 | + $relationName = 'Ticket'; | |
| 68 | + // Remove all the existing related tickets | |
| 69 | + $entity->_remove_relations($relationName); | |
| 70 | 70 | |
| 71 | -        foreach ($tickets as $ID) { | |
| 72 | - $parts = Relay::fromGlobalId($ID); | |
| 73 | -            if (! empty($parts['id']) && absint($parts['id'])) { | |
| 74 | - $entity->_add_relation_to( | |
| 75 | - $parts['id'], | |
| 76 | - $relationName | |
| 77 | - ); | |
| 78 | - } | |
| 79 | - } | |
| 80 | - } | |
| 71 | +		foreach ($tickets as $ID) { | |
| 72 | + $parts = Relay::fromGlobalId($ID); | |
| 73 | +			if (! empty($parts['id']) && absint($parts['id'])) { | |
| 74 | + $entity->_add_relation_to( | |
| 75 | + $parts['id'], | |
| 76 | + $relationName | |
| 77 | + ); | |
| 78 | + } | |
| 79 | + } | |
| 80 | + } | |
| 81 | 81 | } | 
| @@ -24,30 +24,30 @@ discard block | ||
| 24 | 24 | |
| 25 | 25 | $args = []; | 
| 26 | 26 | |
| 27 | -        if (! empty($input['eventId'])) { | |
| 27 | +        if ( ! empty($input['eventId'])) { | |
| 28 | 28 | $args['EVT_ID'] = absint($input['eventId']); | 
| 29 | -        } elseif (! empty($input['event'])) { | |
| 29 | +        } elseif ( ! empty($input['event'])) { | |
| 30 | 30 | $parts = Relay::fromGlobalId($input['event']); | 
| 31 | - $args['EVT_ID'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; | |
| 31 | + $args['EVT_ID'] = ( ! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; | |
| 32 | 32 | } | 
| 33 | 33 | |
| 34 | -        if (! empty($input['name'])) { | |
| 34 | +        if ( ! empty($input['name'])) { | |
| 35 | 35 | $args['DTT_name'] = sanitize_text_field($input['name']); | 
| 36 | 36 | } | 
| 37 | 37 | |
| 38 | -        if (! empty($input['description'])) { | |
| 38 | +        if ( ! empty($input['description'])) { | |
| 39 | 39 | $args['DTT_description'] = sanitize_text_field($input['description']); | 
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | -        if (! empty($input['startDate'])) { | |
| 42 | +        if ( ! empty($input['startDate'])) { | |
| 43 | 43 | $args['DTT_EVT_start'] = sanitize_text_field($input['startDate']); | 
| 44 | 44 | } | 
| 45 | 45 | |
| 46 | -        if (! empty($input['endDate'])) { | |
| 46 | +        if ( ! empty($input['endDate'])) { | |
| 47 | 47 | $args['DTT_EVT_end'] = sanitize_text_field($input['endDate']); | 
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | -        if (! empty($input['tickets'])) { | |
| 50 | +        if ( ! empty($input['tickets'])) { | |
| 51 | 51 |              $args['tickets'] = array_map('sanitize_text_field', (array) $input['tickets']); | 
| 52 | 52 | } | 
| 53 | 53 | |
| @@ -70,7 +70,7 @@ discard block | ||
| 70 | 70 | |
| 71 | 71 |          foreach ($tickets as $ID) { | 
| 72 | 72 | $parts = Relay::fromGlobalId($ID); | 
| 73 | -            if (! empty($parts['id']) && absint($parts['id'])) { | |
| 73 | +            if ( ! empty($parts['id']) && absint($parts['id'])) { | |
| 74 | 74 | $entity->_add_relation_to( | 
| 75 | 75 | $parts['id'], | 
| 76 | 76 | $relationName | 
| @@ -13,58 +13,58 @@ | ||
| 13 | 13 | class TicketMutation | 
| 14 | 14 |  { | 
| 15 | 15 | |
| 16 | - /** | |
| 17 | - * Maps the GraphQL input to a format that the model functions can use | |
| 18 | - * | |
| 19 | - * @param array $input Data coming from the GraphQL mutation query input | |
| 20 | - * @return array | |
| 21 | - */ | |
| 22 | - public static function prepareFields(array $input) | |
| 23 | -    { | |
| 16 | + /** | |
| 17 | + * Maps the GraphQL input to a format that the model functions can use | |
| 18 | + * | |
| 19 | + * @param array $input Data coming from the GraphQL mutation query input | |
| 20 | + * @return array | |
| 21 | + */ | |
| 22 | + public static function prepareFields(array $input) | |
| 23 | +	{ | |
| 24 | 24 | |
| 25 | - $args = []; | |
| 25 | + $args = []; | |
| 26 | 26 | |
| 27 | -        if (! empty($input['name'])) { | |
| 28 | - $args['TKT_name'] = sanitize_text_field($input['name']); | |
| 29 | - } | |
| 27 | +		if (! empty($input['name'])) { | |
| 28 | + $args['TKT_name'] = sanitize_text_field($input['name']); | |
| 29 | + } | |
| 30 | 30 | |
| 31 | -        if (! empty($input['description'])) { | |
| 32 | - $args['TKT_description'] = sanitize_text_field($input['description']); | |
| 33 | - } | |
| 31 | +		if (! empty($input['description'])) { | |
| 32 | + $args['TKT_description'] = sanitize_text_field($input['description']); | |
| 33 | + } | |
| 34 | 34 | |
| 35 | -        if (! empty($input['price'])) { | |
| 36 | - $args['TKT_price'] = floatval($input['price']); | |
| 37 | - } | |
| 35 | +		if (! empty($input['price'])) { | |
| 36 | + $args['TKT_price'] = floatval($input['price']); | |
| 37 | + } | |
| 38 | 38 | |
| 39 | -        if (! empty($input['datetimes'])) { | |
| 40 | -            $args['datetimes'] = array_map('sanitize_text_field', (array) $input['datetimes']); | |
| 41 | - } | |
| 39 | +		if (! empty($input['datetimes'])) { | |
| 40 | +			$args['datetimes'] = array_map('sanitize_text_field', (array) $input['datetimes']); | |
| 41 | + } | |
| 42 | 42 | |
| 43 | - // Likewise the other fields... | |
| 43 | + // Likewise the other fields... | |
| 44 | 44 | |
| 45 | - return $args; | |
| 46 | - } | |
| 45 | + return $args; | |
| 46 | + } | |
| 47 | 47 | |
| 48 | - /** | |
| 49 | - * Sets the related tickets for the given datetime. | |
| 50 | - * | |
| 51 | - * @param EE_Ticket $entity The Ticket instance. | |
| 52 | - * @param array $datetimes Array of datetime IDs to relate. | |
| 53 | - */ | |
| 54 | - public static function setRelatedDatetimes($entity, array $datetimes) | |
| 55 | -    { | |
| 56 | - $relationName = 'Datetime'; | |
| 57 | - // Remove all the existing related datetimes | |
| 58 | - $entity->_remove_relations($relationName); | |
| 48 | + /** | |
| 49 | + * Sets the related tickets for the given datetime. | |
| 50 | + * | |
| 51 | + * @param EE_Ticket $entity The Ticket instance. | |
| 52 | + * @param array $datetimes Array of datetime IDs to relate. | |
| 53 | + */ | |
| 54 | + public static function setRelatedDatetimes($entity, array $datetimes) | |
| 55 | +	{ | |
| 56 | + $relationName = 'Datetime'; | |
| 57 | + // Remove all the existing related datetimes | |
| 58 | + $entity->_remove_relations($relationName); | |
| 59 | 59 | |
| 60 | -        foreach ($datetimes as $ID) { | |
| 61 | - $parts = Relay::fromGlobalId($ID); | |
| 62 | -            if (! empty($parts['id']) && absint($parts['id'])) { | |
| 63 | - $entity->_add_relation_to( | |
| 64 | - $parts['id'], | |
| 65 | - $relationName | |
| 66 | - ); | |
| 67 | - } | |
| 68 | - } | |
| 69 | - } | |
| 60 | +		foreach ($datetimes as $ID) { | |
| 61 | + $parts = Relay::fromGlobalId($ID); | |
| 62 | +			if (! empty($parts['id']) && absint($parts['id'])) { | |
| 63 | + $entity->_add_relation_to( | |
| 64 | + $parts['id'], | |
| 65 | + $relationName | |
| 66 | + ); | |
| 67 | + } | |
| 68 | + } | |
| 69 | + } | |
| 70 | 70 | } | 
| @@ -24,19 +24,19 @@ discard block | ||
| 24 | 24 | |
| 25 | 25 | $args = []; | 
| 26 | 26 | |
| 27 | -        if (! empty($input['name'])) { | |
| 27 | +        if ( ! empty($input['name'])) { | |
| 28 | 28 | $args['TKT_name'] = sanitize_text_field($input['name']); | 
| 29 | 29 | } | 
| 30 | 30 | |
| 31 | -        if (! empty($input['description'])) { | |
| 31 | +        if ( ! empty($input['description'])) { | |
| 32 | 32 | $args['TKT_description'] = sanitize_text_field($input['description']); | 
| 33 | 33 | } | 
| 34 | 34 | |
| 35 | -        if (! empty($input['price'])) { | |
| 35 | +        if ( ! empty($input['price'])) { | |
| 36 | 36 | $args['TKT_price'] = floatval($input['price']); | 
| 37 | 37 | } | 
| 38 | 38 | |
| 39 | -        if (! empty($input['datetimes'])) { | |
| 39 | +        if ( ! empty($input['datetimes'])) { | |
| 40 | 40 |              $args['datetimes'] = array_map('sanitize_text_field', (array) $input['datetimes']); | 
| 41 | 41 | } | 
| 42 | 42 | |
| @@ -59,7 +59,7 @@ discard block | ||
| 59 | 59 | |
| 60 | 60 |          foreach ($datetimes as $ID) { | 
| 61 | 61 | $parts = Relay::fromGlobalId($ID); | 
| 62 | -            if (! empty($parts['id']) && absint($parts['id'])) { | |
| 62 | +            if ( ! empty($parts['id']) && absint($parts['id'])) { | |
| 63 | 63 | $entity->_add_relation_to( | 
| 64 | 64 | $parts['id'], | 
| 65 | 65 | $relationName |