IMakeReadable

Interface for classes that render model data property values to readable values. Unreadable values are data property values which are not strings and are not suitable to immediately usable for being displayed to the end user for example ids, keys, arrays, array keys, etc.
Use case: after querying model data you may want to iterate on the model object in your template but the values set to some properties would not be suitable for displaying, the purpose of the methods in this interface is to change the model properties values in-line to what they can present as human readable. Though when applied to model data, it must only be used for displaying no actions such as "add()", "update()", etc should be done in the model data.
You can also set the "__readable__" property of the model to true so the model will use this "MakeReadable" internally when data is being fetched and set to the properties (on model "next()").
Source
IMakeReadable.php
Implementations
MakeReadable

Static Methods

objectLists

void IMakeReadable::objectLists(IModel model, string sep=self::SEPARATOR)

Renders model object list data properties, replace property values which are not readable with readable values.

Arguments

    model (IModel)
    Model object
    sep=self::SEPARATOR (string)
    When a model property value is an array the readable value must be a string, the array items will be glued together with this string

Returns

void

objects

void IMakeReadable::objects(IModel model, string sep=self::SEPARATOR)

Renders model object data properties, replace property values which are not readable with readable values.

Arguments

    model (IModel)
    Model object
    sep=self::SEPARATOR (string)
    When a model property value is an array the readable value must be a string, the array items will be glued together with this string

Returns

void

render

void IMakeReadable::render(IModel model, string sep=self::SEPARATOR)

Make all properties of the passed model which are non human readable, human readable.

Arguments

    model (IModel)
    Model object
    sep=self::SEPARATOR (string)
    When a model property value is an array the readable value must be a string, the array items will be glued together with this string

Returns

void

scalars

void IMakeReadable::scalars(IModel model)

Make all scalar properties of the passed model which are non human readable, human readable. e.g: if "options" exists in a model data property definition then change the property value as: "property-value=property-def[options][property-value]".

Arguments

Returns

void