3636 *
3737 * This is the entry point for the library.
3838 */
39- final class Types
39+ final class Types implements TypesInterface
4040{
4141 /**
4242 * @var null|ContainerInterface
@@ -124,23 +124,11 @@ public function __construct(EntityManager $entityManager, ?ContainerInterface $c
124124 $ this ->initializeInternalTypes ();
125125 }
126126
127- /**
128- * Returns whether a type exists for the given key.
129- */
130127 public function has (string $ key ): bool
131128 {
132129 return $ this ->customTypes && $ this ->customTypes ->has ($ key ) || array_key_exists ($ key , $ this ->types );
133130 }
134131
135- /**
136- * Always return the same instance of `Type` for the given key.
137- *
138- * It will first look for the type in the custom types container, and then
139- * use automatically generated types. This allow for custom types to override
140- * automatic ones.
141- *
142- * @param string $key the key the type was registered with (eg: "Post", "PostInput", "PostPartialInput" or "PostStatus")
143- */
144132 public function get (string $ key ): Type
145133 {
146134 if ($ this ->customTypes && $ this ->customTypes ->has ($ key )) {
@@ -173,14 +161,6 @@ private function getViaFactory(string $className, string $typeName, AbstractType
173161 return $ this ->types [$ typeName ];
174162 }
175163
176- /**
177- * Returns an output type for the given entity.
178- *
179- * All entity getter methods will be exposed, unless specified otherwise
180- * with annotations.
181- *
182- * @param string $className the class name of an entity (`Post::class`)
183- */
184164 public function getOutput (string $ className ): ObjectType
185165 {
186166 /** @var ObjectType $type */
@@ -189,16 +169,6 @@ public function getOutput(string $className): ObjectType
189169 return $ type ;
190170 }
191171
192- /**
193- * Returns an input type for the given entity.
194- *
195- * This would typically be used in mutations to create new entities.
196- *
197- * All entity setter methods will be exposed, unless specified otherwise
198- * with annotations.
199- *
200- * @param string $className the class name of an entity (`Post::class`)
201- */
202172 public function getInput (string $ className ): InputObjectType
203173 {
204174 /** @var InputObjectType $type */
@@ -207,18 +177,6 @@ public function getInput(string $className): InputObjectType
207177 return $ type ;
208178 }
209179
210- /**
211- * Returns a partial input type for the given entity.
212- *
213- * This would typically be used in mutations to update existing entities.
214- *
215- * All entity setter methods will be exposed, unless specified otherwise
216- * with annotations. But they will all be marked as optional and without
217- * default values. So this allow the API client to specify only some fields
218- * to be updated, and not necessarily all of them at once.
219- *
220- * @param string $className the class name of an entity (`Post::class`)
221- */
222180 public function getPartialInput (string $ className ): InputObjectType
223181 {
224182 /** @var InputObjectType $type */
@@ -227,13 +185,6 @@ public function getPartialInput(string $className): InputObjectType
227185 return $ type ;
228186 }
229187
230- /**
231- * Returns a filter input type for the given entity.
232- *
233- * This would typically be used to filter queries.
234- *
235- * @param string $className the class name of an entity (`Post::class`)
236- */
237188 public function getFilter (string $ className ): InputObjectType
238189 {
239190 /** @var InputObjectType $type */
@@ -242,13 +193,6 @@ public function getFilter(string $className): InputObjectType
242193 return $ type ;
243194 }
244195
245- /**
246- * Returns a sorting input type for the given entity.
247- *
248- * This would typically be used to sort queries.
249- *
250- * @param string $className the class name of an entity (`Post::class`)
251- */
252196 public function getSorting (string $ className ): ListOfType
253197 {
254198 /** @var InputObjectType $type */
@@ -302,17 +246,6 @@ public function getFilterGroupCondition(string $className): InputObjectType
302246 return $ type ;
303247 }
304248
305- /**
306- * Returns an special ID type for the given entity.
307- *
308- * This is mostly useful for internal usage when a getter has an entity
309- * as parameter. This type will automatically load the entity from DB, so
310- * the resolve functions can use a real instance of entity instead of an ID.
311- * But this can also be used to build your own schema and thus avoid
312- * manually fetching objects from database for simple cases.
313- *
314- * @param string $className the class name of an entity (`Post::class`)
315- */
316249 public function getId (string $ className ): EntityIDType
317250 {
318251 /** @var EntityIDType $type */
@@ -400,17 +333,6 @@ private function throwIfNotEntity(string $className): void
400333 }
401334 }
402335
403- /**
404- * Create and return a query builder that is filtered and sorted for the given entity.
405- *
406- * Typical usage would be to call this method in your query resolver with the filter and sorting arguments directly
407- * coming from GraphQL.
408- *
409- * You may apply further pagination according to your needs before executing the query.
410- *
411- * Filter and sorting arguments are assumed to be valid and complete as the validation should have happened when
412- * parsing the GraphQL query.
413- */
414336 public function createFilteredQueryBuilder (string $ className , array $ filter , array $ sorting ): QueryBuilder
415337 {
416338 return $ this ->filteredQueryBuilderFactory ->create ($ className , $ filter , $ sorting );
0 commit comments