Class Loader
Class Loader
This class sets up general patterns for loading data in an optimized way. Used in conjunction with GraphQL Deferred
resolvers
Methods summary
public static
|
#
addOne( string $type, integer $id )
Add an item to the buffer
Add an item to the buffer
Parameters
- $type
- The type of object to add
- $id
- The ID of the item to be loaded
|
public static
|
#
addMany( string $type, array $ids )
Add many items to the buffer
Add many items to the buffer
Parameters
- $type
- The type of objects to add
- $ids
- Array of IDs to be added to the buffer
|
public static
mixed
|
#
loadOne( string $type, integer $id )
Load an individual item from the loaded items
Load an individual item from the loaded items
Parameters
- $type
- The type of object to load
- $id
- The ID of the item to load
Returns
mixed
|
public static
|
#
loadMany( string $type, array $ids )
Load many items from the already loaded items
Load many items from the already loaded items
Parameters
- $type
- The type of objects to load
- $ids
- Array of items to load
|
public static
array
|
#
loadBuffered( string $type )
Should be implemented by extending loader
Should be implemented by extending loader
Parameters
- $type
- The type of objects to load
Returns
array
|
protected static
mixed
|
#
load_users( )
Loads users from the buffer
Loads users from the buffer
Returns
mixed
|
protected static
|
#
reset_buffer( string $type )
Resets the buffer for a given type
Resets the buffer for a given type
Parameters
- $type
- The buffer type to reset
|
Properties summary
protected static
array
|
$buffer
Holds the queue of items to be loaded
Holds the queue of items to be loaded
|
|
protected static
array
|
$loaded
Holds the collection of items that have already been loaded
Holds the collection of items that have already been loaded
|
|