\Lqdt\OrmJson\Database\SchemaDatFieldTableSchemaInterface

When a table schema implements this interface, its `typeMap` method should return an array containing regular field type and datfield type definition as well.

Datfield type definition can be either a regular CakePHP data type string string or an array which provides one or more of the following keys :

  • type => <string> : regular CakePHP registered data type
  • marshal => <callable> : Callback to apply on marshal operations, overrides data type marshal if one is defined
  • toPHP => <callable> : Callback to apply on toPHP operations, overrides data type toPHP if one is defined
  • toDatabase => <callable> : Callback to apply on toDatabase operations, overrides data type toDatabase if one is defined

The callable callback will be provided with following arguments :

  1. Current value in data
  2. Full row of data
  3. Current query

Returned value will be used to replace value at datfield path

Summary

Methods
Constants
isDatField()
setJsonTypes()
setTransientJsonTypes()
getJsonTypeMap()
clearJsonTypes()
clearTransientJsonTypes()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

isDatField()

isDatField(mixed  $field = null): integer

Utility function to check if a field is datfield and if it's v1 or v2 notation

Parameters

mixed $field

Field name

Returns

integer —

0 for non datfield strings, 1 for path@field notation and 2 for field->path notation

setJsonTypes()

setJsonTypes(array|string  $types,array|string|null  $type = null): void

Permanently register JSON type(s) in schema

Parameters

array|string $types

Datfield to type or array of [ => ,...]

array|string|null $type

Type definition

setTransientJsonTypes()

setTransientJsonTypes(array|string  $types,array|null  $type = null): void

Register transient JSON type(s) in schema

These types will be removed after next call to DatFieldTableSchema::typeMap()

Parameters

array|string $types

Datfield to type or array of [ => ,...]

array|null $type

Type definition

getJsonTypeMap()

getJsonTypeMap(): \Lqdt\OrmJson\Database\JsonTypeMap

Returns the JSON type map based on schema type map

Transient JSON types have to be removed afterwards

Returns

\Lqdt\OrmJson\Database\JsonTypeMap

clearJsonTypes()

clearJsonTypes(): self

Clears permanent JSON types

Returns

self

clearTransientJsonTypes()

clearTransientJsonTypes(): self

Clears transient JSON types

Returns

self