Class TypeFactory
Factory for building database type classes.
Property Summary
- 
        $_builtTypes protected staticarray<Cake\Database\TypeInterface>Contains a map of type object instances to be reused if needed. 
- 
        $_types protected staticarray<string, string>List of supported database types. A human readable identifier is used as key and a complete namespaced class name as value representing the class that will do actual type conversions. 
Method Summary
- 
          build() public staticReturns a Type object capable of converting a type identified by name. 
- 
          buildAll() public staticReturns an arrays with all the mapped type objects, indexed by name. 
- 
          clear() public staticClears out all created instances and mapped types classes, useful for testing 
- 
          getMap() public staticGet mapped class name for given type or map array. 
- 
          map() public staticRegisters a new type identifier and maps it to a fully namespaced classname. 
- 
          set() public staticSet TypeInterface instance capable of converting a type identified by $name 
- 
          setMap() public staticSet type to classname mapping. 
Method Detail
build() ¶ public static
build(string $name): Cake\Database\TypeInterfaceReturns a Type object capable of converting a type identified by name.
Parameters
- 
                string$name
- type identifier 
Returns
Cake\Database\TypeInterfaceThrows
InvalidArgumentExceptionIf type identifier is unknown
buildAll() ¶ public static
buildAll(): array<Cake\Database\TypeInterface>Returns an arrays with all the mapped type objects, indexed by name.
Returns
array<Cake\Database\TypeInterface>clear() ¶ public static
clear(): voidClears out all created instances and mapped types classes, useful for testing
Returns
voidgetMap() ¶ public static
getMap(string|null $type = null): array<string, class-string<Cake\Database\TypeInterface>>|string|nullGet mapped class name for given type or map array.
Parameters
- 
                string|null$type optional
- Type name to get mapped class for or null to get map array. 
Returns
array<string, class-string<Cake\Database\TypeInterface>>|string|nullConfigured class name for given $type or map array.
map() ¶ public static
map(string $type, string $className): voidRegisters a new type identifier and maps it to a fully namespaced classname.
Parameters
- 
                string$type
- Name of type to map. 
- 
                string$className
- The classname to register. 
Returns
voidset() ¶ public static
set(string $name, Cake\Database\TypeInterface $instance): voidSet TypeInterface instance capable of converting a type identified by $name
Parameters
- 
                string$name
- The type identifier you want to set. 
- 
                Cake\Database\TypeInterface$instance
- The type instance you want to set. 
Returns
voidsetMap() ¶ public static
setMap(array<string, string> $map): voidSet type to classname mapping.
Parameters
- 
                array<string, string>$map
- List of types to be mapped. 
Returns
voidProperty Detail
$_builtTypes ¶ protected static
Contains a map of type object instances to be reused if needed.
Type
array<Cake\Database\TypeInterface>$_types ¶ protected static
List of supported database types. A human readable identifier is used as key and a complete namespaced class name as value representing the class that will do actual type conversions.
Type
array<string, string>