libSmalldb  v2.0.2
Public Member Functions | Static Public Member Functions | List of all members
Smalldb Class Reference

Description

The libSmalldb entry point.

Smalldb class manages machine providers and uses them to provide a simple lazy way to obtain repositories and references.

Public Member Functions

 __construct ()
 Smalldb constructor. More...
 
 registerGeneratedClassAutoloader (string $namespace, string $directory, bool $prependAutoloader=false)
 Helper method to register autoloader for generated classes when setting up a DI container. More...
 
 registerMachineType (SmalldbProviderInterface $provider, array $aliases=[])
 Register machine type and its provider. More...
 
 getMachineProvider (string $machineType)
 Retrieve a machine provider for the given machine type or reference class. More...
 
 getReferenceClass (string $type)
 
 getDefinition (string $type)
 
 getTransitionsDecorator (string $type)
 
 getRepository (string $type)
 
 ref (string $type, $id)
 Get reference to state machine instance of given type and id. More...
 
 nullRef (string $type)
 Get reference to non-existent state machine instance of given type. More...
 
 getMachineTypes ()
 Generate list of all machines. More...
 
 setDebugLogger (?DebugLoggerInterface $debugLogger)
 
 getDebugLogger ()
 

Static Public Member Functions

static createWithGeneratedClassAutoloader (string $namespace, string $directory, bool $prependAutoloader=false)
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Smalldb constructor.

Member Function Documentation

◆ createWithGeneratedClassAutoloader()

static createWithGeneratedClassAutoloader ( string  $namespace,
string  $directory,
bool  $prependAutoloader = false 
)
static

◆ registerGeneratedClassAutoloader()

registerGeneratedClassAutoloader ( string  $namespace,
string  $directory,
bool  $prependAutoloader = false 
)

Helper method to register autoloader for generated classes when setting up a DI container.

◆ registerMachineType()

registerMachineType ( SmalldbProviderInterface  $provider,
array  $aliases = [] 
)

Register machine type and its provider.

Parameters
SmalldbProviderInterface$provider
string[]$aliases

◆ getMachineProvider()

getMachineProvider ( string  $machineType)

Retrieve a machine provider for the given machine type or reference class.

◆ getReferenceClass()

getReferenceClass ( string  $type)

◆ getDefinition()

getDefinition ( string  $type)

◆ getTransitionsDecorator()

getTransitionsDecorator ( string  $type)

◆ getRepository()

getRepository ( string  $type)

◆ ref()

ref ( string  $type,
  $id 
)

Get reference to state machine instance of given type and id.

See also
nullRef()

◆ nullRef()

nullRef ( string  $type)

Get reference to non-existent state machine instance of given type.

You may want to invoke 'create' or similar transition using this reference.

See also
ref()

◆ getMachineTypes()

getMachineTypes ( )

Generate list of all machines.

Returns
string[]

◆ setDebugLogger()

setDebugLogger ( ?DebugLoggerInterface  $debugLogger)

◆ getDebugLogger()

getDebugLogger ( )