Implements default and single-use mappings for columns to their associated types
array<int|string, string>
Array with the default fields and the related types this query might contain.
array<int|string, string>
Array with the fields and the related types that override defaults this query might contain
Creates an instance with the given defaults
Add additional default types into the type map.
Returns the currently configured types.
Gets a map of fields and their associated types for single-use.
Configures a map of fields and associated type.
Sets a map of fields and their associated types for single-use.
Returns an array of all types mapped types
Returns the type of the given column. If there is no single use type is configured, the column type will be looked for inside the default mapping. If neither exist, null will be returned.
__construct(array<int|string, string> $defaults = [])
Creates an instance with the given defaults
array<int|string, string>
$defaults optional The defaults to use.
addDefaults(array<int|string, string> $types): void
Add additional default types into the type map.
If a key already exists it will not be overwritten.
array<int|string, string>
$types The additional types to add.
void
getDefaults(): array<int|string, string>
Returns the currently configured types.
array<int|string, string>
getTypes(): array<int|string, string>
Gets a map of fields and their associated types for single-use.
array<int|string, string>
setDefaults(array<int|string, string> $defaults): $this
Configures a map of fields and associated type.
These values will be used as the default mapping of types for every function in this instance that supports a $types
param.
This method is useful when you want to avoid repeating type definitions as setting types overwrites the last set of types.
$query->setDefaults(['created' => 'datetime', 'is_visible' => 'boolean']);
This method will replace all the existing default mappings with the ones provided. To add into the mappings use addDefaults()
.
array<int|string, string>
$defaults Array where keys are field names / positions and values are the correspondent type.
$this
setTypes(array<int|string, string> $types): $this
Sets a map of fields and their associated types for single-use.
$query->setTypes(['created' => 'time']);
This method will replace all the existing type maps with the ones provided.
array<int|string, string>
$types Array where keys are field names / positions and values are the correspondent type.
$this
toArray(): array<int|string, string>
Returns an array of all types mapped types
array<int|string, string>
type(string|int $column): string|null
Returns the type of the given column. If there is no single use type is configured, the column type will be looked for inside the default mapping. If neither exist, null will be returned.
string|int
$column The type for a given column
string|null
Array with the default fields and the related types this query might contain.
Used to avoid repetition when calling multiple functions inside this class that may require a custom type for a specific field.
array<int|string, string>
Array with the fields and the related types that override defaults this query might contain
Used to avoid repetition when calling multiple functions inside this class that may require a custom type for a specific field.
array<int|string, string>
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.Database.TypeMap.html