@@ -15,99 +15,99 @@ |
||
15 | 15 | interface GraphQLFieldInterface |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @return array |
|
20 | - */ |
|
21 | - public function caps(); |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function description(); |
|
28 | - |
|
29 | - |
|
30 | - /** |
|
31 | - * @return string |
|
32 | - */ |
|
33 | - public function key(); |
|
34 | - |
|
35 | - |
|
36 | - /** |
|
37 | - * @return string |
|
38 | - */ |
|
39 | - public function name(); |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * @return string|string[] |
|
44 | - */ |
|
45 | - public function type(); |
|
46 | - |
|
47 | - |
|
48 | - /** |
|
49 | - * Convert the field to array to be |
|
50 | - * able to pass as config to WP GraphQL |
|
51 | - * |
|
52 | - * @return array |
|
53 | - */ |
|
54 | - public function toArray(); |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * Whether the field should be used for |
|
59 | - * mutation inputs. |
|
60 | - * |
|
61 | - * @return bool |
|
62 | - */ |
|
63 | - public function useForInput(); |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * Whether the field should be used for |
|
68 | - * query outputs. |
|
69 | - * |
|
70 | - * @return bool |
|
71 | - */ |
|
72 | - public function useForOutput(); |
|
73 | - |
|
74 | - |
|
75 | - /** |
|
76 | - * Whether the field should resolve |
|
77 | - * based on the user caps etc. |
|
78 | - * |
|
79 | - * @return boolean |
|
80 | - */ |
|
81 | - public function shouldResolve(); |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * Whether the field has an explicit resolver set. |
|
86 | - * |
|
87 | - * @return boolean |
|
88 | - */ |
|
89 | - public function hasInternalResolver(); |
|
90 | - |
|
91 | - |
|
92 | - /** |
|
93 | - * Whether the field has an explicit resolver set. |
|
94 | - * |
|
95 | - * @param mixed $source The source that's passed down the GraphQL queries |
|
96 | - * @param array $args The inputArgs on the field |
|
97 | - * @param AppContext $context The AppContext passed down the GraphQL tree |
|
98 | - * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
99 | - * @return mixed |
|
100 | - * @throws LogicException |
|
101 | - */ |
|
102 | - public function resolve($source, array $args, AppContext $context, ResolveInfo $info); |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * Checks if the format callback is set. |
|
107 | - * If yes, then uses it to format the value. |
|
108 | - * |
|
109 | - * @param mixed $value |
|
110 | - * @return mixed The formatted value. |
|
111 | - */ |
|
112 | - public function mayBeFormatValue($value); |
|
18 | + /** |
|
19 | + * @return array |
|
20 | + */ |
|
21 | + public function caps(); |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function description(); |
|
28 | + |
|
29 | + |
|
30 | + /** |
|
31 | + * @return string |
|
32 | + */ |
|
33 | + public function key(); |
|
34 | + |
|
35 | + |
|
36 | + /** |
|
37 | + * @return string |
|
38 | + */ |
|
39 | + public function name(); |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * @return string|string[] |
|
44 | + */ |
|
45 | + public function type(); |
|
46 | + |
|
47 | + |
|
48 | + /** |
|
49 | + * Convert the field to array to be |
|
50 | + * able to pass as config to WP GraphQL |
|
51 | + * |
|
52 | + * @return array |
|
53 | + */ |
|
54 | + public function toArray(); |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * Whether the field should be used for |
|
59 | + * mutation inputs. |
|
60 | + * |
|
61 | + * @return bool |
|
62 | + */ |
|
63 | + public function useForInput(); |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * Whether the field should be used for |
|
68 | + * query outputs. |
|
69 | + * |
|
70 | + * @return bool |
|
71 | + */ |
|
72 | + public function useForOutput(); |
|
73 | + |
|
74 | + |
|
75 | + /** |
|
76 | + * Whether the field should resolve |
|
77 | + * based on the user caps etc. |
|
78 | + * |
|
79 | + * @return boolean |
|
80 | + */ |
|
81 | + public function shouldResolve(); |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * Whether the field has an explicit resolver set. |
|
86 | + * |
|
87 | + * @return boolean |
|
88 | + */ |
|
89 | + public function hasInternalResolver(); |
|
90 | + |
|
91 | + |
|
92 | + /** |
|
93 | + * Whether the field has an explicit resolver set. |
|
94 | + * |
|
95 | + * @param mixed $source The source that's passed down the GraphQL queries |
|
96 | + * @param array $args The inputArgs on the field |
|
97 | + * @param AppContext $context The AppContext passed down the GraphQL tree |
|
98 | + * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
99 | + * @return mixed |
|
100 | + * @throws LogicException |
|
101 | + */ |
|
102 | + public function resolve($source, array $args, AppContext $context, ResolveInfo $info); |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * Checks if the format callback is set. |
|
107 | + * If yes, then uses it to format the value. |
|
108 | + * |
|
109 | + * @param mixed $value |
|
110 | + * @return mixed The formatted value. |
|
111 | + */ |
|
112 | + public function mayBeFormatValue($value); |
|
113 | 113 | } |
@@ -16,39 +16,39 @@ |
||
16 | 16 | class GraphQLManager |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var TypesManager $types_manager |
|
21 | - */ |
|
22 | - protected $types_manager; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var ConnectionsManager $connections_manager |
|
26 | - */ |
|
27 | - protected $connections_manager; |
|
28 | - |
|
29 | - |
|
30 | - /** |
|
31 | - * GraphQLManager constructor. |
|
32 | - * |
|
33 | - * @param TypesManager $types_manager |
|
34 | - * @param ConnectionsManager $connections_manager |
|
35 | - */ |
|
36 | - public function __construct(TypesManager $types_manager, ConnectionsManager $connections_manager) |
|
37 | - { |
|
38 | - $this->types_manager = $types_manager; |
|
39 | - $this->connections_manager = $connections_manager; |
|
40 | - } |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @throws CollectionDetailsException |
|
45 | - * @throws CollectionLoaderException |
|
46 | - * @since $VID:$ |
|
47 | - */ |
|
48 | - public function init() |
|
49 | - { |
|
50 | - $this->types_manager->init(); |
|
51 | - $this->connections_manager->init(); |
|
52 | - } |
|
19 | + /** |
|
20 | + * @var TypesManager $types_manager |
|
21 | + */ |
|
22 | + protected $types_manager; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var ConnectionsManager $connections_manager |
|
26 | + */ |
|
27 | + protected $connections_manager; |
|
28 | + |
|
29 | + |
|
30 | + /** |
|
31 | + * GraphQLManager constructor. |
|
32 | + * |
|
33 | + * @param TypesManager $types_manager |
|
34 | + * @param ConnectionsManager $connections_manager |
|
35 | + */ |
|
36 | + public function __construct(TypesManager $types_manager, ConnectionsManager $connections_manager) |
|
37 | + { |
|
38 | + $this->types_manager = $types_manager; |
|
39 | + $this->connections_manager = $connections_manager; |
|
40 | + } |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @throws CollectionDetailsException |
|
45 | + * @throws CollectionLoaderException |
|
46 | + * @since $VID:$ |
|
47 | + */ |
|
48 | + public function init() |
|
49 | + { |
|
50 | + $this->types_manager->init(); |
|
51 | + $this->connections_manager->init(); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | \ No newline at end of file |
@@ -16,13 +16,13 @@ |
||
16 | 16 | interface ResolverInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @param $source |
|
21 | - * @param array $args |
|
22 | - * @param AppContext $context |
|
23 | - * @param ResolveInfo $info |
|
24 | - * @return mixed |
|
25 | - * @since $VID:$ |
|
26 | - */ |
|
27 | - public function resolve($source, array $args, AppContext $context, ResolveInfo $info); |
|
19 | + /** |
|
20 | + * @param $source |
|
21 | + * @param array $args |
|
22 | + * @param AppContext $context |
|
23 | + * @param ResolveInfo $info |
|
24 | + * @return mixed |
|
25 | + * @since $VID:$ |
|
26 | + */ |
|
27 | + public function resolve($source, array $args, AppContext $context, ResolveInfo $info); |
|
28 | 28 | } |
29 | 29 | \ No newline at end of file |
@@ -21,86 +21,86 @@ |
||
21 | 21 | class ResolverCollection extends Collection |
22 | 22 | { |
23 | 23 | |
24 | - const COLLECTION_NAME = 'espresso_graphql_resolvers'; |
|
24 | + const COLLECTION_NAME = 'espresso_graphql_resolvers'; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var CollectionLoader $loader |
|
28 | - */ |
|
29 | - protected $loader; |
|
26 | + /** |
|
27 | + * @var CollectionLoader $loader |
|
28 | + */ |
|
29 | + protected $loader; |
|
30 | 30 | |
31 | - /** |
|
32 | - * ResolverCollection constructor |
|
33 | - * |
|
34 | - * @throws InvalidInterfaceException |
|
35 | - */ |
|
36 | - public function __construct() |
|
37 | - { |
|
38 | - parent::__construct( |
|
39 | - 'EventEspresso\core\services\graphql\ResolverInterface', |
|
40 | - ResolverCollection::COLLECTION_NAME |
|
41 | - ); |
|
42 | - } |
|
31 | + /** |
|
32 | + * ResolverCollection constructor |
|
33 | + * |
|
34 | + * @throws InvalidInterfaceException |
|
35 | + */ |
|
36 | + public function __construct() |
|
37 | + { |
|
38 | + parent::__construct( |
|
39 | + 'EventEspresso\core\services\graphql\ResolverInterface', |
|
40 | + ResolverCollection::COLLECTION_NAME |
|
41 | + ); |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @throws CollectionDetailsException |
|
47 | - * @throws CollectionLoaderException |
|
48 | - * @since $VID:$ |
|
49 | - */ |
|
50 | - private function loadCollection() |
|
51 | - { |
|
52 | - if (! $this->loader instanceof CollectionLoader) { |
|
53 | - $this->loader = new CollectionLoader( |
|
54 | - new CollectionDetails( |
|
55 | - // collection name |
|
56 | - ResolverCollection::COLLECTION_NAME, |
|
57 | - // collection interface |
|
58 | - 'EventEspresso\core\services\graphql\ResolverInterface', |
|
59 | - // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
60 | - apply_filters( |
|
61 | - 'FHEE__EventEspresso_core_services_graphql_ResolverCollection__loadCollection__collection_FQCNs', |
|
62 | - ['EventEspresso\core\domain\services\graphql\resolvers'] |
|
63 | - ), |
|
64 | - // filepaths to classes to add |
|
65 | - array(), |
|
66 | - // file mask to use if parsing folder for files to add |
|
67 | - '', |
|
68 | - // what to use as identifier for collection entities |
|
69 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
70 | - CollectionDetails::ID_CLASS_NAME |
|
71 | - ), |
|
72 | - $this |
|
73 | - ); |
|
74 | - } |
|
75 | - } |
|
45 | + /** |
|
46 | + * @throws CollectionDetailsException |
|
47 | + * @throws CollectionLoaderException |
|
48 | + * @since $VID:$ |
|
49 | + */ |
|
50 | + private function loadCollection() |
|
51 | + { |
|
52 | + if (! $this->loader instanceof CollectionLoader) { |
|
53 | + $this->loader = new CollectionLoader( |
|
54 | + new CollectionDetails( |
|
55 | + // collection name |
|
56 | + ResolverCollection::COLLECTION_NAME, |
|
57 | + // collection interface |
|
58 | + 'EventEspresso\core\services\graphql\ResolverInterface', |
|
59 | + // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
60 | + apply_filters( |
|
61 | + 'FHEE__EventEspresso_core_services_graphql_ResolverCollection__loadCollection__collection_FQCNs', |
|
62 | + ['EventEspresso\core\domain\services\graphql\resolvers'] |
|
63 | + ), |
|
64 | + // filepaths to classes to add |
|
65 | + array(), |
|
66 | + // file mask to use if parsing folder for files to add |
|
67 | + '', |
|
68 | + // what to use as identifier for collection entities |
|
69 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
70 | + CollectionDetails::ID_CLASS_NAME |
|
71 | + ), |
|
72 | + $this |
|
73 | + ); |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * @return CollectionInterface |
|
80 | - * @throws CollectionDetailsException |
|
81 | - * @throws CollectionLoaderException |
|
82 | - * @since $VID:$ |
|
83 | - */ |
|
84 | - public function loadResolvers() |
|
85 | - { |
|
86 | - $this->loadCollection(); |
|
87 | - return $this->loader->getCollection(); |
|
88 | - } |
|
78 | + /** |
|
79 | + * @return CollectionInterface |
|
80 | + * @throws CollectionDetailsException |
|
81 | + * @throws CollectionLoaderException |
|
82 | + * @since $VID:$ |
|
83 | + */ |
|
84 | + public function loadResolvers() |
|
85 | + { |
|
86 | + $this->loadCollection(); |
|
87 | + return $this->loader->getCollection(); |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | - /** |
|
92 | - * getIdentifier |
|
93 | - * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
94 | - * If no $identifier is supplied, then the fully qualified class name is used |
|
95 | - * |
|
96 | - * @param $object |
|
97 | - * @param mixed $identifier |
|
98 | - * @return bool |
|
99 | - */ |
|
100 | - public function getIdentifier($object, $identifier = null) |
|
101 | - { |
|
102 | - return ! empty($identifier) |
|
103 | - ? $identifier |
|
104 | - : get_class($object); |
|
105 | - } |
|
91 | + /** |
|
92 | + * getIdentifier |
|
93 | + * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
94 | + * If no $identifier is supplied, then the fully qualified class name is used |
|
95 | + * |
|
96 | + * @param $object |
|
97 | + * @param mixed $identifier |
|
98 | + * @return bool |
|
99 | + */ |
|
100 | + public function getIdentifier($object, $identifier = null) |
|
101 | + { |
|
102 | + return ! empty($identifier) |
|
103 | + ? $identifier |
|
104 | + : get_class($object); |
|
105 | + } |
|
106 | 106 | } |
107 | 107 | \ No newline at end of file |
@@ -49,7 +49,7 @@ |
||
49 | 49 | */ |
50 | 50 | private function loadCollection() |
51 | 51 | { |
52 | - if (! $this->loader instanceof CollectionLoader) { |
|
52 | + if ( ! $this->loader instanceof CollectionLoader) { |
|
53 | 53 | $this->loader = new CollectionLoader( |
54 | 54 | new CollectionDetails( |
55 | 55 | // collection name |
@@ -33,29 +33,29 @@ |
||
33 | 33 | interface ConnectionInterface |
34 | 34 | { |
35 | 35 | |
36 | - /** |
|
37 | - * @return array |
|
38 | - * @since $VID:$ |
|
39 | - */ |
|
40 | - public function config(); |
|
36 | + /** |
|
37 | + * @return array |
|
38 | + * @since $VID:$ |
|
39 | + */ |
|
40 | + public function config(); |
|
41 | 41 | |
42 | - /** |
|
43 | - * @param $entity |
|
44 | - * @param $args |
|
45 | - * @param $context |
|
46 | - * @param $info |
|
47 | - * @return array |
|
48 | - * @since $VID:$ |
|
49 | - */ |
|
50 | - public function resolveConnection($entity, $args, $context, $info); |
|
42 | + /** |
|
43 | + * @param $entity |
|
44 | + * @param $args |
|
45 | + * @param $context |
|
46 | + * @param $info |
|
47 | + * @return array |
|
48 | + * @since $VID:$ |
|
49 | + */ |
|
50 | + public function resolveConnection($entity, $args, $context, $info); |
|
51 | 51 | |
52 | - /** |
|
53 | - * @param $id |
|
54 | - * @param $args |
|
55 | - * @param $context |
|
56 | - * @param $info |
|
57 | - * @return EE_Base_Class |
|
58 | - * @since $VID:$ |
|
59 | - */ |
|
60 | - public function resolveNode($id, $args, $context, $info); |
|
52 | + /** |
|
53 | + * @param $id |
|
54 | + * @param $args |
|
55 | + * @param $context |
|
56 | + * @param $info |
|
57 | + * @return EE_Base_Class |
|
58 | + * @since $VID:$ |
|
59 | + */ |
|
60 | + public function resolveNode($id, $args, $context, $info); |
|
61 | 61 | } |
62 | 62 | \ No newline at end of file |
@@ -21,86 +21,86 @@ |
||
21 | 21 | class ConnectionCollection extends Collection |
22 | 22 | { |
23 | 23 | |
24 | - const COLLECTION_NAME = 'espresso_graphql_connections'; |
|
24 | + const COLLECTION_NAME = 'espresso_graphql_connections'; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var CollectionLoader $loader |
|
28 | - */ |
|
29 | - protected $loader; |
|
26 | + /** |
|
27 | + * @var CollectionLoader $loader |
|
28 | + */ |
|
29 | + protected $loader; |
|
30 | 30 | |
31 | - /** |
|
32 | - * ConnectionCollection constructor |
|
33 | - * |
|
34 | - * @throws InvalidInterfaceException |
|
35 | - */ |
|
36 | - public function __construct() |
|
37 | - { |
|
38 | - parent::__construct( |
|
39 | - 'EventEspresso\core\services\graphql\connections\ConnectionInterface', |
|
40 | - ConnectionCollection::COLLECTION_NAME |
|
41 | - ); |
|
42 | - } |
|
31 | + /** |
|
32 | + * ConnectionCollection constructor |
|
33 | + * |
|
34 | + * @throws InvalidInterfaceException |
|
35 | + */ |
|
36 | + public function __construct() |
|
37 | + { |
|
38 | + parent::__construct( |
|
39 | + 'EventEspresso\core\services\graphql\connections\ConnectionInterface', |
|
40 | + ConnectionCollection::COLLECTION_NAME |
|
41 | + ); |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @throws CollectionDetailsException |
|
47 | - * @throws CollectionLoaderException |
|
48 | - * @since $VID:$ |
|
49 | - */ |
|
50 | - private function loadCollection() |
|
51 | - { |
|
52 | - if (! $this->loader instanceof CollectionLoader) { |
|
53 | - $this->loader = new CollectionLoader( |
|
54 | - new CollectionDetails( |
|
55 | - // collection name |
|
56 | - ConnectionCollection::COLLECTION_NAME, |
|
57 | - // collection interface |
|
58 | - 'EventEspresso\core\services\graphql\connections\ConnectionInterface', |
|
59 | - // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
60 | - apply_filters( |
|
61 | - 'FHEE__EventEspresso_core_services_graphql_ConnectionCollection__loadCollection__collection_FQCNs', |
|
62 | - ['EventEspresso\core\domain\services\graphql\connections'] |
|
63 | - ), |
|
64 | - // filepaths to classes to add |
|
65 | - array(), |
|
66 | - // file mask to use if parsing folder for files to add |
|
67 | - '', |
|
68 | - // what to use as identifier for collection entities |
|
69 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
70 | - CollectionDetails::ID_CLASS_NAME |
|
71 | - ), |
|
72 | - $this |
|
73 | - ); |
|
74 | - } |
|
75 | - } |
|
45 | + /** |
|
46 | + * @throws CollectionDetailsException |
|
47 | + * @throws CollectionLoaderException |
|
48 | + * @since $VID:$ |
|
49 | + */ |
|
50 | + private function loadCollection() |
|
51 | + { |
|
52 | + if (! $this->loader instanceof CollectionLoader) { |
|
53 | + $this->loader = new CollectionLoader( |
|
54 | + new CollectionDetails( |
|
55 | + // collection name |
|
56 | + ConnectionCollection::COLLECTION_NAME, |
|
57 | + // collection interface |
|
58 | + 'EventEspresso\core\services\graphql\connections\ConnectionInterface', |
|
59 | + // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
60 | + apply_filters( |
|
61 | + 'FHEE__EventEspresso_core_services_graphql_ConnectionCollection__loadCollection__collection_FQCNs', |
|
62 | + ['EventEspresso\core\domain\services\graphql\connections'] |
|
63 | + ), |
|
64 | + // filepaths to classes to add |
|
65 | + array(), |
|
66 | + // file mask to use if parsing folder for files to add |
|
67 | + '', |
|
68 | + // what to use as identifier for collection entities |
|
69 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
70 | + CollectionDetails::ID_CLASS_NAME |
|
71 | + ), |
|
72 | + $this |
|
73 | + ); |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * @return CollectionInterface |
|
80 | - * @throws CollectionDetailsException |
|
81 | - * @throws CollectionLoaderException |
|
82 | - * @since $VID:$ |
|
83 | - */ |
|
84 | - public function loadConnections() |
|
85 | - { |
|
86 | - $this->loadCollection(); |
|
87 | - return $this->loader->getCollection(); |
|
88 | - } |
|
78 | + /** |
|
79 | + * @return CollectionInterface |
|
80 | + * @throws CollectionDetailsException |
|
81 | + * @throws CollectionLoaderException |
|
82 | + * @since $VID:$ |
|
83 | + */ |
|
84 | + public function loadConnections() |
|
85 | + { |
|
86 | + $this->loadCollection(); |
|
87 | + return $this->loader->getCollection(); |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | - /** |
|
92 | - * getIdentifier |
|
93 | - * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
94 | - * If no $identifier is supplied, then the fully qualified class name is used |
|
95 | - * |
|
96 | - * @param $object |
|
97 | - * @param mixed $identifier |
|
98 | - * @return bool |
|
99 | - */ |
|
100 | - public function getIdentifier($object, $identifier = null) |
|
101 | - { |
|
102 | - return ! empty($identifier) |
|
103 | - ? $identifier |
|
104 | - : get_class($object); |
|
105 | - } |
|
91 | + /** |
|
92 | + * getIdentifier |
|
93 | + * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
94 | + * If no $identifier is supplied, then the fully qualified class name is used |
|
95 | + * |
|
96 | + * @param $object |
|
97 | + * @param mixed $identifier |
|
98 | + * @return bool |
|
99 | + */ |
|
100 | + public function getIdentifier($object, $identifier = null) |
|
101 | + { |
|
102 | + return ! empty($identifier) |
|
103 | + ? $identifier |
|
104 | + : get_class($object); |
|
105 | + } |
|
106 | 106 | } |
107 | 107 | \ No newline at end of file |
@@ -49,7 +49,7 @@ |
||
49 | 49 | */ |
50 | 50 | private function loadCollection() |
51 | 51 | { |
52 | - if (! $this->loader instanceof CollectionLoader) { |
|
52 | + if ( ! $this->loader instanceof CollectionLoader) { |
|
53 | 53 | $this->loader = new CollectionLoader( |
54 | 54 | new CollectionDetails( |
55 | 55 | // collection name |
@@ -1,8 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\domain\services\graphql\data\mutations; |
3 | 3 | |
4 | -use GraphQL\Error\UserError; |
|
5 | - |
|
6 | 4 | /** |
7 | 5 | * Class EventMutation |
8 | 6 | * |
@@ -25,16 +25,16 @@ |
||
25 | 25 | |
26 | 26 | $args = []; |
27 | 27 | |
28 | - if ( ! empty( $input['name'] ) ) { |
|
29 | - $args['EVT_name'] = sanitize_text_field( $input['name'] ); |
|
28 | + if ( ! empty($input['name'])) { |
|
29 | + $args['EVT_name'] = sanitize_text_field($input['name']); |
|
30 | 30 | } |
31 | 31 | |
32 | - if ( ! empty( $input['desc'] ) ) { |
|
33 | - $args['EVT_desc'] = sanitize_text_field( $input['desc'] ); |
|
32 | + if ( ! empty($input['desc'])) { |
|
33 | + $args['EVT_desc'] = sanitize_text_field($input['desc']); |
|
34 | 34 | } |
35 | 35 | |
36 | - if ( ! empty( $input['shortDesc'] ) ) { |
|
37 | - $args['EVT_short_desc'] = sanitize_text_field( $input['shortDesc'] ); |
|
36 | + if ( ! empty($input['shortDesc'])) { |
|
37 | + $args['EVT_short_desc'] = sanitize_text_field($input['shortDesc']); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | // Likewise the other fields... |
@@ -14,7 +14,7 @@ |
||
14 | 14 | * |
15 | 15 | * @param EEM_Datetime $model |
16 | 16 | * @param Datetime $type |
17 | - * @return callable |
|
17 | + * @return \Closure |
|
18 | 18 | */ |
19 | 19 | public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type) |
20 | 20 | { |
@@ -12,8 +12,8 @@ |
||
12 | 12 | /** |
13 | 13 | * Defines the mutation data modification closure. |
14 | 14 | * |
15 | - * @param EEM_Datetime $model |
|
16 | - * @param Datetime $type |
|
15 | + * @param EEM_Datetime $model |
|
16 | + * @param Datetime $type |
|
17 | 17 | * @return callable |
18 | 18 | */ |
19 | 19 | public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $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_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 [ |
@@ -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; |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * |
18 | 18 | * @param EEM_Event $model |
19 | 19 | * @param Event $type |
20 | - * @return callable |
|
20 | + * @return \Closure |
|
21 | 21 | */ |
22 | 22 | public static function mutateFields(EEM_Event $model, Event $type) |
23 | 23 | { |
@@ -8,7 +8,6 @@ |
||
8 | 8 | use EventEspresso\core\domain\services\graphql\data\mutations\EventMutation; |
9 | 9 | use GraphQL\Type\Definition\ResolveInfo; |
10 | 10 | use WPGraphQL\AppContext; |
11 | -use GraphQL\Error\UserError; |
|
12 | 11 | |
13 | 12 | class EventUpdate { |
14 | 13 |
@@ -15,8 +15,8 @@ |
||
15 | 15 | /** |
16 | 16 | * Defines the mutation data modification closure. |
17 | 17 | * |
18 | - * @param EEM_Event $model |
|
19 | - * @param Event $type |
|
18 | + * @param EEM_Event $model |
|
19 | + * @param Event $type |
|
20 | 20 | * @return callable |
21 | 21 | */ |
22 | 22 | public static function mutateFields(EEM_Event $model, Event $type) |
@@ -31,7 +31,7 @@ |
||
31 | 31 | * @param AppContext $context The AppContext passed down to all resolvers |
32 | 32 | * @param ResolveInfo $info The ResolveInfo passed down to all resolvers |
33 | 33 | */ |
34 | - return static function ( |
|
34 | + return static function( |
|
35 | 35 | $id, |
36 | 36 | array $input, |
37 | 37 | WP_Post_Type $post_type_object, |