IXtract

Interface for utility to extract (IModel instance) queried data into array.
Source
IXtract.php
Implementations
Xtract

Static Methods

byKey

array IXtract::byKey(IModel model, string property=null)

Return an array of model data where array keys are model key values.

Arguments

    model (IModel)
    Model instance
    property=null (string)
    Return only values of this property

Returns

array
{keyVal: {property: val,},} or {keyVal: property-val,}

col

array IXtract::col(IModel model, string property, bool asKey=false)

Extract data of one property from.

Arguments

    model (IModel)
    Model instance
    property (string)
    Property name
    asKey=false (bool)
    false=return as [val,] true=return as {val:val1,}

Returns

array
[val,] or {val:val1,}

key

array IXtract::key(IModel model, bool asKey=false)

Extract model key values from model data.

Arguments

    model (IModel)
    Model instance
    asKey=false (bool)
    false=return as [keyVal,] true= return as {keyVal:keyVal,}

Returns

array
[keyVal,] or {keyVal:keyVal,}