@@ -38,8 +38,8 @@ |
||
38 | 38 | { |
39 | 39 | return [ |
40 | 40 | 'fromType' => 'RootQuery', |
41 | - 'toType' => $this->namespace . 'State', |
|
42 | - 'fromFieldName' => lcfirst($this->namespace) . 'States', |
|
41 | + 'toType' => $this->namespace.'State', |
|
42 | + 'fromFieldName' => lcfirst($this->namespace).'States', |
|
43 | 43 | 'connectionTypeName' => "{$this->namespace}RootQueryStatesConnection", |
44 | 44 | 'connectionArgs' => self::get_connection_args(), |
45 | 45 | 'resolve' => [$this, 'resolveConnection'], |
@@ -18,95 +18,95 @@ |
||
18 | 18 | */ |
19 | 19 | class RootQueryStatesConnection extends AbstractRootQueryConnection |
20 | 20 | { |
21 | - /** |
|
22 | - * StateConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_State $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_State $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * StateConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_State $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_State $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => 'RootQuery', |
|
39 | - 'toType' => $this->namespace . 'State', |
|
40 | - 'fromFieldName' => lcfirst($this->namespace) . 'States', |
|
41 | - 'connectionTypeName' => "{$this->namespace}RootQueryStatesConnection", |
|
42 | - 'connectionArgs' => self::get_connection_args(), |
|
43 | - 'resolve' => [$this, 'resolveConnection'], |
|
44 | - ]; |
|
45 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => 'RootQuery', |
|
39 | + 'toType' => $this->namespace . 'State', |
|
40 | + 'fromFieldName' => lcfirst($this->namespace) . 'States', |
|
41 | + 'connectionTypeName' => "{$this->namespace}RootQueryStatesConnection", |
|
42 | + 'connectionArgs' => self::get_connection_args(), |
|
43 | + 'resolve' => [$this, 'resolveConnection'], |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param $entity |
|
50 | - * @param $args |
|
51 | - * @param $context |
|
52 | - * @param $info |
|
53 | - * @return StateConnectionResolver |
|
54 | - * @throws Exception |
|
55 | - */ |
|
56 | - public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | - { |
|
58 | - return new StateConnectionResolver($entity, $args, $context, $info); |
|
59 | - } |
|
48 | + /** |
|
49 | + * @param $entity |
|
50 | + * @param $args |
|
51 | + * @param $context |
|
52 | + * @param $info |
|
53 | + * @return StateConnectionResolver |
|
54 | + * @throws Exception |
|
55 | + */ |
|
56 | + public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | + { |
|
58 | + return new StateConnectionResolver($entity, $args, $context, $info); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Given an optional array of args, this returns the args to be used in the connection |
|
63 | - * |
|
64 | - * @param array $args The args to modify the defaults |
|
65 | - * @return array |
|
66 | - */ |
|
67 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
68 | - public static function get_connection_args(array $args = []): array |
|
69 | - { |
|
70 | - $newArgs = [ |
|
71 | - 'orderby' => [ |
|
72 | - 'type' => ['list_of' => 'EspressoCountriesConnectionOrderbyInput'], |
|
73 | - 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
74 | - ], |
|
75 | - 'in' => [ |
|
76 | - 'type' => ['list_of' => 'ID'], |
|
77 | - 'description' => esc_html__( |
|
78 | - 'Limit the result to the set of given state IDs.', |
|
79 | - 'event_espresso' |
|
80 | - ), |
|
81 | - ], |
|
82 | - 'countryIsoIn' => [ |
|
83 | - 'type' => ['list_of' => 'String'], |
|
84 | - 'description' => esc_html__( |
|
85 | - 'Limit the result to the set of given country ISOs.', |
|
86 | - 'event_espresso' |
|
87 | - ), |
|
88 | - ], |
|
89 | - 'search' => [ |
|
90 | - 'type' => 'String', |
|
91 | - 'description' => esc_html__('The search keywords', 'event_espresso'), |
|
92 | - ], |
|
93 | - 'activeOnly' => [ |
|
94 | - 'type' => 'Boolean', |
|
95 | - 'description' => esc_html__( |
|
96 | - 'Limit the result to the active states.', |
|
97 | - 'event_espresso' |
|
98 | - ), |
|
99 | - ], |
|
100 | - ]; |
|
61 | + /** |
|
62 | + * Given an optional array of args, this returns the args to be used in the connection |
|
63 | + * |
|
64 | + * @param array $args The args to modify the defaults |
|
65 | + * @return array |
|
66 | + */ |
|
67 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
68 | + public static function get_connection_args(array $args = []): array |
|
69 | + { |
|
70 | + $newArgs = [ |
|
71 | + 'orderby' => [ |
|
72 | + 'type' => ['list_of' => 'EspressoCountriesConnectionOrderbyInput'], |
|
73 | + 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
74 | + ], |
|
75 | + 'in' => [ |
|
76 | + 'type' => ['list_of' => 'ID'], |
|
77 | + 'description' => esc_html__( |
|
78 | + 'Limit the result to the set of given state IDs.', |
|
79 | + 'event_espresso' |
|
80 | + ), |
|
81 | + ], |
|
82 | + 'countryIsoIn' => [ |
|
83 | + 'type' => ['list_of' => 'String'], |
|
84 | + 'description' => esc_html__( |
|
85 | + 'Limit the result to the set of given country ISOs.', |
|
86 | + 'event_espresso' |
|
87 | + ), |
|
88 | + ], |
|
89 | + 'search' => [ |
|
90 | + 'type' => 'String', |
|
91 | + 'description' => esc_html__('The search keywords', 'event_espresso'), |
|
92 | + ], |
|
93 | + 'activeOnly' => [ |
|
94 | + 'type' => 'Boolean', |
|
95 | + 'description' => esc_html__( |
|
96 | + 'Limit the result to the active states.', |
|
97 | + 'event_espresso' |
|
98 | + ), |
|
99 | + ], |
|
100 | + ]; |
|
101 | 101 | |
102 | - $newArgs = apply_filters( |
|
103 | - 'FHEE__EventEspresso_core_domain_services_graphql_connections__state_args', |
|
104 | - $newArgs, |
|
105 | - $args |
|
106 | - ); |
|
107 | - return array_merge( |
|
108 | - $newArgs, |
|
109 | - $args |
|
110 | - ); |
|
111 | - } |
|
102 | + $newArgs = apply_filters( |
|
103 | + 'FHEE__EventEspresso_core_domain_services_graphql_connections__state_args', |
|
104 | + $newArgs, |
|
105 | + $args |
|
106 | + ); |
|
107 | + return array_merge( |
|
108 | + $newArgs, |
|
109 | + $args |
|
110 | + ); |
|
111 | + } |
|
112 | 112 | } |
@@ -38,8 +38,8 @@ |
||
38 | 38 | { |
39 | 39 | return [ |
40 | 40 | 'fromType' => 'RootQuery', |
41 | - 'toType' => $this->namespace . 'Country', |
|
42 | - 'fromFieldName' => lcfirst($this->namespace . 'Countries'), |
|
41 | + 'toType' => $this->namespace.'Country', |
|
42 | + 'fromFieldName' => lcfirst($this->namespace.'Countries'), |
|
43 | 43 | 'connectionTypeName' => "{$this->namespace}RootQueryCountriesConnection", |
44 | 44 | 'connectionArgs' => RootQueryCountriesConnection::get_connection_args(), |
45 | 45 | 'resolve' => [$this, 'resolveConnection'], |
@@ -18,105 +18,105 @@ |
||
18 | 18 | */ |
19 | 19 | class RootQueryCountriesConnection extends AbstractRootQueryConnection |
20 | 20 | { |
21 | - /** |
|
22 | - * CountryConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Country $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Country $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * CountryConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Country $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Country $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => 'RootQuery', |
|
39 | - 'toType' => $this->namespace . 'Country', |
|
40 | - 'fromFieldName' => lcfirst($this->namespace . 'Countries'), |
|
41 | - 'connectionTypeName' => "{$this->namespace}RootQueryCountriesConnection", |
|
42 | - 'connectionArgs' => RootQueryCountriesConnection::get_connection_args(), |
|
43 | - 'resolve' => [$this, 'resolveConnection'], |
|
44 | - ]; |
|
45 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => 'RootQuery', |
|
39 | + 'toType' => $this->namespace . 'Country', |
|
40 | + 'fromFieldName' => lcfirst($this->namespace . 'Countries'), |
|
41 | + 'connectionTypeName' => "{$this->namespace}RootQueryCountriesConnection", |
|
42 | + 'connectionArgs' => RootQueryCountriesConnection::get_connection_args(), |
|
43 | + 'resolve' => [$this, 'resolveConnection'], |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param $entity |
|
50 | - * @param $args |
|
51 | - * @param $context |
|
52 | - * @param $info |
|
53 | - * @return CountryConnectionResolver |
|
54 | - * @throws Exception |
|
55 | - */ |
|
56 | - public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | - { |
|
58 | - return new CountryConnectionResolver($entity, $args, $context, $info); |
|
59 | - } |
|
48 | + /** |
|
49 | + * @param $entity |
|
50 | + * @param $args |
|
51 | + * @param $context |
|
52 | + * @param $info |
|
53 | + * @return CountryConnectionResolver |
|
54 | + * @throws Exception |
|
55 | + */ |
|
56 | + public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | + { |
|
58 | + return new CountryConnectionResolver($entity, $args, $context, $info); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Given an optional array of args, this returns the args to be used in the connection |
|
63 | - * |
|
64 | - * @param array $args The args to modify the defaults |
|
65 | - * @return array |
|
66 | - */ |
|
67 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
68 | - public static function get_connection_args(array $args = []): array |
|
69 | - { |
|
70 | - $newArgs = [ |
|
71 | - 'orderby' => [ |
|
72 | - 'type' => ['list_of' => 'EspressoCountriesConnectionOrderbyInput'], |
|
73 | - 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
74 | - ], |
|
75 | - 'in' => [ |
|
76 | - 'type' => ['list_of' => 'ID'], |
|
77 | - 'description' => esc_html__( |
|
78 | - 'Limit the result to the set of given country IDs.', |
|
79 | - 'event_espresso' |
|
80 | - ), |
|
81 | - ], |
|
82 | - 'isoIn' => [ |
|
83 | - 'type' => ['list_of' => 'String'], |
|
84 | - 'description' => esc_html__( |
|
85 | - 'Limit the result to the set of given country ISOs.', |
|
86 | - 'event_espresso' |
|
87 | - ), |
|
88 | - ], |
|
89 | - 'iso3In' => [ |
|
90 | - 'type' => ['list_of' => 'String'], |
|
91 | - 'description' => esc_html__( |
|
92 | - 'Limit the result to the set of given country ISO3s.', |
|
93 | - 'event_espresso' |
|
94 | - ), |
|
95 | - ], |
|
96 | - 'search' => [ |
|
97 | - 'type' => 'String', |
|
98 | - 'description' => esc_html__( |
|
99 | - 'Limit the result to the given search query.', |
|
100 | - 'event_espresso' |
|
101 | - ), |
|
102 | - ], |
|
103 | - 'activeOnly' => [ |
|
104 | - 'type' => 'Boolean', |
|
105 | - 'description' => esc_html__( |
|
106 | - 'Limit the result to the active countries.', |
|
107 | - 'event_espresso' |
|
108 | - ), |
|
109 | - ], |
|
110 | - ]; |
|
61 | + /** |
|
62 | + * Given an optional array of args, this returns the args to be used in the connection |
|
63 | + * |
|
64 | + * @param array $args The args to modify the defaults |
|
65 | + * @return array |
|
66 | + */ |
|
67 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
68 | + public static function get_connection_args(array $args = []): array |
|
69 | + { |
|
70 | + $newArgs = [ |
|
71 | + 'orderby' => [ |
|
72 | + 'type' => ['list_of' => 'EspressoCountriesConnectionOrderbyInput'], |
|
73 | + 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
74 | + ], |
|
75 | + 'in' => [ |
|
76 | + 'type' => ['list_of' => 'ID'], |
|
77 | + 'description' => esc_html__( |
|
78 | + 'Limit the result to the set of given country IDs.', |
|
79 | + 'event_espresso' |
|
80 | + ), |
|
81 | + ], |
|
82 | + 'isoIn' => [ |
|
83 | + 'type' => ['list_of' => 'String'], |
|
84 | + 'description' => esc_html__( |
|
85 | + 'Limit the result to the set of given country ISOs.', |
|
86 | + 'event_espresso' |
|
87 | + ), |
|
88 | + ], |
|
89 | + 'iso3In' => [ |
|
90 | + 'type' => ['list_of' => 'String'], |
|
91 | + 'description' => esc_html__( |
|
92 | + 'Limit the result to the set of given country ISO3s.', |
|
93 | + 'event_espresso' |
|
94 | + ), |
|
95 | + ], |
|
96 | + 'search' => [ |
|
97 | + 'type' => 'String', |
|
98 | + 'description' => esc_html__( |
|
99 | + 'Limit the result to the given search query.', |
|
100 | + 'event_espresso' |
|
101 | + ), |
|
102 | + ], |
|
103 | + 'activeOnly' => [ |
|
104 | + 'type' => 'Boolean', |
|
105 | + 'description' => esc_html__( |
|
106 | + 'Limit the result to the active countries.', |
|
107 | + 'event_espresso' |
|
108 | + ), |
|
109 | + ], |
|
110 | + ]; |
|
111 | 111 | |
112 | - $newArgs = apply_filters( |
|
113 | - 'FHEE__EventEspresso_core_domain_services_graphql_connections__country_args', |
|
114 | - $newArgs, |
|
115 | - $args |
|
116 | - ); |
|
117 | - return array_merge( |
|
118 | - $newArgs, |
|
119 | - $args |
|
120 | - ); |
|
121 | - } |
|
112 | + $newArgs = apply_filters( |
|
113 | + 'FHEE__EventEspresso_core_domain_services_graphql_connections__country_args', |
|
114 | + $newArgs, |
|
115 | + $args |
|
116 | + ); |
|
117 | + return array_merge( |
|
118 | + $newArgs, |
|
119 | + $args |
|
120 | + ); |
|
121 | + } |
|
122 | 122 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function __construct() |
24 | 24 | { |
25 | - $this->setName($this->namespace . 'StatesConnectionOrderbyInput'); |
|
25 | + $this->setName($this->namespace.'StatesConnectionOrderbyInput'); |
|
26 | 26 | $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso')); |
27 | 27 | parent::__construct(); |
28 | 28 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | return [ |
37 | 37 | new GraphQLField( |
38 | 38 | 'field', |
39 | - ['non_null' => $this->namespace . 'StatesConnectionOrderbyEnum'] |
|
39 | + ['non_null' => $this->namespace.'StatesConnectionOrderbyEnum'] |
|
40 | 40 | ), |
41 | 41 | new GraphQLField( |
42 | 42 | 'order', |
@@ -16,31 +16,31 @@ |
||
16 | 16 | */ |
17 | 17 | class StatesConnectionOrderbyInput extends InputBase |
18 | 18 | { |
19 | - /** |
|
20 | - * StatesConnectionOrderbyInput constructor. |
|
21 | - */ |
|
22 | - public function __construct() |
|
23 | - { |
|
24 | - $this->setName($this->namespace . 'StatesConnectionOrderbyInput'); |
|
25 | - $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso')); |
|
26 | - parent::__construct(); |
|
27 | - } |
|
19 | + /** |
|
20 | + * StatesConnectionOrderbyInput constructor. |
|
21 | + */ |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + $this->setName($this->namespace . 'StatesConnectionOrderbyInput'); |
|
25 | + $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso')); |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @return GraphQLFieldInterface[] |
|
32 | - */ |
|
33 | - protected function getFields(): array |
|
34 | - { |
|
35 | - return [ |
|
36 | - new GraphQLField( |
|
37 | - 'field', |
|
38 | - ['non_null' => $this->namespace . 'StatesConnectionOrderbyEnum'] |
|
39 | - ), |
|
40 | - new GraphQLField( |
|
41 | - 'order', |
|
42 | - 'OrderEnum' |
|
43 | - ), |
|
44 | - ]; |
|
45 | - } |
|
30 | + /** |
|
31 | + * @return GraphQLFieldInterface[] |
|
32 | + */ |
|
33 | + protected function getFields(): array |
|
34 | + { |
|
35 | + return [ |
|
36 | + new GraphQLField( |
|
37 | + 'field', |
|
38 | + ['non_null' => $this->namespace . 'StatesConnectionOrderbyEnum'] |
|
39 | + ), |
|
40 | + new GraphQLField( |
|
41 | + 'order', |
|
42 | + 'OrderEnum' |
|
43 | + ), |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function __construct() |
24 | 24 | { |
25 | - $this->setName($this->namespace . 'CountriesConnectionOrderbyInput'); |
|
25 | + $this->setName($this->namespace.'CountriesConnectionOrderbyInput'); |
|
26 | 26 | $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso')); |
27 | 27 | parent::__construct(); |
28 | 28 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | return [ |
37 | 37 | new GraphQLField( |
38 | 38 | 'field', |
39 | - ['non_null' => $this->namespace . 'CountriesConnectionOrderbyEnum'] |
|
39 | + ['non_null' => $this->namespace.'CountriesConnectionOrderbyEnum'] |
|
40 | 40 | ), |
41 | 41 | new GraphQLField( |
42 | 42 | 'order', |
@@ -16,31 +16,31 @@ |
||
16 | 16 | */ |
17 | 17 | class CountriesConnectionOrderbyInput extends InputBase |
18 | 18 | { |
19 | - /** |
|
20 | - * CountriesConnectionOrderbyInput constructor. |
|
21 | - */ |
|
22 | - public function __construct() |
|
23 | - { |
|
24 | - $this->setName($this->namespace . 'CountriesConnectionOrderbyInput'); |
|
25 | - $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso')); |
|
26 | - parent::__construct(); |
|
27 | - } |
|
19 | + /** |
|
20 | + * CountriesConnectionOrderbyInput constructor. |
|
21 | + */ |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + $this->setName($this->namespace . 'CountriesConnectionOrderbyInput'); |
|
25 | + $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso')); |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @return GraphQLFieldInterface[] |
|
32 | - */ |
|
33 | - protected function getFields(): array |
|
34 | - { |
|
35 | - return [ |
|
36 | - new GraphQLField( |
|
37 | - 'field', |
|
38 | - ['non_null' => $this->namespace . 'CountriesConnectionOrderbyEnum'] |
|
39 | - ), |
|
40 | - new GraphQLField( |
|
41 | - 'order', |
|
42 | - 'OrderEnum' |
|
43 | - ), |
|
44 | - ]; |
|
45 | - } |
|
30 | + /** |
|
31 | + * @return GraphQLFieldInterface[] |
|
32 | + */ |
|
33 | + protected function getFields(): array |
|
34 | + { |
|
35 | + return [ |
|
36 | + new GraphQLField( |
|
37 | + 'field', |
|
38 | + ['non_null' => $this->namespace . 'CountriesConnectionOrderbyEnum'] |
|
39 | + ), |
|
40 | + new GraphQLField( |
|
41 | + 'order', |
|
42 | + 'OrderEnum' |
|
43 | + ), |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | } |
@@ -15,28 +15,28 @@ |
||
15 | 15 | */ |
16 | 16 | class CountryLoader extends AbstractLoader |
17 | 17 | { |
18 | - /** |
|
19 | - * @return EEM_Base|EEM_Country |
|
20 | - * @throws EE_Error |
|
21 | - * @throws InvalidArgumentException |
|
22 | - * @throws InvalidDataTypeException |
|
23 | - * @throws InvalidInterfaceException |
|
24 | - * @throws ReflectionException |
|
25 | - */ |
|
26 | - protected function getQuery(): EEM_Base |
|
27 | - { |
|
28 | - return EEM_Country::instance(); |
|
29 | - } |
|
18 | + /** |
|
19 | + * @return EEM_Base|EEM_Country |
|
20 | + * @throws EE_Error |
|
21 | + * @throws InvalidArgumentException |
|
22 | + * @throws InvalidDataTypeException |
|
23 | + * @throws InvalidInterfaceException |
|
24 | + * @throws ReflectionException |
|
25 | + */ |
|
26 | + protected function getQuery(): EEM_Base |
|
27 | + { |
|
28 | + return EEM_Country::instance(); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @param array $keys |
|
34 | - * @return array |
|
35 | - */ |
|
36 | - protected function getWhereParams(array $keys): array |
|
37 | - { |
|
38 | - return [ |
|
39 | - 'CNT_ISO' => ['IN', $keys], |
|
40 | - ]; |
|
41 | - } |
|
32 | + /** |
|
33 | + * @param array $keys |
|
34 | + * @return array |
|
35 | + */ |
|
36 | + protected function getWhereParams(array $keys): array |
|
37 | + { |
|
38 | + return [ |
|
39 | + 'CNT_ISO' => ['IN', $keys], |
|
40 | + ]; |
|
41 | + } |
|
42 | 42 | } |
@@ -15,28 +15,28 @@ |
||
15 | 15 | */ |
16 | 16 | class StateLoader extends AbstractLoader |
17 | 17 | { |
18 | - /** |
|
19 | - * @return EEM_Base|EEM_State |
|
20 | - * @throws EE_Error |
|
21 | - * @throws InvalidArgumentException |
|
22 | - * @throws InvalidDataTypeException |
|
23 | - * @throws InvalidInterfaceException |
|
24 | - * @throws ReflectionException |
|
25 | - */ |
|
26 | - protected function getQuery(): EEM_Base |
|
27 | - { |
|
28 | - return EEM_State::instance(); |
|
29 | - } |
|
18 | + /** |
|
19 | + * @return EEM_Base|EEM_State |
|
20 | + * @throws EE_Error |
|
21 | + * @throws InvalidArgumentException |
|
22 | + * @throws InvalidDataTypeException |
|
23 | + * @throws InvalidInterfaceException |
|
24 | + * @throws ReflectionException |
|
25 | + */ |
|
26 | + protected function getQuery(): EEM_Base |
|
27 | + { |
|
28 | + return EEM_State::instance(); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @param array $keys |
|
34 | - * @return array |
|
35 | - */ |
|
36 | - protected function getWhereParams(array $keys): array |
|
37 | - { |
|
38 | - return [ |
|
39 | - 'STA_ID' => ['IN', $keys], |
|
40 | - ]; |
|
41 | - } |
|
32 | + /** |
|
33 | + * @param array $keys |
|
34 | + * @return array |
|
35 | + */ |
|
36 | + protected function getWhereParams(array $keys): array |
|
37 | + { |
|
38 | + return [ |
|
39 | + 'STA_ID' => ['IN', $keys], |
|
40 | + ]; |
|
41 | + } |
|
42 | 42 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function __construct() |
22 | 22 | { |
23 | - $this->setName($this->namespace . 'CountriesConnectionOrderbyEnum'); |
|
23 | + $this->setName($this->namespace.'CountriesConnectionOrderbyEnum'); |
|
24 | 24 | $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
25 | 25 | parent::__construct(); |
26 | 26 | } |
@@ -14,35 +14,35 @@ |
||
14 | 14 | */ |
15 | 15 | class CountriesConnectionOrderbyEnum extends EnumBase |
16 | 16 | { |
17 | - /** |
|
18 | - * CountriesConnectionOrderbyEnum constructor. |
|
19 | - */ |
|
20 | - public function __construct() |
|
21 | - { |
|
22 | - $this->setName($this->namespace . 'CountriesConnectionOrderbyEnum'); |
|
23 | - $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
|
24 | - parent::__construct(); |
|
25 | - } |
|
17 | + /** |
|
18 | + * CountriesConnectionOrderbyEnum constructor. |
|
19 | + */ |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + $this->setName($this->namespace . 'CountriesConnectionOrderbyEnum'); |
|
23 | + $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
|
24 | + parent::__construct(); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @return array |
|
30 | - */ |
|
31 | - protected function getValues(): array |
|
32 | - { |
|
33 | - return [ |
|
34 | - 'NAME' => [ |
|
35 | - 'value' => 'CNT_name', |
|
36 | - 'description' => esc_html__('Order by country name', 'event_espresso'), |
|
37 | - ], |
|
38 | - 'ISO' => [ |
|
39 | - 'value' => 'CNT_ISO', |
|
40 | - 'description' => esc_html__('Order by country ISO', 'event_espresso'), |
|
41 | - ], |
|
42 | - 'CNT_ISO3' => [ |
|
43 | - 'value' => 'CNT_ISO3', |
|
44 | - 'description' => esc_html__('Order by country ISO3', 'event_espresso'), |
|
45 | - ], |
|
46 | - ]; |
|
47 | - } |
|
28 | + /** |
|
29 | + * @return array |
|
30 | + */ |
|
31 | + protected function getValues(): array |
|
32 | + { |
|
33 | + return [ |
|
34 | + 'NAME' => [ |
|
35 | + 'value' => 'CNT_name', |
|
36 | + 'description' => esc_html__('Order by country name', 'event_espresso'), |
|
37 | + ], |
|
38 | + 'ISO' => [ |
|
39 | + 'value' => 'CNT_ISO', |
|
40 | + 'description' => esc_html__('Order by country ISO', 'event_espresso'), |
|
41 | + ], |
|
42 | + 'CNT_ISO3' => [ |
|
43 | + 'value' => 'CNT_ISO3', |
|
44 | + 'description' => esc_html__('Order by country ISO3', 'event_espresso'), |
|
45 | + ], |
|
46 | + ]; |
|
47 | + } |
|
48 | 48 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function __construct() |
22 | 22 | { |
23 | - $this->setName($this->namespace . 'StatesConnectionOrderbyEnum'); |
|
23 | + $this->setName($this->namespace.'StatesConnectionOrderbyEnum'); |
|
24 | 24 | $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
25 | 25 | parent::__construct(); |
26 | 26 | } |
@@ -14,31 +14,31 @@ |
||
14 | 14 | */ |
15 | 15 | class StatesConnectionOrderbyEnum extends EnumBase |
16 | 16 | { |
17 | - /** |
|
18 | - * StatesConnectionOrderbyEnum constructor. |
|
19 | - */ |
|
20 | - public function __construct() |
|
21 | - { |
|
22 | - $this->setName($this->namespace . 'StatesConnectionOrderbyEnum'); |
|
23 | - $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
|
24 | - parent::__construct(); |
|
25 | - } |
|
17 | + /** |
|
18 | + * StatesConnectionOrderbyEnum constructor. |
|
19 | + */ |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + $this->setName($this->namespace . 'StatesConnectionOrderbyEnum'); |
|
23 | + $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
|
24 | + parent::__construct(); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @return array |
|
30 | - */ |
|
31 | - protected function getValues(): array |
|
32 | - { |
|
33 | - return [ |
|
34 | - 'NAME' => [ |
|
35 | - 'value' => 'CNT_name', |
|
36 | - 'description' => esc_html__('Order by state name', 'event_espresso'), |
|
37 | - ], |
|
38 | - 'COUNTRY_ISO' => [ |
|
39 | - 'value' => 'CNT_ISO', |
|
40 | - 'description' => esc_html__('Order by country ISO', 'event_espresso'), |
|
41 | - ], |
|
42 | - ]; |
|
43 | - } |
|
28 | + /** |
|
29 | + * @return array |
|
30 | + */ |
|
31 | + protected function getValues(): array |
|
32 | + { |
|
33 | + return [ |
|
34 | + 'NAME' => [ |
|
35 | + 'value' => 'CNT_name', |
|
36 | + 'description' => esc_html__('Order by state name', 'event_espresso'), |
|
37 | + ], |
|
38 | + 'COUNTRY_ISO' => [ |
|
39 | + 'value' => 'CNT_ISO', |
|
40 | + 'description' => esc_html__('Order by country ISO', 'event_espresso'), |
|
41 | + ], |
|
42 | + ]; |
|
43 | + } |
|
44 | 44 | } |
@@ -14,152 +14,152 @@ |
||
14 | 14 | */ |
15 | 15 | class StateConnectionResolver extends AbstractConnectionResolver |
16 | 16 | { |
17 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
18 | - public function get_loader_name(): string |
|
19 | - { |
|
20 | - return 'espresso_state'; |
|
21 | - } |
|
22 | - |
|
23 | - /** |
|
24 | - * @return EEM_State |
|
25 | - * @throws EE_Error |
|
26 | - * @throws InvalidArgumentException |
|
27 | - * @throws InvalidDataTypeException |
|
28 | - * @throws InvalidInterfaceException |
|
29 | - * @throws ReflectionException |
|
30 | - */ |
|
31 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
32 | - public function get_query(): EEM_State |
|
33 | - { |
|
34 | - return EEM_State::instance(); |
|
35 | - } |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * Return an array of item IDs from the query |
|
40 | - * |
|
41 | - * @return array |
|
42 | - */ |
|
43 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
44 | - public function get_ids(): array |
|
45 | - { |
|
46 | - $results = $this->query->get_col($this->query_args); |
|
47 | - |
|
48 | - return ! empty($results) ? $results : []; |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * Here, we map the args from the input, then we make sure that we're only querying |
|
54 | - * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers |
|
55 | - * handle batch resolution of the posts. |
|
56 | - * |
|
57 | - * @return array |
|
58 | - * @throws InvalidArgumentException |
|
59 | - * @throws InvalidDataTypeException |
|
60 | - * @throws InvalidInterfaceException |
|
61 | - */ |
|
62 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
63 | - public function get_query_args(): array |
|
64 | - { |
|
65 | - $where_params = []; |
|
66 | - $query_args = []; |
|
67 | - |
|
68 | - $query_args['limit'] = $this->getLimit(); |
|
69 | - |
|
70 | - // Avoid multiple entries by join. |
|
71 | - $query_args['group_by'] = 'STA_ID'; |
|
72 | - |
|
73 | - $query_args['default_where_conditions'] = 'minimum'; |
|
74 | - |
|
75 | - /** |
|
76 | - * Collect the input_fields and sanitize them to prepare them for sending to the Query |
|
77 | - */ |
|
78 | - $input_fields = []; |
|
79 | - if (! empty($this->args['where'])) { |
|
80 | - $input_fields = $this->sanitizeInputFields($this->args['where']); |
|
81 | - |
|
82 | - // Since we do not have any falsy values in query params |
|
83 | - // Lets get rid of empty values |
|
84 | - $input_fields = array_filter($input_fields); |
|
85 | - |
|
86 | - // Use the proper operator. |
|
87 | - if (! empty($input_fields['STA_ID']) && is_array($input_fields['STA_ID'])) { |
|
88 | - $input_fields['STA_ID'] = ['IN', $input_fields['STA_ID']]; |
|
89 | - } |
|
90 | - if (! empty($input_fields['CNT_ISO']) && is_array($input_fields['CNT_ISO'])) { |
|
91 | - $input_fields['CNT_ISO'] = ['IN', $input_fields['CNT_ISO']]; |
|
92 | - } |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * Merge the input_fields with the default query_args |
|
97 | - */ |
|
98 | - if (! empty($input_fields)) { |
|
99 | - $where_params = array_merge($where_params, $input_fields); |
|
100 | - } |
|
101 | - |
|
102 | - // limit to active countries by default. |
|
103 | - if (!isset($this->args['where']['activeOnly']) || $this->args['where']['activeOnly']) { |
|
104 | - $where_params['STA_active'] = true; |
|
105 | - } |
|
106 | - |
|
107 | - [$query_args, $where_params] = $this->mapOrderbyInputArgs($query_args, $where_params, 'STA_ID'); |
|
108 | - |
|
109 | - if (empty($query_args['order_by'])) { |
|
110 | - // set order_by to 'name' by default |
|
111 | - $query_args['order_by'] = [ |
|
112 | - 'STA_name' => 'ASC', |
|
113 | - ]; |
|
114 | - } |
|
115 | - |
|
116 | - $search = $this->getSearchKeywords($this->args['where']); |
|
117 | - |
|
118 | - if (! empty($search)) { |
|
119 | - // use OR operator to search in any of the fields |
|
120 | - $where_params['OR'] = array( |
|
121 | - 'STA_name' => array('LIKE', '%' . $search . '%'), |
|
122 | - ); |
|
123 | - } |
|
124 | - |
|
125 | - $where_params = apply_filters( |
|
126 | - 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__state_where_params', |
|
127 | - $where_params, |
|
128 | - $this->source, |
|
129 | - $this->args |
|
130 | - ); |
|
131 | - |
|
132 | - $query_args[] = $where_params; |
|
133 | - |
|
134 | - /** |
|
135 | - * Return the $query_args |
|
136 | - */ |
|
137 | - return apply_filters( |
|
138 | - 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__state_query_args', |
|
139 | - $query_args, |
|
140 | - $this->source, |
|
141 | - $this->args |
|
142 | - ); |
|
143 | - } |
|
144 | - |
|
145 | - |
|
146 | - /** |
|
147 | - * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
148 | - * friendly keys. |
|
149 | - * |
|
150 | - * @param array $where_args |
|
151 | - * @return array |
|
152 | - */ |
|
153 | - public function sanitizeInputFields(array $where_args): array |
|
154 | - { |
|
155 | - $arg_mapping = [ |
|
156 | - 'in' => 'STA_ID', |
|
157 | - 'countryIsoIn' => 'CNT_ISO', |
|
158 | - ]; |
|
159 | - return $this->sanitizeWhereArgsForInputFields( |
|
160 | - $where_args, |
|
161 | - $arg_mapping, |
|
162 | - ['in'] |
|
163 | - ); |
|
164 | - } |
|
17 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
18 | + public function get_loader_name(): string |
|
19 | + { |
|
20 | + return 'espresso_state'; |
|
21 | + } |
|
22 | + |
|
23 | + /** |
|
24 | + * @return EEM_State |
|
25 | + * @throws EE_Error |
|
26 | + * @throws InvalidArgumentException |
|
27 | + * @throws InvalidDataTypeException |
|
28 | + * @throws InvalidInterfaceException |
|
29 | + * @throws ReflectionException |
|
30 | + */ |
|
31 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
32 | + public function get_query(): EEM_State |
|
33 | + { |
|
34 | + return EEM_State::instance(); |
|
35 | + } |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * Return an array of item IDs from the query |
|
40 | + * |
|
41 | + * @return array |
|
42 | + */ |
|
43 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
44 | + public function get_ids(): array |
|
45 | + { |
|
46 | + $results = $this->query->get_col($this->query_args); |
|
47 | + |
|
48 | + return ! empty($results) ? $results : []; |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * Here, we map the args from the input, then we make sure that we're only querying |
|
54 | + * for IDs. The IDs are then passed down the resolve tree, and deferred resolvers |
|
55 | + * handle batch resolution of the posts. |
|
56 | + * |
|
57 | + * @return array |
|
58 | + * @throws InvalidArgumentException |
|
59 | + * @throws InvalidDataTypeException |
|
60 | + * @throws InvalidInterfaceException |
|
61 | + */ |
|
62 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
63 | + public function get_query_args(): array |
|
64 | + { |
|
65 | + $where_params = []; |
|
66 | + $query_args = []; |
|
67 | + |
|
68 | + $query_args['limit'] = $this->getLimit(); |
|
69 | + |
|
70 | + // Avoid multiple entries by join. |
|
71 | + $query_args['group_by'] = 'STA_ID'; |
|
72 | + |
|
73 | + $query_args['default_where_conditions'] = 'minimum'; |
|
74 | + |
|
75 | + /** |
|
76 | + * Collect the input_fields and sanitize them to prepare them for sending to the Query |
|
77 | + */ |
|
78 | + $input_fields = []; |
|
79 | + if (! empty($this->args['where'])) { |
|
80 | + $input_fields = $this->sanitizeInputFields($this->args['where']); |
|
81 | + |
|
82 | + // Since we do not have any falsy values in query params |
|
83 | + // Lets get rid of empty values |
|
84 | + $input_fields = array_filter($input_fields); |
|
85 | + |
|
86 | + // Use the proper operator. |
|
87 | + if (! empty($input_fields['STA_ID']) && is_array($input_fields['STA_ID'])) { |
|
88 | + $input_fields['STA_ID'] = ['IN', $input_fields['STA_ID']]; |
|
89 | + } |
|
90 | + if (! empty($input_fields['CNT_ISO']) && is_array($input_fields['CNT_ISO'])) { |
|
91 | + $input_fields['CNT_ISO'] = ['IN', $input_fields['CNT_ISO']]; |
|
92 | + } |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * Merge the input_fields with the default query_args |
|
97 | + */ |
|
98 | + if (! empty($input_fields)) { |
|
99 | + $where_params = array_merge($where_params, $input_fields); |
|
100 | + } |
|
101 | + |
|
102 | + // limit to active countries by default. |
|
103 | + if (!isset($this->args['where']['activeOnly']) || $this->args['where']['activeOnly']) { |
|
104 | + $where_params['STA_active'] = true; |
|
105 | + } |
|
106 | + |
|
107 | + [$query_args, $where_params] = $this->mapOrderbyInputArgs($query_args, $where_params, 'STA_ID'); |
|
108 | + |
|
109 | + if (empty($query_args['order_by'])) { |
|
110 | + // set order_by to 'name' by default |
|
111 | + $query_args['order_by'] = [ |
|
112 | + 'STA_name' => 'ASC', |
|
113 | + ]; |
|
114 | + } |
|
115 | + |
|
116 | + $search = $this->getSearchKeywords($this->args['where']); |
|
117 | + |
|
118 | + if (! empty($search)) { |
|
119 | + // use OR operator to search in any of the fields |
|
120 | + $where_params['OR'] = array( |
|
121 | + 'STA_name' => array('LIKE', '%' . $search . '%'), |
|
122 | + ); |
|
123 | + } |
|
124 | + |
|
125 | + $where_params = apply_filters( |
|
126 | + 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__state_where_params', |
|
127 | + $where_params, |
|
128 | + $this->source, |
|
129 | + $this->args |
|
130 | + ); |
|
131 | + |
|
132 | + $query_args[] = $where_params; |
|
133 | + |
|
134 | + /** |
|
135 | + * Return the $query_args |
|
136 | + */ |
|
137 | + return apply_filters( |
|
138 | + 'FHEE__EventEspresso_core_domain_services_graphql_connection_resolvers__state_query_args', |
|
139 | + $query_args, |
|
140 | + $this->source, |
|
141 | + $this->args |
|
142 | + ); |
|
143 | + } |
|
144 | + |
|
145 | + |
|
146 | + /** |
|
147 | + * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
|
148 | + * friendly keys. |
|
149 | + * |
|
150 | + * @param array $where_args |
|
151 | + * @return array |
|
152 | + */ |
|
153 | + public function sanitizeInputFields(array $where_args): array |
|
154 | + { |
|
155 | + $arg_mapping = [ |
|
156 | + 'in' => 'STA_ID', |
|
157 | + 'countryIsoIn' => 'CNT_ISO', |
|
158 | + ]; |
|
159 | + return $this->sanitizeWhereArgsForInputFields( |
|
160 | + $where_args, |
|
161 | + $arg_mapping, |
|
162 | + ['in'] |
|
163 | + ); |
|
164 | + } |
|
165 | 165 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * Collect the input_fields and sanitize them to prepare them for sending to the Query |
77 | 77 | */ |
78 | 78 | $input_fields = []; |
79 | - if (! empty($this->args['where'])) { |
|
79 | + if ( ! empty($this->args['where'])) { |
|
80 | 80 | $input_fields = $this->sanitizeInputFields($this->args['where']); |
81 | 81 | |
82 | 82 | // Since we do not have any falsy values in query params |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | $input_fields = array_filter($input_fields); |
85 | 85 | |
86 | 86 | // Use the proper operator. |
87 | - if (! empty($input_fields['STA_ID']) && is_array($input_fields['STA_ID'])) { |
|
87 | + if ( ! empty($input_fields['STA_ID']) && is_array($input_fields['STA_ID'])) { |
|
88 | 88 | $input_fields['STA_ID'] = ['IN', $input_fields['STA_ID']]; |
89 | 89 | } |
90 | - if (! empty($input_fields['CNT_ISO']) && is_array($input_fields['CNT_ISO'])) { |
|
90 | + if ( ! empty($input_fields['CNT_ISO']) && is_array($input_fields['CNT_ISO'])) { |
|
91 | 91 | $input_fields['CNT_ISO'] = ['IN', $input_fields['CNT_ISO']]; |
92 | 92 | } |
93 | 93 | } |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | /** |
96 | 96 | * Merge the input_fields with the default query_args |
97 | 97 | */ |
98 | - if (! empty($input_fields)) { |
|
98 | + if ( ! empty($input_fields)) { |
|
99 | 99 | $where_params = array_merge($where_params, $input_fields); |
100 | 100 | } |
101 | 101 | |
102 | 102 | // limit to active countries by default. |
103 | - if (!isset($this->args['where']['activeOnly']) || $this->args['where']['activeOnly']) { |
|
103 | + if ( ! isset($this->args['where']['activeOnly']) || $this->args['where']['activeOnly']) { |
|
104 | 104 | $where_params['STA_active'] = true; |
105 | 105 | } |
106 | 106 | |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | |
116 | 116 | $search = $this->getSearchKeywords($this->args['where']); |
117 | 117 | |
118 | - if (! empty($search)) { |
|
118 | + if ( ! empty($search)) { |
|
119 | 119 | // use OR operator to search in any of the fields |
120 | 120 | $where_params['OR'] = array( |
121 | - 'STA_name' => array('LIKE', '%' . $search . '%'), |
|
121 | + 'STA_name' => array('LIKE', '%'.$search.'%'), |
|
122 | 122 | ); |
123 | 123 | } |
124 | 124 |