\Lqdt\OrmJson\Model\EntityDatFieldTrait

This trait adds useful methods to get and set values in JSON fields

All methods can safely be called on regular fields

Summary

Methods
Properties
Constants
__construct()
jsonGet()
jsonSet()
jsonIsset()
jsonUnset()
jsonMerge()
No public properties found
No constants found
No protected methods found
$_hidden
N/A
No private methods found
No private properties found
N/A

Properties

$_hidden

$_hidden : 

Type

Methods

__construct()

__construct(array  $properties = array(), array  $options = array()) 

Parameters

array $properties
array $options

jsonGet()

jsonGet(string  $datfield, boolean  $assoc = false) : mixed

Get a value inside field JSON data

Parameters

string $datfield

Datfield

boolean $assoc

Returns associative array if true instead of an object

Returns

mixed —

Field value

jsonSet()

jsonSet(string|array  $datfield, mixed  $value = null) : self

Set a value inside field JSON data

Parameters

string|array $datfield

Dafield or array of [datfield => value]

mixed $value

Value to set

Returns

self

jsonIsset()

jsonIsset(string  $datfield) : boolean

Check if a key exists within path

Parameters

string $datfield

Datfield or regular field

Returns

boolean —

true if key exists

jsonUnset()

jsonUnset(string|array  $datfield) : self

Delete a key from JSON data

Parameters

string|array $datfield

Datfield

Returns

self

jsonMerge()

jsonMerge() : self

Merge new json values into fields when called after patchEntity

Returns

self